FindBugs™ 1.3.9

edu.umd.cs.findbugs.ba
Class Hierarchy2

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.Hierarchy2

public class Hierarchy2
extends java.lang.Object

Facade for class hierarchy queries. These typically access the class hierarchy using the Repository class. Callers should generally expect to handle ClassNotFoundException for when referenced classes can't be found.

Author:
William Pugh

Constructor Summary
Hierarchy2()
           
 
Method Summary
static org.apache.bcel.generic.ObjectType[] findDeclaredExceptions(org.apache.bcel.generic.InvokeInstruction inv, org.apache.bcel.generic.ConstantPoolGen cpg)
          Find the declared exceptions for the method called by given instruction.
static XMethod findExactMethod(org.apache.bcel.generic.InvokeInstruction inv, org.apache.bcel.generic.ConstantPoolGen cpg, JavaClassAndMethodChooser chooser)
          Look up the method referenced by given InvokeInstruction.
static XMethod findInvocationLeastUpperBound(ClassDescriptor classDesc, java.lang.String methodName, java.lang.String methodSig, boolean invokeStatic, boolean invokeInterface)
           
static XMethod findInvocationLeastUpperBound(org.apache.bcel.generic.InvokeInstruction inv, org.apache.bcel.generic.ConstantPoolGen cpg, JavaClassAndMethodChooser methodChooser)
           
static XMethod findInvocationLeastUpperBound(XClass jClass, java.lang.String methodName, java.lang.String methodSig, boolean invokeStatic, boolean invokeInterface)
           
static XMethod findMethod(ClassDescriptor classDescriptor, java.lang.String methodName, java.lang.String methodSig, boolean isStatic)
           
static java.util.Set<XMethod> findSuperMethods(XMethod m)
           
static java.util.Set<XMethod> resolveMethodCallTargets(org.apache.bcel.generic.InvokeInstruction invokeInstruction, TypeFrame typeFrame, org.apache.bcel.generic.ConstantPoolGen cpg)
          Resolve possible method call targets.
static java.util.Set<XMethod> resolveMethodCallTargets(org.apache.bcel.generic.ReferenceType receiverType, org.apache.bcel.generic.InvokeInstruction invokeInstruction, org.apache.bcel.generic.ConstantPoolGen cpg)
          Resolve possible instance method call targets.
static java.util.Set<XMethod> resolveMethodCallTargets(org.apache.bcel.generic.ReferenceType receiverType, org.apache.bcel.generic.InvokeInstruction invokeInstruction, org.apache.bcel.generic.ConstantPoolGen cpg, boolean receiverTypeIsExact)
          Resolve possible instance method call targets.
static java.util.Set<XMethod> resolveVirtualMethodCallTargets(ClassDescriptor receiverDesc, java.lang.String methodName, java.lang.String methodSig, boolean receiverTypeIsExact, boolean invokeSpecial)
           
static java.util.Set<XMethod> resolveVirtualMethodCallTargets(java.lang.String receiverClassName, java.lang.String methodName, java.lang.String methodSig, boolean receiverTypeIsExact, boolean invokeSpecial)
           
static java.util.Set<XMethod> resolveVirtualMethodCallTargets(XMethod target, boolean receiverTypeIsExact, boolean invokeSpecial)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hierarchy2

public Hierarchy2()
Method Detail

findExactMethod

public static XMethod findExactMethod(org.apache.bcel.generic.InvokeInstruction inv,
                                      org.apache.bcel.generic.ConstantPoolGen cpg,
                                      JavaClassAndMethodChooser chooser)
                               throws java.lang.ClassNotFoundException
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
cpg - the ConstantPoolGen used by the class the InvokeInstruction belongs to
chooser - JavaClassAndMethodChooser to use to pick the method from among the candidates
Returns:
the JavaClassAndMethod, or null if no such method is defined in the class
Throws:
java.lang.ClassNotFoundException

findInvocationLeastUpperBound

@CheckForNull
public static XMethod findInvocationLeastUpperBound(org.apache.bcel.generic.InvokeInstruction inv,
                                                                 org.apache.bcel.generic.ConstantPoolGen cpg,
                                                                 JavaClassAndMethodChooser methodChooser)
                                             throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

findInvocationLeastUpperBound

@CheckForNull
public static XMethod findInvocationLeastUpperBound(ClassDescriptor classDesc,
                                                                 java.lang.String methodName,
                                                                 java.lang.String methodSig,
                                                                 boolean invokeStatic,
                                                                 boolean invokeInterface)

findInvocationLeastUpperBound

@CheckForNull
public static XMethod findInvocationLeastUpperBound(XClass jClass,
                                                                 java.lang.String methodName,
                                                                 java.lang.String methodSig,
                                                                 boolean invokeStatic,
                                                                 boolean invokeInterface)
                                             throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

findSuperMethods

public static java.util.Set<XMethod> findSuperMethods(XMethod m)

findMethod

@CheckForNull
public static XMethod findMethod(ClassDescriptor classDescriptor,
                                              java.lang.String methodName,
                                              java.lang.String methodSig,
                                              boolean isStatic)

resolveMethodCallTargets

@NonNull
public static java.util.Set<XMethod> resolveMethodCallTargets(org.apache.bcel.generic.InvokeInstruction invokeInstruction,
                                                                      TypeFrame typeFrame,
                                                                      org.apache.bcel.generic.ConstantPoolGen cpg)
                                                       throws DataflowAnalysisException,
                                                              java.lang.ClassNotFoundException
Resolve possible method call targets. This works for both static and instance method calls.

Parameters:
invokeInstruction - the InvokeInstruction
typeFrame - the TypeFrame containing the types of stack values
cpg - the ConstantPoolGen
Returns:
Set of methods which might be called
Throws:
DataflowAnalysisException
java.lang.ClassNotFoundException

resolveMethodCallTargets

public static java.util.Set<XMethod> resolveMethodCallTargets(org.apache.bcel.generic.ReferenceType receiverType,
                                                              org.apache.bcel.generic.InvokeInstruction invokeInstruction,
                                                              org.apache.bcel.generic.ConstantPoolGen cpg)
                                                       throws java.lang.ClassNotFoundException
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
invokeInstruction - the InvokeInstruction
cpg - the ConstantPoolGen
Returns:
Set of methods which might be called
Throws:
java.lang.ClassNotFoundException

resolveMethodCallTargets

public static java.util.Set<XMethod> resolveMethodCallTargets(org.apache.bcel.generic.ReferenceType receiverType,
                                                              org.apache.bcel.generic.InvokeInstruction invokeInstruction,
                                                              org.apache.bcel.generic.ConstantPoolGen cpg,
                                                              boolean receiverTypeIsExact)
                                                       throws java.lang.ClassNotFoundException
Resolve possible instance method call targets.

Parameters:
receiverType - type of the receiver object
invokeInstruction - the InvokeInstruction
cpg - the ConstantPoolGen
receiverTypeIsExact - if true, the receiver type is known exactly, which should allow a precise result
Returns:
Set of methods which might be called
Throws:
java.lang.ClassNotFoundException

resolveVirtualMethodCallTargets

public static java.util.Set<XMethod> resolveVirtualMethodCallTargets(java.lang.String receiverClassName,
                                                                     java.lang.String methodName,
                                                                     java.lang.String methodSig,
                                                                     boolean receiverTypeIsExact,
                                                                     boolean invokeSpecial)
                                                              throws java.lang.ClassNotFoundException
Parameters:
receiverClassName -
methodName -
methodSig -
receiverTypeIsExact -
invokeSpecial - TODO
Returns:
Throws:
java.lang.ClassNotFoundException

resolveVirtualMethodCallTargets

public static java.util.Set<XMethod> resolveVirtualMethodCallTargets(XMethod target,
                                                                     boolean receiverTypeIsExact,
                                                                     boolean invokeSpecial)
                                                              throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

resolveVirtualMethodCallTargets

public static java.util.Set<XMethod> resolveVirtualMethodCallTargets(ClassDescriptor receiverDesc,
                                                                     java.lang.String methodName,
                                                                     java.lang.String methodSig,
                                                                     boolean receiverTypeIsExact,
                                                                     boolean invokeSpecial)
                                                              throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

findDeclaredExceptions

@CheckForNull
public static org.apache.bcel.generic.ObjectType[] findDeclaredExceptions(org.apache.bcel.generic.InvokeInstruction inv,
                                                                                       org.apache.bcel.generic.ConstantPoolGen cpg)
                                                                   throws java.lang.ClassNotFoundException
Find the declared exceptions for the method called by given instruction.

Parameters:
inv - the InvokeInstruction
cpg - the ConstantPoolGen used by the class the InvokeInstruction belongs to
Returns:
array of ObjectTypes of thrown exceptions, or null if we can't find the method implementation
Throws:
java.lang.ClassNotFoundException

FindBugs™ 1.3.9

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