Package edu.umd.cs.findbugs.bcel
Class BCELUtil
- java.lang.Object
-
- edu.umd.cs.findbugs.bcel.BCELUtil
-
public abstract class BCELUtil extends java.lang.Object
Utility methods for detectors and analyses using BCEL.- Author:
- David Hovemeyer
-
-
Constructor Summary
Constructors Constructor Description BCELUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FieldDescriptor
getAccessedFieldDescriptor(org.apache.bcel.generic.FieldInstruction fins, org.apache.bcel.generic.ConstantPoolGen cpg)
Get FieldDescriptor describing the field accessed by given FieldInstruction.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.static ClassDescriptor
getClassDescriptor(org.apache.bcel.classfile.JavaClass jclass)
Construct a ClassDescriptor from a JavaClass.static ClassDescriptor
getClassDescriptor(org.apache.bcel.generic.ObjectType type)
Deprecated.UseDescriptorFactory.getClassDescriptor(ObjectType)
insteadstatic MethodDescriptor
getMethodDescriptor(org.apache.bcel.classfile.JavaClass jclass, org.apache.bcel.classfile.Method method)
Construct a MethodDescriptor from JavaClass and method.static org.apache.bcel.generic.ObjectType
getObjectTypeInstance(java.lang.Class<?> clazz)
static org.apache.bcel.generic.ObjectType
getObjectTypeInstance(java.lang.String className)
static boolean
isSynthetic(org.apache.bcel.classfile.FieldOrMethod m)
static boolean
isSynthetic(org.apache.bcel.classfile.JavaClass j)
static boolean
isSynthetic(org.apache.bcel.generic.FieldGenOrMethodGen m)
static boolean
preTiger(org.apache.bcel.classfile.JavaClass jclass)
Checks if classfile was compiled for pre 1.5 targetstatic void
throwClassNotFoundException(ClassDescriptor classDescriptor)
Deprecated.
-
-
-
Method Detail
-
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
public static ClassDescriptor getClassDescriptor(org.apache.bcel.classfile.JavaClass jclass)
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 java.lang.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:
java.lang.ClassNotFoundException
- See Also:
ClassNotFoundExceptionParser
-
getObjectTypeInstance
public static org.apache.bcel.generic.ObjectType getObjectTypeInstance(@DottedClassName java.lang.String className)
-
getObjectTypeInstance
public static org.apache.bcel.generic.ObjectType getObjectTypeInstance(java.lang.Class<?> clazz)
-
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)
-
-