Enum Class TypeKind
- All Implemented Interfaces:
Serializable,Comparable<TypeKind>,Constable
Describes the data types Java Virtual Machine operates on. This omits
returnAddress (JVMS2.3.3) and includesvoid (JVMS4.3.3), which appears as a method return type.ThereturnAddress type is only used by discontinuedjump subroutine andreturn from subroutineinstructions. Jump subroutine instructions pushreturnAddress to theoperand stack;astore instructions storereturnAddress from the operand stack to local variables; return fromsubroutine instructions loadreturnAddress from local variables.
Computational Type
In theclass file format, local variables (JVMS2.6.1),and the operand stack (JVMS2.6.2) of the Java Virtual Machine,boolean,byte,char,short types do not exist and arerepresented by theint computational type.int,float,reference,returnAddress,long, anddouleare the computational types of the Java Virtual Machine.- SeeJava Virtual Machine Specification:
- 2.2 Data Types
2.11.1 Types and the Java Virtual Machine - Since:
- 24
Nested Class Summary
Nested classes/interfaces declared in class Enum
Enum.EnumDesc<E>Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe primitive typeboolean.The primitive typebyte.The primitive typechar.The primitive typedouble.The primitive typefloat.The primitive typeint.The primitive typelong.A reference type.The primitive typeshort.Thevoidtype, for absence of a value.Method Summary
Modifier and TypeMethodDescriptionstaticTypeKindfrom(TypeDescriptor.OfField<?> descriptor) Returns the type associated with the specified field descriptor.staticTypeKindReturns the type associated with the specified field descriptor.staticTypeKindfromNewarrayCode(int newarrayCode) Returns the component type described by the array code used as an operand tonewarray.intReturns the code used by thenewarrayinstruction to create an arrayof this component type, or-1if this type is not supported bynewarray.intslotSize()Returns the number of local variable index or operand stack depth consumed by this type.Returns the most specific upper bound field descriptor that can store any valueof this type.staticTypeKindReturns the enum constant of this class with the specified name.staticTypeKind[]values()Returns an array containing the constants of this enum class, inthe order they are declared.
Enum Constant Details
BOOLEAN
The primitive typeboolean. Itscomputational type isint.0representsfalse,and1representstrue. It is zero-extended to anintwhen loaded onto the operand stack and narrowed by taking the bitwise ANDwith1when stored.- SeeJava Virtual Machine Specification:
- 2.3.4 The
booleanType
BYTE
The primitive typebyte. Itscomputational type isint. It is sign-extended to anintwhen loaded onto the operand stack and truncated whenstored.CHAR
The primitive typechar. Itscomputational type isint. It is zero-extended to anintwhen loaded onto the operand stack and truncated whenstored.SHORT
The primitive typeshort. Itscomputational type isint. It is sign-extended to anintwhen loaded onto the operand stack and truncated whenstored.INT
The primitive typeint.LONG
FLOAT
The primitive typefloat. All NaN values offloatmay ormay not be collapsed into a single"canonical" NaNvalue in loading and storing.DOUBLE
The primitive typedouble. It is ofcategory 2. All NaN values ofdoublemay or may not becollapsed into a single"canonical" NaN valuein loading and storing.REFERENCE
A reference type.- SeeJava Virtual Machine Specification:
- 2.4 Reference Types and Values
VOID
Thevoidtype, for absence of a value. While this is not a data type,this can be a method return type indicating no change inoperand stack depth.- SeeJava Virtual Machine Specification:
- 4.3.3 Method Descriptors
Method Details
values
Returns an array containing the constants of this enum class, inthe order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
valueOf
Returns the enum constant of this class with the specified name.The string must matchexactly an identifier used to declare anenum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
upperBound
newarrayCode
public int newarrayCode()Returns the code used by thenewarrayinstruction to create an arrayof this component type, or-1if this type is not supported bynewarray.- Returns:
- the code used by the
newarrayinstruction to create an arrayof this component type, or-1if this type is not supported bynewarray - SeeJava Virtual Machine Specification:
- 6.5.newarraynewarray
- See Also:
slotSize
public int slotSize()Returns the number of local variable index or operand stack depth consumed by this type.This is also the category of this type for instructions operating on the operand stack withoutregard to type (JVMS2.11.1), such aspopversuspop2.- Returns:
- the number of local variable index or operand stack depth consumed by this type
- SeeJava Virtual Machine Specification:
- 2.6.1 Local Variables
2.6.2 Operand Stacks
asLoadable
- Returns:
- thecomputational type for this type, or
voidforvoid - See Also:
fromNewarrayCode
Returns the component type described by the array code used as an operand tonewarray.- Parameters:
newarrayCode- the operand of thenewarrayinstruction- Returns:
- the component type described by the array code used as an operand to
newarray - Throws:
IllegalArgumentException- if the code is invalid- SeeJava Virtual Machine Specification:
- 6.5.newarraynewarray
- See Also:
fromDescriptor
Returns the type associated with the specified field descriptor.- Parameters:
s- the field descriptor- Returns:
- the type associated with the specified field descriptor
- Throws:
IllegalArgumentException- only if the descriptor is not valid
from
Returns the type associated with the specified field descriptor.- Parameters:
descriptor- the field descriptor- Returns:
- the type associated with the specified field descriptor