APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.generic

public abstract Class Type

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.bcel.internal.generic.BasicType, com.sun.org.apache.bcel.internal.generic.ReferenceType, com.sun.org.apache.bcel.internal.generic.ReturnaddressType
Imports
java.util.ArrayList, .Arrays, .List, .Objects, com.sun.org.apache.bcel.internal.Const, com.sun.org.apache.bcel.internal.classfile.ClassFormatException, .InvalidMethodSignatureException, .Utility, jdk.xml.internal.Utils

Abstract super class for all possible Java types, namely basic types such as int, object types like String and array types, e.g. int[]

Field Summary

Modifier and TypeField and Description
public static final BasicType
public static final BasicType
public static final BasicType
public static final ObjectType
private static final ThreadLocal<Integer>
public static final BasicType
public static final BasicType
public static final BasicType
public static final BasicType
public static final Type[]
NO_ARGS

Empty array.

public static final ReferenceType
public static final ObjectType
public static final BasicType
protected String
signature

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
public static final ObjectType
public static final ObjectType
public static final ObjectType
protected byte
type

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
public static final Type
public static final BasicType
VOID

Predefined constants

Constructor Summary

AccessConstructor and Description
protected
Type(final byte type, final String signature)

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
consumed(final int coded)

pack-priv static int
encode(final int size, final int consumed)

public boolean

Returns:

whether the Types are equal
equals
(final Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static Type[]

Returns:

array of argument types
getArgumentTypes
(final String
signature string such as (Ljava/lang/String;)V
signature
)

Convert arguments of a method (signature) to an array of Type objects.

pack-priv static int
getArgumentTypesSize(final String signature)

public String
public static String

Returns:

method signature for given type(s).
getMethodSignature
(final Type
what the method returns
returnType
,
final Type[]
what are the argument types
argTypes
)

Convert type to Java method signature, e.g. int[] f(java.lang.String x) becomes (Ljava/lang/String;)[I

public static Type

Returns:

return type
getReturnType
(final String
signature string such as (Ljava/lang/String;)V
signature
)

Convert return value of a method (signature) to a Type object.

pack-priv static int
getReturnTypeSize(final String signature)

public static String
getSignature(final Method meth)

public String
getSignature()

Returns: signature for given type.

public int
getSize()

Returns: stack size of this type (2 for long and double, 0 for void, 1 otherwise)

public static Type

Returns:

corresponding Type object
getType
(final Class<?>
Java class
cls
)

Convert runtime Class to BCEL Type object.

public static Type

Returns:

type object
getType
(final String
signature string such as Ljava/lang/String;
signature
)

Convert signature to a Type object.

public byte
getType()

Returns: type as defined in Constants

public static Type[]

Returns:

array of corresponding Type objects
getTypes
(final Class<?>[]
an array of runtime class objects
classes
)

Convert runtime java.lang.Class[] to BCEL Type objects.

pack-priv static int
getTypeSize(final String signature)

public int

Returns:

hash code of Type
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv static String
internalTypeNameToSignature(final String internalTypeName)

public Type
normalizeForStackOrLocal()

boolean, short and char variable are considered as int in the stack or local variable area.

pack-priv static int
size(final int coded)

public String

Returns:

Type string, e.g. 'int[]'
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private static int
private static void
wrap(final ThreadLocal<Integer> tl, final int value)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

BOOLEANback to summary
public static final BasicType BOOLEAN
BYTEback to summary
public static final BasicType BYTE
CHARback to summary
public static final BasicType CHAR
CLASSback to summary
public static final ObjectType CLASS
CONSUMED_CHARSback to summary
private static final ThreadLocal<Integer> CONSUMED_CHARS
DOUBLEback to summary
public static final BasicType DOUBLE
FLOATback to summary
public static final BasicType FLOAT
INTback to summary
public static final BasicType INT
LONGback to summary
public static final BasicType LONG
NO_ARGSback to summary
public static final Type[] NO_ARGS

Empty array.

NULLback to summary
public static final ReferenceType NULL
OBJECTback to summary
public static final ObjectType OBJECT
SHORTback to summary
public static final BasicType SHORT
signatureback to summary
protected String signature

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
STRINGback to summary
public static final ObjectType STRING
STRINGBUFFERback to summary
public static final ObjectType STRINGBUFFER
THROWABLEback to summary
public static final ObjectType THROWABLE
typeback to summary
protected byte type

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
UNKNOWNback to summary
public static final Type UNKNOWN
VOIDback to summary
public static final BasicType VOID

Predefined constants

Constructor Detail

Typeback to summary
protected Type(final byte type, final String signature)

Method Detail

consumedback to summary
pack-priv static int consumed(final int coded)
encodeback to summary
pack-priv static int encode(final int size, final int consumed)
equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Returns:boolean

whether the Types are equal

Annotations
@Override
getArgumentTypesback to summary
public static Type[] getArgumentTypes(final String signature)

Convert arguments of a method (signature) to an array of Type objects.

Parameters
signature:String

signature string such as (Ljava/lang/String;)V

Returns:Type[]

array of argument types

getArgumentTypesSizeback to summary
pack-priv static int getArgumentTypesSize(final String signature)
getClassNameback to summary
public String getClassName()
getMethodSignatureback to summary
public static String getMethodSignature(final Type returnType, final Type[] argTypes)

Convert type to Java method signature, e.g. int[] f(java.lang.String x) becomes (Ljava/lang/String;)[I

Parameters
returnType:Type

what the method returns

argTypes:Type[]

what are the argument types

Returns:String

method signature for given type(s).

getReturnTypeback to summary
public static Type getReturnType(final String signature)

Convert return value of a method (signature) to a Type object.

Parameters
signature:String

signature string such as (Ljava/lang/String;)V

Returns:Type

return type

getReturnTypeSizeback to summary
pack-priv static int getReturnTypeSize(final String signature)
getSignatureback to summary
public static String getSignature(final Method meth)
getSignatureback to summary
public String getSignature()
Returns:String

signature for given type.

getSizeback to summary
public int getSize()
Returns:int

stack size of this type (2 for long and double, 0 for void, 1 otherwise)

getTypeback to summary
public static Type getType(final Class<?> cls)

Convert runtime Class to BCEL Type object.

Parameters
cls:Class<?>

Java class

Returns:Type

corresponding Type object

getTypeback to summary
public static Type getType(final String signature) throws StringIndexOutOfBoundsException

Convert signature to a Type object.

Parameters
signature:String

signature string such as Ljava/lang/String;

Returns:Type

type object

getTypeback to summary
public byte getType()
Returns:byte

type as defined in Constants

getTypesback to summary
public static Type[] getTypes(final Class<?>[] classes)

Convert runtime java.lang.Class[] to BCEL Type objects.

Parameters
classes:Class<?>[]

an array of runtime class objects

Returns:Type[]

array of corresponding Type objects

getTypeSizeback to summary
pack-priv static int getTypeSize(final String signature) throws StringIndexOutOfBoundsException
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

hash code of Type

Annotations
@Override
internalTypeNameToSignatureback to summary
pack-priv static String internalTypeNameToSignature(final String internalTypeName)
normalizeForStackOrLocalback to summary
public Type normalizeForStackOrLocal()

boolean, short and char variable are considered as int in the stack or local variable area. Returns INT for BOOLEAN, SHORT or CHAR, otherwise returns the given type.

Since
6.0
sizeback to summary
pack-priv static int size(final int coded)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

Type string, e.g. 'int[]'

Annotations
@Override
unwrapback to summary
private static int unwrap(final ThreadLocal<Integer> tl)
wrapback to summary
private static void wrap(final ThreadLocal<Integer> tl, final int value)