FindBugs™ 1.3.9

edu.umd.cs.findbugs.ba
Class SignatureParser

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

public class SignatureParser
extends java.lang.Object

A simple class to parse method signatures.

Author:
David Hovemeyer

Constructor Summary
SignatureParser(java.lang.String signature)
          Constructor.
 
Method Summary
 int getNumParameters()
          Get the number of parameters in the signature.
static int getNumParametersForInvocation(org.apache.bcel.generic.InvokeInstruction inv, org.apache.bcel.generic.ConstantPoolGen cpg)
          Get the number of parameters passed to method invocation.
static int getNumSlotsForType(java.lang.String sig)
          Return how many stack frame slots a type whose signature is given will occupy.
 java.lang.String getParameter(int pos)
           
 java.lang.String getReturnTypeSignature()
          Get the method return type signature.
 int getSlotsFromTopOfStackForParameter(int paramNum)
           
 boolean hasReferenceParameters()
           
static boolean isReferenceType(java.lang.String signature)
          Determine whether or not given signature denotes a reference type.
static void main(java.lang.String[] args)
           
 java.util.Iterator<java.lang.String> parameterSignatureIterator()
          Get an Iterator over signatures of the method parameters.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SignatureParser

public SignatureParser(java.lang.String signature)
Constructor.

Parameters:
signature - the method signature to be parsed
Method Detail

getSlotsFromTopOfStackForParameter

public int getSlotsFromTopOfStackForParameter(int paramNum)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

parameterSignatureIterator

public java.util.Iterator<java.lang.String> parameterSignatureIterator()
Get an Iterator over signatures of the method parameters.

Returns:
Iterator which returns the parameter type signatures in order

getReturnTypeSignature

public java.lang.String getReturnTypeSignature()
Get the method return type signature.

Returns:
the method return type signature

getNumParameters

public int getNumParameters()
Get the number of parameters in the signature.

Returns:
the number of parameters

hasReferenceParameters

public boolean hasReferenceParameters()

getParameter

public java.lang.String getParameter(int pos)

isReferenceType

public static boolean isReferenceType(java.lang.String signature)
Determine whether or not given signature denotes a reference type.

Parameters:
signature - a signature
Returns:
true if signature denotes a reference type, false otherwise

getNumParametersForInvocation

public static int getNumParametersForInvocation(org.apache.bcel.generic.InvokeInstruction inv,
                                                org.apache.bcel.generic.ConstantPoolGen cpg)
Get the number of parameters passed to method invocation.

Parameters:
inv -
cpg -
Returns:
int number of parameters

getNumSlotsForType

public static int getNumSlotsForType(java.lang.String sig)
Return how many stack frame slots a type whose signature is given will occupy. long and double values take 2 slots, while all other kinds of values take 1 slot.

Parameters:
sig - a type signature
Returns:
number of stack frame slots a value of the given type will occupy

main

public static void main(java.lang.String[] args)

FindBugs™ 1.3.9

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