Package edu.umd.cs.findbugs.bcel
Class BCELUtil
java.lang.Object
edu.umd.cs.findbugs.bcel.BCELUtil
Utility methods for detectors and analyses using BCEL.
- Author:
- David Hovemeyer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FieldDescriptorgetAccessedFieldDescriptor(org.apache.bcel.generic.FieldInstruction fins, org.apache.bcel.generic.ConstantPoolGen cpg) Get FieldDescriptor describing the field accessed by given FieldInstruction.static MethodDescriptorgetCalledMethodDescriptor(org.apache.bcel.generic.InvokeInstruction inv, org.apache.bcel.generic.ConstantPoolGen cpg) Get a MethodDescriptor describing the method called by given InvokeInstruction.static ClassDescriptorgetClassDescriptor(org.apache.bcel.classfile.JavaClass jclass) Construct a ClassDescriptor from a JavaClass.static ClassDescriptorgetClassDescriptor(org.apache.bcel.generic.ObjectType type) Deprecated.static MethodDescriptorgetMethodDescriptor(org.apache.bcel.classfile.JavaClass jclass, org.apache.bcel.classfile.Method method) Construct a MethodDescriptor from JavaClass and method.static org.apache.bcel.generic.ObjectTypegetObjectTypeInstance(Class<?> clazz) static org.apache.bcel.generic.ObjectTypegetObjectTypeInstance(String className) static booleanisSynthetic(org.apache.bcel.classfile.FieldOrMethod m) static booleanisSynthetic(org.apache.bcel.classfile.JavaClass j) static booleanisSynthetic(org.apache.bcel.generic.FieldGenOrMethodGen m) static booleanpreTiger(org.apache.bcel.classfile.JavaClass jclass) Checks if classfile was compiled for pre 1.5 targetstatic voidthrowClassNotFoundException(ClassDescriptor classDescriptor) Deprecated.
-
Constructor Details
-
BCELUtil
public BCELUtil()
-
-
Method Details
-
getMethodDescriptor
public static MethodDescriptor getMethodDescriptor(org.apache.bcel.classfile.JavaClass jclass, org.apache.bcel.classfile.Method method) Construct a MethodDescriptor from JavaClass and method.- Parameters:
jclass- a JavaClassmethod- a Method belonging to the JavaClass- Returns:
- a MethodDescriptor identifying the method
-
getCalledMethodDescriptor
public static MethodDescriptor getCalledMethodDescriptor(org.apache.bcel.generic.InvokeInstruction inv, org.apache.bcel.generic.ConstantPoolGen cpg) Get a MethodDescriptor describing the method called by given InvokeInstruction.- Parameters:
inv- the InvokeInstructioncpg- ConstantPoolGen of class containing instruction- Returns:
- MethodDescriptor describing the called method
-
getAccessedFieldDescriptor
public static FieldDescriptor getAccessedFieldDescriptor(org.apache.bcel.generic.FieldInstruction fins, org.apache.bcel.generic.ConstantPoolGen cpg) Get FieldDescriptor describing the field accessed by given FieldInstruction.- Parameters:
fins- a FieldInstructioncpg- ConstantPoolGen for the method containing the FieldInstruction- Returns:
- FieldDescriptor describing the field accessed by given FieldInstruction
-
getClassDescriptor
Construct a ClassDescriptor from a JavaClass.- Parameters:
jclass- a JavaClass- Returns:
- a ClassDescriptor identifying that JavaClass
-
preTiger
public static boolean preTiger(org.apache.bcel.classfile.JavaClass jclass) Checks if classfile was compiled for pre 1.5 target -
getClassDescriptor
@Deprecated public static ClassDescriptor getClassDescriptor(org.apache.bcel.generic.ObjectType type) Deprecated.UseDescriptorFactory.getClassDescriptor(ObjectType)insteadGet a ClassDescriptor for the class described by given ObjectType object.- Parameters:
type- an ObjectType- Returns:
- a ClassDescriptor for the class described by the ObjectType
-
throwClassNotFoundException
@Deprecated public static void throwClassNotFoundException(ClassDescriptor classDescriptor) throws ClassNotFoundException Deprecated.Throw a ClassNotFoundException to indicate that class named by given ClassDescriptor cannot be found. The exception message is formatted in a way that can be decoded by ClassNotFoundExceptionParser.- Parameters:
classDescriptor- ClassDescriptor naming a class that cannot be found- Throws:
ClassNotFoundException- See Also:
-
getObjectTypeInstance
public static org.apache.bcel.generic.ObjectType getObjectTypeInstance(@DottedClassName String className) -
getObjectTypeInstance
-
isSynthetic
public static boolean isSynthetic(org.apache.bcel.classfile.FieldOrMethod m) -
isSynthetic
public static boolean isSynthetic(org.apache.bcel.classfile.JavaClass j) -
isSynthetic
public static boolean isSynthetic(org.apache.bcel.generic.FieldGenOrMethodGen m)
-
DescriptorFactory.getClassDescriptor(ObjectType)instead