| java.lang.Object edu.umd.cs.findbugs.ba.Hierarchy
Hierarchy | public class Hierarchy (Code) | | Facade for class hierarchy queries.
These typically access the class hierarchy using
the
org.apache.bcel.Repository class. Callers should generally
expect to handle ClassNotFoundException for when referenced
classes can't be found.
author: David Hovemeyer |
Method Summary | |
public static boolean | accessFlagsAreConcrete(int accessFlags) | public static JavaClassAndMethod | findConcreteMethod(JavaClass javaClass, String methodName, String methodSig) Find a method in given class. | public static ObjectType[] | findDeclaredExceptions(InvokeInstruction inv, ConstantPoolGen cpg) Find the declared exceptions for the method called
by given instruction. | public static JavaClassAndMethod | findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg) Look up the method referenced by given InvokeInstruction. | public static JavaClassAndMethod | findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser chooser) Look up the method referenced by given InvokeInstruction. | public static Field | findField(String className, String fieldName) Find a field with given name defined in given class. | public static JavaClassAndMethod | findInvocationLeastUpperBound(InvokeInstruction inv, ConstantPoolGen cpg) Find the least upper bound method in the class hierarchy
which could be called by the given InvokeInstruction.
One reason this method is useful is that it indicates
which declared exceptions are thrown by the called methods.
- For invokespecial, this is simply an
exact lookup.
- For invokestatic and invokevirtual, the named class is searched,
followed by superclasses up to the root of the object
hierarchy (java.lang.Object).
| public static JavaClassAndMethod | findInvocationLeastUpperBound(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser methodChooser) | public static JavaClassAndMethod | findInvocationLeastUpperBound(JavaClass jClass, String methodName, String methodSig, JavaClassAndMethodChooser methodChooser, boolean invokeInterface) | public static JavaClassAndMethod | findMethod(JavaClass javaClass, String methodName, String methodSig) Find a method in given class. | public static JavaClassAndMethod | findMethod(JavaClass javaClass, String methodName, String methodSig, JavaClassAndMethodChooser chooser) | public static XMethod | findMethod(ClassDescriptor classDesc, String methodName, String methodSig, boolean isStatic) Find a method in given class. | public static JavaClassAndMethod | findMethod(JavaClass[] classList, String methodName, String methodSig) Find a method in given list of classes,
searching the classes in order. | public static JavaClassAndMethod | findMethod(JavaClass[] classList, String methodName, String methodSig, JavaClassAndMethodChooser chooser) Find a method in given list of classes,
searching the classes in order. | public static XField | findXField(String className, String fieldName, String fieldSig, boolean isStatic) Look up a field with given name and signature in given class,
returning it as an
XField XField object. | public static XField | findXField(FieldInstruction fins, ConstantPoolGen cpg) Look up the field referenced by given FieldInstruction,
returning it as an
XField XField object. | public static XMethod | findXMethod(JavaClass javaClass, String methodName, String methodSig, JavaClassAndMethodChooser chooser) Find a method in given class. | public static XMethod | findXMethod(JavaClass[] classList, String methodName, String methodSig) Find XMethod for method in given list of classes,
searching the classes in order. | public static XMethod | findXMethod(JavaClass[] classList, String methodName, String methodSig, JavaClassAndMethodChooser chooser) Find XMethod for method in given list of classes,
searching the classes in order. | public static InnerClassAccess | getInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) Get the InnerClassAccess for access method called
by given INVOKESTATIC. | public static boolean | isConcrete(XMethod xmethod) Return whether or not the given method is concrete. | public static boolean | isInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) Determine whether the given INVOKESTATIC instruction
is an inner-class field accessor method. | public static boolean | isMonitorNotify(String methodName, String methodSig) Determine if method whose name and signature is specified
is a monitor notify operation. | public static boolean | isMonitorNotify(Instruction ins, ConstantPoolGen cpg) Determine if given Instruction is a monitor wait. | public static boolean | isMonitorWait(String methodName, String methodSig) Determine if method whose name and signature is specified
is a monitor wait operation. | public static boolean | isMonitorWait(Instruction ins, ConstantPoolGen cpg) Determine if given Instruction is a monitor wait. | public static boolean | isSubtype(String clsName, String possibleSupertypeClassName) Determine whether one class (or reference type) is a subtype
of another. | public static boolean | isSubtype(ReferenceType t, ReferenceType possibleSupertype) Determine if one reference type is a subtype of another. | public static boolean | isUncheckedException(ObjectType type) Determine if the given ObjectType refers to an unchecked
exception (RuntimeException or Error). | public static boolean | isUniversalExceptionHandler(ObjectType catchType) Determine if the given ObjectType reference represents
a universal exception handler. | public static Set<JavaClassAndMethod> | resolveMethodCallTargets(InvokeInstruction invokeInstruction, TypeFrame typeFrame, ConstantPoolGen cpg) Resolve possible method call targets. | public static Set<JavaClassAndMethod> | resolveMethodCallTargets(ReferenceType receiverType, InvokeInstruction invokeInstruction, ConstantPoolGen cpg) Resolve possible instance method call targets. | public static Set<JavaClassAndMethod> | resolveMethodCallTargets(ReferenceType receiverType, InvokeInstruction invokeInstruction, ConstantPoolGen cpg, boolean receiverTypeIsExact) Resolve possible instance method call targets. | public static JavaClassAndMethod | visitSuperClassMethods(JavaClassAndMethod method, JavaClassAndMethodChooser chooser) Visit all superclass methods which the given method overrides. | public static JavaClassAndMethod | visitSuperInterfaceMethods(JavaClassAndMethod method, JavaClassAndMethodChooser chooser) Visit all superinterface methods which the given method implements. |
CONCRETE_METHOD | final public static JavaClassAndMethodChooser CONCRETE_METHOD(Code) | | JavaClassAndMethodChooser which accepts only concrete (not abstract or native) methods.
|
DEBUG_METHOD_LOOKUP | final protected static boolean DEBUG_METHOD_LOOKUP(Code) | | |
ERROR_TYPE | final public static ObjectType ERROR_TYPE(Code) | | Type of java.lang.Error.
|
EXCEPTION_TYPE | final public static ObjectType EXCEPTION_TYPE(Code) | | Type of java.lang.Exception.
|
RUNTIME_EXCEPTION_TYPE | final public static ObjectType RUNTIME_EXCEPTION_TYPE(Code) | | Type of java.lang.RuntimeException.
|
accessFlagsAreConcrete | public static boolean accessFlagsAreConcrete(int accessFlags)(Code) | | |
findConcreteMethod | public static JavaClassAndMethod findConcreteMethod(JavaClass javaClass, String methodName, String methodSig)(Code) | | Find a method in given class.
Parameters: javaClass - the class Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method the JavaClassAndMethod, or null if no such method exists in the class |
findDeclaredExceptions | public static ObjectType[] findDeclaredExceptions(InvokeInstruction inv, ConstantPoolGen cpg) throws ClassNotFoundException(Code) | | Find the declared exceptions for the method called
by given instruction.
Parameters: inv - the InvokeInstruction Parameters: cpg - the ConstantPoolGen used by the class the InvokeInstruction belongs to array of ObjectTypes of thrown exceptions, or nullif we can't find the list of declared exceptionsHierarchy2.findDeclaredExceptions(InvokeInstructionConstantPoolGen) |
findExactMethod | public static JavaClassAndMethod findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg) throws ClassNotFoundException(Code) | | Look up the method referenced by given InvokeInstruction.
This method does not look for implementations in
super or subclasses according to the virtual dispatch rules.
Parameters: inv - the InvokeInstruction Parameters: cpg - the ConstantPoolGen used by the class the InvokeInstruction belongs to the JavaClassAndMethod, or null if no such method is defined in the class |
findExactMethod | public static JavaClassAndMethod findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser chooser) throws ClassNotFoundException(Code) | | Look up the method referenced by given InvokeInstruction.
This method does not look for implementations in
super or subclasses according to the virtual dispatch rules.
Parameters: inv - the InvokeInstruction Parameters: cpg - the ConstantPoolGen used by the class the InvokeInstruction belongs to Parameters: chooser - JavaClassAndMethodChooser to use to pick the method from among the candidates the JavaClassAndMethod, or null if no such method is defined in the class |
findField | public static Field findField(String className, String fieldName) throws ClassNotFoundException(Code) | | Find a field with given name defined in given class.
Parameters: className - the name of the class Parameters: fieldName - the name of the field the Field, or null if no such field could be found |
findInvocationLeastUpperBound | public static JavaClassAndMethod findInvocationLeastUpperBound(InvokeInstruction inv, ConstantPoolGen cpg) throws ClassNotFoundException(Code) | | Find the least upper bound method in the class hierarchy
which could be called by the given InvokeInstruction.
One reason this method is useful is that it indicates
which declared exceptions are thrown by the called methods.
- For invokespecial, this is simply an
exact lookup.
- For invokestatic and invokevirtual, the named class is searched,
followed by superclasses up to the root of the object
hierarchy (java.lang.Object). Yes, invokestatic really is declared
to check superclasses. See VMSpec, 2nd ed, sec. 5.4.3.3.
- For invokeinterface, the named class is searched,
followed by all interfaces transitively declared by the class.
(Question: is the order important here? Maybe the VM spec
requires that the actual interface desired is given,
so the extended lookup will not be required. Should check.)
Parameters: inv - the InvokeInstruction Parameters: cpg - the ConstantPoolGen used by the class the InvokeInstruction belongs to the JavaClassAndMethod, or null if no matching method can be found |
findMethod | public static JavaClassAndMethod findMethod(JavaClass javaClass, String methodName, String methodSig)(Code) | | Find a method in given class.
Parameters: javaClass - the class Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method the JavaClassAndMethod, or null if no such method exists in the class |
findMethod | public static XMethod findMethod(ClassDescriptor classDesc, String methodName, String methodSig, boolean isStatic)(Code) | | Find a method in given class.
Parameters: classDesc - the class descriptor Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method Parameters: isStatic - are we looking for a static method? the JavaClassAndMethod, or null if no such method exists in the class |
findMethod | public static JavaClassAndMethod findMethod(JavaClass[] classList, String methodName, String methodSig)(Code) | | Find a method in given list of classes,
searching the classes in order.
Parameters: classList - list of classes in which to search Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method the JavaClassAndMethod, or null if no such method exists in the class |
findMethod | public static JavaClassAndMethod findMethod(JavaClass[] classList, String methodName, String methodSig, JavaClassAndMethodChooser chooser)(Code) | | Find a method in given list of classes,
searching the classes in order.
Parameters: classList - list of classes in which to search Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method Parameters: chooser - JavaClassAndMethodChooser to select which methods are considered;it must return true for a method to be returned the JavaClassAndMethod, or null if no such method exists in the class |
findXField | public static XField findXField(String className, String fieldName, String fieldSig, boolean isStatic) throws ClassNotFoundException(Code) | | Look up a field with given name and signature in given class,
returning it as an
XField XField object.
If a field can't be found in the immediate class,
its superclass is search, and so forth.
Parameters: className - name of the class through which the fieldis referenced Parameters: fieldName - name of the field Parameters: fieldSig - signature of the field Parameters: isStatic - true if field is static, false otherwise an XField object representing the field, or null if no such field could be found |
findXField | public static XField findXField(FieldInstruction fins, ConstantPoolGen cpg) throws ClassNotFoundException(Code) | | Look up the field referenced by given FieldInstruction,
returning it as an
XField XField object.
Parameters: fins - the FieldInstruction Parameters: cpg - the ConstantPoolGen used by the class containing the instruction an XField object representing the field, or nullif no such field could be found |
findXMethod | public static XMethod findXMethod(JavaClass javaClass, String methodName, String methodSig, JavaClassAndMethodChooser chooser)(Code) | | Find a method in given class.
Parameters: javaClass - the class Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method Parameters: chooser - the JavaClassAndMethodChooser to use to screen possible candidates the XMethod, or null if no such method exists in the class |
findXMethod | public static XMethod findXMethod(JavaClass[] classList, String methodName, String methodSig)(Code) | | Find XMethod for method in given list of classes,
searching the classes in order.
Parameters: classList - list of classes in which to search Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method the XMethod, or null if no such method exists in the class |
findXMethod | public static XMethod findXMethod(JavaClass[] classList, String methodName, String methodSig, JavaClassAndMethodChooser chooser)(Code) | | Find XMethod for method in given list of classes,
searching the classes in order.
Parameters: classList - list of classes in which to search Parameters: methodName - the name of the method Parameters: methodSig - the signature of the method Parameters: chooser - JavaClassAndMethodChooser to select which methods are considered;it must return true for a method to be returned the XMethod, or null if no such method exists in the class |
getInnerClassAccess | public static InnerClassAccess getInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) throws ClassNotFoundException(Code) | | Get the InnerClassAccess for access method called
by given INVOKESTATIC.
Parameters: inv - the INVOKESTATIC instruction Parameters: cpg - the ConstantPoolGen for the method the InnerClassAccess, or null if the instruction is notan inner-class access |
isConcrete | public static boolean isConcrete(XMethod xmethod)(Code) | | Return whether or not the given method is concrete.
Parameters: xmethod - the method true if the method is concrete, false otherwise |
isInnerClassAccess | public static boolean isInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg)(Code) | | Determine whether the given INVOKESTATIC instruction
is an inner-class field accessor method.
Parameters: inv - the INVOKESTATIC instruction Parameters: cpg - the ConstantPoolGen for the method true if the instruction is an inner-class field accessor, false if not |
isMonitorNotify | public static boolean isMonitorNotify(String methodName, String methodSig)(Code) | | Determine if method whose name and signature is specified
is a monitor notify operation.
Parameters: methodName - name of the method Parameters: methodSig - signature of the method true if the method is a monitor notify, false if not |
isMonitorNotify | public static boolean isMonitorNotify(Instruction ins, ConstantPoolGen cpg)(Code) | | Determine if given Instruction is a monitor wait.
Parameters: ins - the Instruction Parameters: cpg - the ConstantPoolGen for the Instruction true if the instruction is a monitor wait, false if not |
isMonitorWait | public static boolean isMonitorWait(String methodName, String methodSig)(Code) | | Determine if method whose name and signature is specified
is a monitor wait operation.
Parameters: methodName - name of the method Parameters: methodSig - signature of the method true if the method is a monitor wait, false if not |
isMonitorWait | public static boolean isMonitorWait(Instruction ins, ConstantPoolGen cpg)(Code) | | Determine if given Instruction is a monitor wait.
Parameters: ins - the Instruction Parameters: cpg - the ConstantPoolGen for the Instruction true if the instruction is a monitor wait, false if not |
isSubtype | public static boolean isSubtype(String clsName, String possibleSupertypeClassName) throws ClassNotFoundException(Code) | | Determine whether one class (or reference type) is a subtype
of another.
Parameters: clsName - the name of the class or reference type Parameters: possibleSupertypeClassName - the name of the possible superclass true if clsName is a subtype of possibleSupertypeClassName,false if not |
isSubtype | public static boolean isSubtype(ReferenceType t, ReferenceType possibleSupertype) throws ClassNotFoundException(Code) | | Determine if one reference type is a subtype of another.
Parameters: t - a reference type Parameters: possibleSupertype - the possible supertype true if t is a subtype of possibleSupertype,false if not |
isUncheckedException | public static boolean isUncheckedException(ObjectType type) throws ClassNotFoundException(Code) | | Determine if the given ObjectType refers to an unchecked
exception (RuntimeException or Error).
|
isUniversalExceptionHandler | public static boolean isUniversalExceptionHandler(ObjectType catchType)(Code) | | Determine if the given ObjectType reference represents
a universal exception handler. That is,
one that will catch any kind of exception.
Parameters: catchType - the ObjectType of the exception handler true if catchType is null, or if catchType isjava.lang.Throwable |
resolveMethodCallTargets | public static Set<JavaClassAndMethod> resolveMethodCallTargets(ReferenceType receiverType, InvokeInstruction invokeInstruction, ConstantPoolGen cpg) throws ClassNotFoundException(Code) | | Resolve possible instance method call targets.
Assumes that invokevirtual and invokeinterface methods may
call any subtype of the receiver class.
Parameters: receiverType - type of the receiver object Parameters: invokeInstruction - the InvokeInstruction Parameters: cpg - the ConstantPoolGen Set of methods which might be called throws: ClassNotFoundException - |
resolveMethodCallTargets | public static Set<JavaClassAndMethod> resolveMethodCallTargets(ReferenceType receiverType, InvokeInstruction invokeInstruction, ConstantPoolGen cpg, boolean receiverTypeIsExact) throws ClassNotFoundException(Code) | | Resolve possible instance method call targets.
Parameters: receiverType - type of the receiver object Parameters: invokeInstruction - the InvokeInstruction Parameters: cpg - the ConstantPoolGen Parameters: receiverTypeIsExact - if true, the receiver type is known exactly,which should allow a precise result Set of methods which might be called throws: ClassNotFoundException - |
|
|