"

2013 FRC Java API

"

com.sun.squawk
Class Method

java.lang.Object
  extended by com.sun.squawk.Member
      extended by com.sun.squawk.Method

public final class Method
extends Member

An instance of Method encapsulates the information about the method of a class. This includes the name of the method, its return type, parameter types, access flags etc.


Method Summary
 boolean equals(Object other)
          Indicates whether some other object is "equal to" this one.
static int getLineNumber(int[] lnt, int bci)
          Gets the line number for a bytecode index
 int[] getLineNumberTable()
          Gets the table mapping instruction addresses to the source line numbers that start at the addresses.
 ScopedLocalVariable[] getLocalVariableTable()
          Gets a table describing the scope, name and type of each local variable in the method.
 int getParameterCount()
          Returns the number of parameters for this method.
 int getParametersSize()
          Return the number of words used as parameters to this method.
 Klass[] getParameterTypes()
          Gets the formal parameter types, in declaration order, of this method.
 Klass getReturnType()
          Gets the formal return type of this method.
 Klass[] getRuntimeParameterTypes(boolean reverseParameters)
          Gets the runtime parameter types, in declaration order, of this method.
 int hashCode()
          Gets the hash code.
 void invoke(Object[] args)
          DO NOT USE
 boolean isAbstract()
          Determines if this method is an abstract method.
 boolean isAllowInlined()
          Returns whether this method is allowed to be inlined in extra circumstances by the translator.
 boolean isClassInitializer()
          Determines if this method is a class initialization method
 boolean isConstructor()
          Determines if this method is a constructor.
 boolean isDefaultConstructor()
          Determines if this method is a constructor.
 boolean isForceInlined()
          Returns whether this method is forceably inlined by the translator.
 boolean isHosted()
          Returns whether this method should only be called in a hosted environment.
 boolean isInterpreterInvoked()
          Returns whether this method is only invoked from the interpreter, and never from Java code.
 boolean isNative()
          Determines if this method is a native method.
 boolean isNativeDueToPragma()
          Returns whether this native method is only native due to a pragma.
 boolean isNotInlined()
          Returns whether this method is never inlined by the translator.
 boolean isReplacementConstructor()
          Returns whether the body of this method is used to replace the body of a constructor with the same signature.
 boolean isSynchronized()
          Determines if this method is a synchronized method.
static String lineNumberTableAsString(int[] lnt)
          Converts a given line number table as a string of numbers where each pair of numbers represents an ip address and a line number.
 boolean requiresClassClinit()
          Tests to see if this method requires a CLASS_CLINIT instruction to be emitted before the body of the method's bytecodes.
 
Methods inherited from class com.sun.squawk.Member
getDefiningClass, getFullyQualifiedName, getModifiers, getName, getOffset, isAccessibleFrom, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isSourceSynthetic, isStatic, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()
Description copied from class: Member
Gets the hash code.

Overrides:
hashCode in class Member
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

equals

public boolean equals(Object other)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class Object
Parameters:
other - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Boolean.hashCode(), Hashtable

isHosted

public boolean isHosted()
Returns whether this method should only be called in a hosted environment.


isReplacementConstructor

public boolean isReplacementConstructor()
Returns whether the body of this method is used to replace the body of a constructor with the same signature.


isInterpreterInvoked

public boolean isInterpreterInvoked()
Returns whether this method is only invoked from the interpreter, and never from Java code.


isForceInlined

public boolean isForceInlined()
Returns whether this method is forceably inlined by the translator.


isAllowInlined

public boolean isAllowInlined()
Returns whether this method is allowed to be inlined in extra circumstances by the translator.


isNotInlined

public boolean isNotInlined()
Returns whether this method is never inlined by the translator.


isNativeDueToPragma

public boolean isNativeDueToPragma()
Returns whether this native method is only native due to a pragma.


isNative

public boolean isNative()
Determines if this method is a native method.

Returns:
true if this method is a native method

isAbstract

public boolean isAbstract()
Determines if this method is an abstract method.

Returns:
true if this method is an abstract method

isSynchronized

public boolean isSynchronized()
Determines if this method is a synchronized method.

Returns:
true if this method is a synchronized method

isConstructor

public boolean isConstructor()
Determines if this method is a constructor.

Returns:
true if this method is a constructor

isDefaultConstructor

public boolean isDefaultConstructor()
Determines if this method is a constructor.

Returns:
true if this method is a constructor

isClassInitializer

public boolean isClassInitializer()
Determines if this method is a class initialization method

Returns:
true if this method is a class initialization method

getReturnType

public Klass getReturnType()
Gets the formal return type of this method.

Returns:
the formal return type of this method

getParameterTypes

public Klass[] getParameterTypes()
Gets the formal parameter types, in declaration order, of this method. Returns an array of length 0 if this method takes no parameters.

Returns:
the formal parameter types of this method

getParameterCount

public int getParameterCount()
Returns the number of parameters for this method.

Returns:
the number of parameters for this method.

requiresClassClinit

public boolean requiresClassClinit()
Tests to see if this method requires a CLASS_CLINIT instruction to be emitted before the body of the method's bytecodes.

Returns:
true if it is

getParametersSize

public int getParametersSize()
Return the number of words used as parameters to this method. Includes any implicit "this" parameter.


getRuntimeParameterTypes

public Klass[] getRuntimeParameterTypes(boolean reverseParameters)
Gets the runtime parameter types, in declaration order, of this method. Returns an array of length 0 if this method takes no parameters.

Parameters:
reverseParameters - true if the parameters are normally pushed right-to-left
Returns:
the formal parameter types of this method

getLineNumberTable

public int[] getLineNumberTable()
Gets the table mapping instruction addresses to the source line numbers that start at the addresses. The table is encoded as an int array where the high 16-bits of each element is an instruction address and the low 16-bits is the corresponding source line.

Returns:
the line number table or null if there is no line number information for the method

getLocalVariableTable

public ScopedLocalVariable[] getLocalVariableTable()
Gets a table describing the scope, name and type of each local variable in the method.

Returns:
the local variable table or null if there is no local variable information for the method

lineNumberTableAsString

public static String lineNumberTableAsString(int[] lnt)
Converts a given line number table as a string of numbers where each pair of numbers represents an ip address and a line number.

Parameters:
lnt - the table mapping instruction addresses to the source line numbers that start at the addresses. The table is encoded as an int array where the high 16-bits of each element is an instruction address and the low 16-bits is the corresponding source line
Returns:
the line number table as a string

getLineNumber

public static int getLineNumber(int[] lnt,
                                int bci)
Gets the line number for a bytecode index

Parameters:
lnt - the table mapping bytecode indexes to the source line numbers that start at the addresses. The table is encoded as an int array where the high 16-bits of each element is an instruction address and the low 16-bits is the corresponding source line
bci - a bytecode index
Returns:
the line number or -1 if it could not be found

invoke

public final void invoke(Object[] args)
DO NOT USE


"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"