Class XFactory
java.lang.Object
edu.umd.cs.findbugs.ba.XFactory
Factory methods for creating XMethod objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.This field is not updated by any code in the project.static final booleanstatic final booleanprivate final Map<FieldDescriptor, XField> private final Set<MethodDescriptor> private final Map<MethodDescriptor, XMethod> private final Set<ClassDescriptor> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidbooleanstatic voidassertDottedClassName(String className) static voidassertSlashedClassName(String className) voidstatic StringDeprecated.static <E extends ClassMember>
intcompare(E lhs, E rhs) Compare XMethod or XField object objects.static XFieldcreateReferencedXField(DismantleBytecode visitor) static XMethodcreateReferencedXMethod(DismantleBytecode visitor) static XFieldcreateXField(FieldDescriptor desc) static XFieldstatic XFieldcreateXField(PreorderVisitor visitor) Create an XField object from the field currently being visited by the given PreorderVisitor.static XFieldcreateXField(String className, String fieldName, String fieldSignature, boolean isStatic) Create an XField objectstatic XFieldcreateXField(String className, org.apache.bcel.classfile.Field field) Create an XField object from a BCEL Field.static XFieldcreateXField(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Field field) static XFieldcreateXField(org.apache.bcel.generic.FieldInstruction fieldInstruction, org.apache.bcel.generic.ConstantPoolGen cpg) static XFieldcreateXFieldUsingSlashedClassName(String className, String fieldName, String fieldSignature, boolean isStatic) Create an XField objectstatic XMethodcreateXMethod(JavaClassAndMethod classAndMethod) static XMethodstatic XMethodstatic XMethodcreateXMethod(PreorderVisitor visitor) Create an XMethod object from the method currently being visited by the given PreorderVisitor.static XMethodcreateXMethod(String className, String methodName, String methodSig, boolean isStatic) private static XMethodcreateXMethod(String className, String methodName, String methodSig, int accessFlags) static XMethodcreateXMethod(String className, org.apache.bcel.classfile.Method method) Create an XMethod object from a BCEL Method.static XMethodcreateXMethod(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Method method) Create an XMethod object from a BCEL Method.static XMethodcreateXMethod(org.apache.bcel.generic.InvokeInstruction invokeInstruction, org.apache.bcel.generic.ConstantPoolGen cpg) Create an XMethod object from an InvokeInstruction.static XMethodcreateXMethod(org.apache.bcel.generic.MethodGen methodGen) static XMethodcreateXMethodUsingSlashedClassName(String className, String methodName, String methodSig, boolean isStatic) private static Stringstatic XFieldstatic XFieldgetExactXField(String className, String name, String signature, boolean isStatic) Get an XField object exactly matching given class, name, and signature.static XFieldgetExactXField(String className, org.apache.bcel.classfile.Field f) getXClass(ClassDescriptor classDescriptor) Get the XClass object providing information about the class named by the given ClassDescriptor.voidbooleanbooleanprivate booleanisCalledDirectlyOrIndirectly(ClassDescriptor clazzDescriptor, XMethod m) booleanbooleanbooleanDeprecated.booleanbooleanDeprecated.This method does not work as expected.static voidprofile()private XFieldresolveXField(FieldDescriptor originalDescriptor) private XMethodresolveXMethod(MethodDescriptor originalDescriptor)
-
Field Details
-
DEBUG_UNRESOLVED
public static final boolean DEBUG_UNRESOLVED -
reflectiveClasses
-
methods
-
fields
-
calledMethods
-
emptyArrays
-
calledMethodSignatures
Deprecated.This field is not updated by any code in the project. Will be removed in 5.x release. -
functionsThatMightBeMistakenForProcedures
-
DEBUG_CIRCULARITY
public static final boolean DEBUG_CIRCULARITY
-
-
Constructor Details
-
XFactory
public XFactory()Constructor.
-
-
Method Details
-
canonicalizeAll
public void canonicalizeAll() -
intern
-
allFields
-
addCalledMethod
-
addEmptyArrayField
-
isEmptyArrayField
-
isCalled
-
getCalledMethods
-
addFunctionThatMightBeMistakenForProcedures
-
isFunctionshatMightBeMistakenForProcedures
-
getReflectiveClasses
-
isReflectiveClass
-
addReflectiveClasses
-
isCalledDirectlyOrIndirectly
-
isCalledDirectlyOrIndirectly
private boolean isCalledDirectlyOrIndirectly(@CheckForNull ClassDescriptor clazzDescriptor, XMethod m) throws CheckedAnalysisException - Throws:
CheckedAnalysisException
-
nameAndSignatureIsCalled
Deprecated.This method does not work as expected. Will be removed in 5.x release. -
getDetailedSignature
-
isInterned
Deprecated. -
canonicalizeString
-
createXMethod
-
createXMethod
private static XMethod createXMethod(@DottedClassName String className, String methodName, String methodSig, int accessFlags) -
createXMethod
public static XMethod createXMethod(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Method method) Create an XMethod object from a BCEL Method.- Parameters:
javaClass- the class to which the Method belongsmethod- the Method- Returns:
- an XMethod representing the Method
-
assertDottedClassName
-
assertSlashedClassName
-
createXMethodUsingSlashedClassName
public static XMethod createXMethodUsingSlashedClassName(@SlashedClassName String className, String methodName, String methodSig, boolean isStatic) - Parameters:
className-methodName-methodSig-isStatic-- Returns:
- the created XMethod
-
createXMethod
public static XMethod createXMethod(@DottedClassName String className, String methodName, String methodSig, boolean isStatic) - Parameters:
className-methodName-methodSig-isStatic-- Returns:
- the created XMethod
-
createXMethod
-
profile
public static void profile() -
resolveXMethod
-
createXMethod
-
createXFieldUsingSlashedClassName
public static XField createXFieldUsingSlashedClassName(@SlashedClassName String className, String fieldName, String fieldSignature, boolean isStatic) Create an XField object- Parameters:
className-fieldName-fieldSignature-isStatic-- Returns:
- the created XField
-
createXField
public static XField createXField(@DottedClassName String className, String fieldName, String fieldSignature, boolean isStatic) Create an XField object- Parameters:
className-fieldName-fieldSignature-isStatic-- Returns:
- the created XField
-
createXField
public static XField createXField(org.apache.bcel.generic.FieldInstruction fieldInstruction, org.apache.bcel.generic.ConstantPoolGen cpg) -
createReferencedXField
-
createReferencedXMethod
-
createXField
-
createXField
public static XField createXField(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Field field) -
createXField
-
getExactXField
public static XField getExactXField(@SlashedClassName String className, String name, String signature, boolean isStatic) Get an XField object exactly matching given class, name, and signature. May return an unresolved object (if the class can't be found, or does not directly declare named field).- Parameters:
className- name of class containing the fieldname- name of fieldsignature- field signatureisStatic- field access flags- Returns:
- XField exactly matching class name, field name, and field signature
-
getExactXField
@Nonnull public static XField getExactXField(@SlashedClassName String className, org.apache.bcel.classfile.Field f) -
getExactXField
-
createXField
-
resolveXField
-
createXMethod
public static XMethod createXMethod(org.apache.bcel.generic.InvokeInstruction invokeInstruction, org.apache.bcel.generic.ConstantPoolGen cpg) Create an XMethod object from an InvokeInstruction.- Parameters:
invokeInstruction- the InvokeInstructioncpg- ConstantPoolGen from the class containing the instruction- Returns:
- XMethod representing the method called by the InvokeInstruction
-
createXMethod
Create an XMethod object from the method currently being visited by the given PreorderVisitor.- Parameters:
visitor- the PreorderVisitor- Returns:
- the XMethod representing the method currently being visited
-
createXField
Create an XField object from the field currently being visited by the given PreorderVisitor.- Parameters:
visitor- the PreorderVisitor- Returns:
- the XField representing the method currently being visited
-
createXMethod
-
createXMethod
-
getXClass
Get the XClass object providing information about the class named by the given ClassDescriptor.- Parameters:
classDescriptor- a ClassDescriptor- Returns:
- an XClass object providing information about the class, or null if the class cannot be found
-
compare
Compare XMethod or XField object objects. All methods that implement XMethod or XField should delegate to this method when implementing compareTo(Object) if the right-hand object implements XField or XMethod.- Parameters:
lhs- an XMethod or XFieldrhs- an XMethod or XField- Returns:
- comparison of lhs and rhs
-