FindBugs™ 1.3.4

edu.umd.cs.findbugs.bcel
Class BCELUtil

java.lang.Object
  extended by 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
BCELUtil()
           
 
Method Summary
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)
          Get a ClassDescriptor for the class described by given ObjectType object.
static MethodDescriptor getMethodDescriptor(org.apache.bcel.classfile.JavaClass jclass, org.apache.bcel.classfile.Method method)
          Construct a MethodDescriptor from JavaClass and method.
static boolean preTiger(org.apache.bcel.classfile.JavaClass jclass)
          Checks if classfile was compiled for pre 1.5 target
static void throwClassNotFoundException(ClassDescriptor classDescriptor)
          Throw a ClassNotFoundException to indicate that class named by given ClassDescriptor cannot be found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BCELUtil

public BCELUtil()
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 JavaClass
method - 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 InvokeInstruction
cpg - 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 FieldInstruction
cpg - 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

public static ClassDescriptor getClassDescriptor(org.apache.bcel.generic.ObjectType type)
Get 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

public static void throwClassNotFoundException(ClassDescriptor classDescriptor)
                                        throws java.lang.ClassNotFoundException
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

FindBugs™ 1.3.4

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.