@ParametersAreNonnullByDefault public class Subtypes2 extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
static boolean |
DEBUG_QUERIES |
static boolean |
ENABLE_SUBTYPES2_FOR_COMMON_SUPERCLASS_QUERIES |
| Constructor and Description |
|---|
Subtypes2()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addApplicationClass(XClass appXClass)
Add an application class, and its transitive supertypes, to the
inheritance graph.
|
void |
addClass(XClass xclass)
Add a class or interface, and its transitive supertypes, to the
inheritance graph.
|
Set<ClassDescriptor> |
getDirectSubtypes(ClassDescriptor classDescriptor)
Get known subtypes of given class.
|
org.apache.bcel.generic.ObjectType |
getFirstCommonSuperclass(org.apache.bcel.generic.ObjectType a,
org.apache.bcel.generic.ObjectType b)
Get the first common superclass of the given object types.
|
org.apache.bcel.generic.ReferenceType |
getFirstCommonSuperclass(org.apache.bcel.generic.ReferenceType a,
org.apache.bcel.generic.ReferenceType b)
Get the first common superclass of the given reference types.
|
InheritanceGraph |
getGraph() |
Set<ClassDescriptor> |
getSubtypes(ClassDescriptor classDescriptor)
Get known subtypes of given class.
|
edu.umd.cs.findbugs.ba.ch.Subtypes2.SupertypeQueryResults |
getSupertypeQueryResults(ClassDescriptor classDescriptor)
Look up or compute the SupertypeQueryResults for class named by given
ClassDescriptor.
|
Set<ClassDescriptor> |
getTransitiveCommonSubtypes(ClassDescriptor classDescriptor1,
ClassDescriptor classDescriptor2)
Get the set of common subtypes of the two given classes.
|
Collection<XClass> |
getXClassCollection()
Get Collection of all XClass objects (resolved classes) seen so far.
|
boolean |
hasKnownSubclasses(ClassDescriptor classDescriptor) |
boolean |
hasSubtypes(ClassDescriptor classDescriptor)
Determine whether or not the given class has any known subtypes.
|
static boolean |
instanceOf(ClassDescriptor subDescriptor,
Class<?> c) |
static boolean |
instanceOf(ClassDescriptor subDescriptor,
String dottedSupertype) |
static boolean |
instanceOf(org.apache.bcel.classfile.JavaClass subtype,
String dottedSupertype) |
static boolean |
instanceOf(String dottedSubtype,
String dottedSupertype) |
boolean |
isApplicationClass(ClassDescriptor descriptor) |
static boolean |
isCollection(org.apache.bcel.generic.ReferenceType target) |
static boolean |
isContainer(org.apache.bcel.generic.ReferenceType target)
A collection, a map, or some other container
|
static boolean |
isJSP(org.apache.bcel.classfile.JavaClass javaClass) |
boolean |
isSubtype(ClassDescriptor subDesc,
ClassDescriptor... superDesc) |
boolean |
isSubtype(ClassDescriptor subDesc,
ClassDescriptor superDesc) |
boolean |
isSubtype(org.apache.bcel.generic.ObjectType type,
org.apache.bcel.generic.ObjectType possibleSupertype)
Determine whether or not a given ObjectType is a subtype of another.
|
boolean |
isSubtype(org.apache.bcel.generic.ReferenceType type,
org.apache.bcel.generic.ReferenceType possibleSupertype)
Determine whether or not a given ReferenceType is a subtype of another.
|
boolean |
isSubtype0(ClassDescriptor subDesc,
ClassDescriptor superDesc) |
void |
traverseSupertypes(ClassDescriptor start,
InheritanceGraphVisitor visitor)
Starting at the class or interface named by the given ClassDescriptor,
traverse the inheritance graph, exploring all paths from the class or
interface to java.lang.Object.
|
void |
traverseSupertypesDepthFirst(ClassDescriptor start,
SupertypeTraversalVisitor visitor)
Starting at the class or interface named by the given ClassDescriptor,
traverse the inheritance graph depth first, visiting each class only
once.
|
public static final boolean ENABLE_SUBTYPES2_FOR_COMMON_SUPERCLASS_QUERIES
public static final boolean DEBUG
public static final boolean DEBUG_QUERIES
public InheritanceGraph getGraph()
public static boolean isCollection(org.apache.bcel.generic.ReferenceType target)
throws ClassNotFoundException
ClassNotFoundExceptionpublic static boolean isContainer(org.apache.bcel.generic.ReferenceType target)
throws ClassNotFoundException
ClassNotFoundExceptionpublic static boolean isJSP(org.apache.bcel.classfile.JavaClass javaClass)
public static boolean instanceOf(@DottedClassName String dottedSubtype, @DottedClassName String dottedSupertype)
public static boolean instanceOf(ClassDescriptor subDescriptor, Class<?> c)
public static boolean instanceOf(ClassDescriptor subDescriptor, @DottedClassName String dottedSupertype)
public static boolean instanceOf(org.apache.bcel.classfile.JavaClass subtype,
@DottedClassName
String dottedSupertype)
public void addApplicationClass(XClass appXClass)
appXClass - application XClass to add to the inheritance graphpublic boolean isApplicationClass(ClassDescriptor descriptor)
public void addClass(XClass xclass)
xclass - XClass to add to the inheritance graphpublic boolean isSubtype(org.apache.bcel.generic.ReferenceType type,
org.apache.bcel.generic.ReferenceType possibleSupertype)
throws ClassNotFoundException
type - a ReferenceTypepossibleSupertype - another Reference typetype is a subtype of
possibleSupertype, false if notClassNotFoundException - if a missing class prevents a definitive answerpublic boolean isSubtype(ClassDescriptor subDesc, ClassDescriptor superDesc) throws ClassNotFoundException
ClassNotFoundExceptionpublic boolean isSubtype(ClassDescriptor subDesc, ClassDescriptor... superDesc) throws ClassNotFoundException
ClassNotFoundExceptionpublic boolean isSubtype0(ClassDescriptor subDesc, ClassDescriptor superDesc) throws ClassNotFoundException
ClassNotFoundExceptionpublic boolean isSubtype(org.apache.bcel.generic.ObjectType type,
org.apache.bcel.generic.ObjectType possibleSupertype)
throws ClassNotFoundException
type - a ReferenceTypepossibleSupertype - another Reference typetype is a subtype of
possibleSupertype, false if notClassNotFoundException - if a missing class prevents a definitive answerpublic org.apache.bcel.generic.ReferenceType getFirstCommonSuperclass(org.apache.bcel.generic.ReferenceType a,
org.apache.bcel.generic.ReferenceType b)
throws ClassNotFoundException
a and
b are the same type. Otherwise, we try to return as accurate
a type as possible. This method is used as the meet operator in
TypeDataflowAnalysis, and is intended to follow (more or less) the JVM
bytecode verifier semantics.
This method should be used in preference to the
getFirstCommonSuperclass() method in ReferenceType.
a - a ReferenceTypeb - another ReferenceTypea and bClassNotFoundExceptionpublic org.apache.bcel.generic.ObjectType getFirstCommonSuperclass(org.apache.bcel.generic.ObjectType a,
org.apache.bcel.generic.ObjectType b)
throws ClassNotFoundException
a and b
are the same type. Otherwise, we try to return as accurate a type as
possible. This method is used as the meet operator in
TypeDataflowAnalysis, and is intended to follow (more or less) the JVM
bytecode verifier semantics.
This method should be used in preference to the
getFirstCommonSuperclass() method in ReferenceType.
a - an ObjectTypeb - another ObjectTypea and bClassNotFoundExceptionpublic Set<ClassDescriptor> getSubtypes(ClassDescriptor classDescriptor) throws ClassNotFoundException
classDescriptor - ClassDescriptor naming a classClassNotFoundExceptionpublic boolean hasSubtypes(ClassDescriptor classDescriptor) throws ClassNotFoundException
classDescriptor - ClassDescriptor naming a classClassNotFoundExceptionpublic Set<ClassDescriptor> getDirectSubtypes(ClassDescriptor classDescriptor) throws ClassNotFoundException
classDescriptor - ClassDescriptor naming a classClassNotFoundExceptionpublic Set<ClassDescriptor> getTransitiveCommonSubtypes(ClassDescriptor classDescriptor1, ClassDescriptor classDescriptor2) throws ClassNotFoundException
classDescriptor1 - a ClassDescriptor naming a classclassDescriptor2 - a ClassDescriptor naming another classClassNotFoundExceptionpublic Collection<XClass> getXClassCollection()
public void traverseSupertypes(ClassDescriptor start, InheritanceGraphVisitor visitor) throws ClassNotFoundException
start - ClassDescriptor naming the class where the traversal should
startvisitor - an InheritanceGraphVisitorClassNotFoundException - if the start vertex cannot be resolvedpublic void traverseSupertypesDepthFirst(ClassDescriptor start, SupertypeTraversalVisitor visitor) throws ClassNotFoundException
start - ClassDescriptor naming the class where the traversal should
startvisitor - an InheritanceGraphVisitorClassNotFoundException - if the start vertex cannot be resolvedpublic boolean hasKnownSubclasses(ClassDescriptor classDescriptor) throws ClassNotFoundException
ClassNotFoundExceptionpublic edu.umd.cs.findbugs.ba.ch.Subtypes2.SupertypeQueryResults getSupertypeQueryResults(ClassDescriptor classDescriptor)
classDescriptor - a ClassDescriptorCopyright © 2003–2015. All rights reserved.