Class Type
java.lang.Object
org.gjt.sp.jedit.bsh.org.objectweb.asm.Type
A Java type. This class can be used to make it easier to manipulate type
and method descriptors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe sort of array reference types.static final intThe sort of the boolean type.static final TypeThe boolean type.static final intThe sort of the byte type.static final TypeThe byte type.static final intThe sort of the char type.static final TypeThe char type.static final intThe sort of the double type.static final TypeThe double type.static final intThe sort of the float type.static final TypeThe float type.static final intThe sort of the int type.static final TypeThe int type.static final intThe sort of the long type.static final TypeThe long type.static final intThe sort of object reference type.static final intThe sort of the short type.static final TypeThe short type.static final intThe sort of the void type.static final TypeThe void type. -
Method Summary
Modifier and TypeMethodDescriptionstatic Type[]getArgumentTypes(Method method) Returns the Java types corresponding to the argument types of the given method.static Type[]getArgumentTypes(String methodDescriptor) Returns the Java types corresponding to the argument types of the given method descriptor.Returns the name of the class corresponding to this object type.Returns the descriptor corresponding to this Java type.static StringReturns the descriptor corresponding to the given Java type.intReturns the number of dimensions of this array type.Returns the type of the elements of this array type.Returns the internal name of the class corresponding to this object type.static StringReturns the internal name of the given class.static StringReturns the descriptor corresponding to the given method.static StringgetMethodDescriptor(Type returnType, Type[] argumentTypes) Returns the descriptor corresponding to the given argument and return types.intgetOpcode(int opcode) Returns a JVM instruction opcode adapted to this Java type.static TypegetReturnType(Method method) Returns the Java type corresponding to the return type of the given method.static TypegetReturnType(String methodDescriptor) Returns the Java type corresponding to the return type of the given method descriptor.intgetSize()Returns the size of values of this type.intgetSort()Returns the sort of this Java type.static TypeReturns the Java type corresponding to the given class.static TypeReturns the Java type corresponding to the given type descriptor.
-
Field Details
-
VOID
-
BOOLEAN
-
CHAR
-
BYTE
-
SHORT
-
INT
-
FLOAT
-
LONG
-
DOUBLE
-
ARRAY
-
OBJECT
-
VOID_TYPE
The void type. -
BOOLEAN_TYPE
The boolean type. -
CHAR_TYPE
The char type. -
BYTE_TYPE
The byte type. -
SHORT_TYPE
The short type. -
INT_TYPE
The int type. -
FLOAT_TYPE
The float type. -
LONG_TYPE
The long type. -
DOUBLE_TYPE
The double type.
-
-
Method Details
-
getType
-
getType
-
getArgumentTypes
-
getArgumentTypes
-
getReturnType
-
getReturnType
-
getSort
-
getDimensions
public int getDimensions()Returns the number of dimensions of this array type. This method should only be used for an array type.- Returns:
- the number of dimensions of this array type.
-
getElementType
Returns the type of the elements of this array type. This method should only be used for an array type.- Returns:
- Returns the type of the elements of this array type.
-
getClassName
Returns the name of the class corresponding to this object type. This method should only be used for an object type.- Returns:
- the fully qualified name of the class corresponding to this object type.
-
getInternalName
Returns the internal name of the class corresponding to this object type. The internal name of a class is its fully qualified name, where '.' are replaced by '/'. * This method should only be used for an object type.- Returns:
- the internal name of the class corresponding to this object type.
-
getDescriptor
Returns the descriptor corresponding to this Java type.- Returns:
- the descriptor corresponding to this Java type.
-
getMethodDescriptor
Returns the descriptor corresponding to the given argument and return types.- Parameters:
returnType- the return type of the method.argumentTypes- the argument types of the method.- Returns:
- the descriptor corresponding to the given argument and return types.
-
getInternalName
-
getDescriptor
-
getMethodDescriptor
-
getSize
public int getSize()Returns the size of values of this type.- Returns:
- the size of values of this type, i.e., 2 for long and double, and 1 otherwise.
-
getOpcode
public int getOpcode(int opcode) Returns a JVM instruction opcode adapted to this Java type.- Parameters:
opcode- a JVM instruction opcode. This opcode must be one of ILOAD, ISTORE, IALOAD, IASTORE, IADD, ISUB, IMUL, IDIV, IREM, INEG, ISHL, ISHR, IUSHR, IAND, IOR, IXOR and IRETURN.- Returns:
- an opcode that is similar to the given opcode, but adapted to this Java type. For example, if this type is float and opcode is IRETURN, this method returns FRETURN.
-