org.eclipse.jdt.internal.compiler.classfmt
Class MethodInfo

java.lang.Object
  extended by org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct
      extended by org.eclipse.jdt.internal.compiler.classfmt.MethodInfo
All Implemented Interfaces:
Comparable, IBinaryMethod, IGenericMethod
Direct Known Subclasses:
AnnotationMethodInfo, MethodInfoWithAnnotations

public class MethodInfo
extends ClassFileStruct
implements IBinaryMethod, Comparable


Field Summary
protected  int accessFlags
           
protected  char[][] argumentNames
           
protected  int argumentNamesIndex
           
protected  int attributeBytes
           
protected  char[] descriptor
           
protected  char[][] exceptionNames
           
protected  char[] name
           
protected  char[] signature
           
protected  int signatureUtf8Offset
           
protected  long tagBits
           
 
Constructor Summary
protected MethodInfo(byte[] classFileBytes, int[] offsets, int offset)
           
 
Method Summary
 int compareTo(Object o)
           
static MethodInfo createMethod(byte[] classFileBytes, int[] offsets, int offset)
           
 boolean equals(Object o)
           
 IBinaryAnnotation[] getAnnotations()
          Answer the runtime visible and invisible annotations for this method or null if none.
 char[][] getArgumentNames()
          Answer the names of the argument or null if the argument names are not available.
 Object getDefaultValue()
          Return ClassSignature for a Class Class.
 char[][] getExceptionTypeNames()
          Answer the resolved names of the exception types in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the array is empty.
 char[] getGenericSignature()
          Answer the receiver's signature which describes the parameter & return types as specified in section 4.4.4 of the Java 2 VM spec.
 char[] getMethodDescriptor()
          Answer the receiver's method descriptor which describes the parameter & return types as specified in section 4.3.3 of the Java 2 VM spec.
 int getModifiers()
          Answer an int whose bits are set according the access constants defined by the VM spec.
 IBinaryAnnotation[] getParameterAnnotations(int index)
          Answer the annotations on the indexth parameter or null if none
 char[] getSelector()
          Answer the name of the method.
 long getTagBits()
          Answer the tagbits set according to the bits for annotations.
 int hashCode()
           
protected  void initialize()
          This method is used to fully initialize the contents of the receiver.
 boolean isClinit()
          Answer true if the method is a class initializer, false otherwise.
 boolean isConstructor()
          Answer true if the method is a constructor, false otherwise.
 boolean isSynthetic()
          Return true if the field is a synthetic method, false otherwise.
 int sizeInBytes()
          Answer the size of the receiver in bytes.
 String toString()
           
protected  void toStringContent(StringBuffer buffer)
           
 
Methods inherited from class org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct
doubleAt, floatAt, i4At, i8At, reset, u1At, u2At, u4At, utf8At
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

accessFlags

protected int accessFlags

attributeBytes

protected int attributeBytes

descriptor

protected char[] descriptor

exceptionNames

protected char[][] exceptionNames

name

protected char[] name

signature

protected char[] signature

signatureUtf8Offset

protected int signatureUtf8Offset

tagBits

protected long tagBits

argumentNames

protected char[][] argumentNames

argumentNamesIndex

protected int argumentNamesIndex
Constructor Detail

MethodInfo

protected MethodInfo(byte[] classFileBytes,
                     int[] offsets,
                     int offset)
Parameters:
classFileBytes - byte[]
offsets - int[]
offset - int
Method Detail

createMethod

public static MethodInfo createMethod(byte[] classFileBytes,
                                      int[] offsets,
                                      int offset)

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getAnnotations

public IBinaryAnnotation[] getAnnotations()
Description copied from interface: IBinaryMethod
Answer the runtime visible and invisible annotations for this method or null if none.

Specified by:
getAnnotations in interface IBinaryMethod
Returns:
the annotations or null if there is none.

getArgumentNames

public char[][] getArgumentNames()
Description copied from interface: IGenericMethod
Answer the names of the argument or null if the argument names are not available.

Specified by:
getArgumentNames in interface IGenericMethod
See Also:
IGenericMethod.getArgumentNames()

getDefaultValue

public Object getDefaultValue()
Description copied from interface: IBinaryMethod
Return ClassSignature for a Class Class. Return Constant for compile-time constant of primitive type, as well as String literals. Return EnumConstantSignature if value is an enum constant. Return IBinaryAnnotation for annotation type. Return Object[] for array type.

Specified by:
getDefaultValue in interface IBinaryMethod
Returns:
default value of this annotation method

getExceptionTypeNames

public char[][] getExceptionTypeNames()
Answer the resolved names of the exception types in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the array is empty. For example, java.lang.String is java/lang/String.

Specified by:
getExceptionTypeNames in interface IBinaryMethod
Returns:
char[][]

getGenericSignature

public char[] getGenericSignature()
Description copied from interface: IBinaryMethod
Answer the receiver's signature which describes the parameter & return types as specified in section 4.4.4 of the Java 2 VM spec.

Specified by:
getGenericSignature in interface IBinaryMethod

getMethodDescriptor

public char[] getMethodDescriptor()
Answer the receiver's method descriptor which describes the parameter & return types as specified in section 4.3.3 of the Java 2 VM spec. For example: - int foo(String) is (Ljava/lang/String;)I - void foo(Object[]) is (I)[Ljava/lang/Object;

Specified by:
getMethodDescriptor in interface IBinaryMethod
Returns:
char[]

getModifiers

public int getModifiers()
Answer an int whose bits are set according the access constants defined by the VM spec. Set the AccDeprecated and AccSynthetic bits if necessary

Specified by:
getModifiers in interface IGenericMethod
Returns:
int

getParameterAnnotations

public IBinaryAnnotation[] getParameterAnnotations(int index)
Description copied from interface: IBinaryMethod
Answer the annotations on the indexth parameter or null if none

Specified by:
getParameterAnnotations in interface IBinaryMethod
Parameters:
index - the index of the parameter of interest

getSelector

public char[] getSelector()
Answer the name of the method. For a constructor, answer & for a clinit method.

Specified by:
getSelector in interface IBinaryMethod
Returns:
char[]

getTagBits

public long getTagBits()
Description copied from interface: IBinaryMethod
Answer the tagbits set according to the bits for annotations.

Specified by:
getTagBits in interface IBinaryMethod

initialize

protected void initialize()
This method is used to fully initialize the contents of the receiver. All methodinfos, fields infos will be therefore fully initialized and we can get rid of the bytes.


isClinit

public boolean isClinit()
Answer true if the method is a class initializer, false otherwise.

Specified by:
isClinit in interface IBinaryMethod
Returns:
boolean

isConstructor

public boolean isConstructor()
Answer true if the method is a constructor, false otherwise.

Specified by:
isConstructor in interface IGenericMethod
Returns:
boolean

isSynthetic

public boolean isSynthetic()
Return true if the field is a synthetic method, false otherwise.

Returns:
boolean

sizeInBytes

public int sizeInBytes()
Answer the size of the receiver in bytes.

Returns:
int

toString

public String toString()
Overrides:
toString in class Object

toStringContent

protected void toStringContent(StringBuffer buffer)


Copyright © 2012. All Rights Reserved.