Enum Class TypeKind
- All Implemented Interfaces:
Serializable, Comparable<TypeKind>, Constable
public enum TypeKind extends Enum<TypeKind>
returnAddress (JVMS §2.3.3) and includes void (JVMS §4.3.3), which appears as a method return type. The returnAddress type is only used by discontinued jump subroutine and return from subroutine instructions. Jump subroutine instructions push returnAddress to the operand stack; astore instructions store
returnAddress from the operand stack to local variables; return from subroutine instructions load returnAddress from local variables.
Computational Type
In theclass file format, local variables (JVMS §2.6.1), and the operand stack (JVMS §2.6.2) of the Java Virtual Machine, boolean, byte, char, short types do not exist and are represented by the int computational type. int, float, reference, returnAddress, long, and doule are the computational types of the Java Virtual Machine.- See Java 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> | Modifier and Type | Class | Description |
|---|---|---|
static final class |
Enum.EnumDesc<E extends Enum<E>> |
A nominal descriptor for an enum constant. |
Enum Constant Summary
| Enum Constant | Description |
|---|---|
BOOLEAN |
The primitive type boolean. |
BYTE |
The primitive type byte. |
CHAR |
The primitive type char. |
DOUBLE |
The primitive type double. |
FLOAT |
The primitive type float. |
INT |
The primitive type int. |
LONG |
The primitive type long. |
REFERENCE |
A reference type. |
SHORT |
The primitive type short. |
VOID |
The void type, for absence of a value. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
TypeKind |
asLoadable() |
|
static TypeKind |
from |
Returns the type associated with the specified field descriptor. |
static TypeKind |
fromDescriptor |
Returns the type associated with the specified field descriptor. |
static TypeKind |
fromNewarrayCode |
Returns the component type described by the array code used as an operand to newarray. |
int |
newarrayCode() |
Returns the code used by the newarray instruction to create an array of this component type, or -1 if this type is not supported by newarray. |
int |
slotSize() |
Returns the number of local variable index or operand stack depth consumed by this type. |
ClassDesc |
upperBound() |
Returns the most specific upper bound field descriptor that can store any value of this type. |
static TypeKind |
valueOf |
Returns the enum constant of this class with the specified name. |
static TypeKind[] |
values() |
Returns an array containing the constants of this enum class, in the order they are declared. |
Methods declared in class Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf | Modifier and Type | Method | Description |
|---|---|---|
protected final Object |
clone() |
Throws CloneNotSupportedException. |
final int |
compareTo |
Compares this enum with the specified object for order. |
final Optional |
describeConstable() |
Returns an enum descriptor EnumDesc for this instance, if one can be constructed, or an empty Optional if one cannot be. |
final boolean |
equals |
Returns true if the specified object is equal to this enum constant. |
protected final void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization has been deprecated for removal. |
final Class |
getDeclaringClass() |
Returns the Class object corresponding to this enum constant's enum type. |
final int |
hashCode() |
Returns a hash code for this enum constant. |
final String |
name() |
Returns the name of this enum constant, exactly as declared in its enum declaration. |
final int |
ordinal() |
Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero). |
String |
toString() |
Returns the name of this enum constant, as contained in the declaration. |
static <T extends Enum<T>> |
valueOf |
Returns the enum constant of the specified enum class with the specified name. |
Methods declared in class Object
getClass, notify, notifyAll, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
final Class |
getClass() |
Returns the runtime class of this Object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Enum Constant Details
BOOLEAN
public static final TypeKind BOOLEAN
boolean. Its computational type is int. 0 represents false, and 1 represents true. It is zero-extended to an int when loaded onto the operand stack and narrowed by taking the bitwise AND with 1 when stored.- See Java Virtual Machine Specification:
- 2.3.4 The
booleanType
BYTE
public static final TypeKind BYTE
byte. Its computational type is int. It is sign-extended to an int when loaded onto the operand stack and truncated when stored.CHAR
public static final TypeKind CHAR
char. Its computational type is int. It is zero-extended to an int when loaded onto the operand stack and truncated when stored.SHORT
public static final TypeKind SHORT
short. Its computational type is int. It is sign-extended to an int when loaded onto the operand stack and truncated when stored.INT
public static final TypeKind INT
int.LONG
public static final TypeKind LONG
long. It is of category 2.FLOAT
public static final TypeKind FLOAT
float. All NaN values of float may or may not be collapsed into a single "canonical" NaN value in loading and storing.DOUBLE
public static final TypeKind DOUBLE
double. It is of category 2. All NaN values of double may or may not be collapsed into a single "canonical" NaN value in loading and storing.REFERENCE
public static final TypeKind REFERENCE
- See Java Virtual Machine Specification:
- 2.4 Reference Types and Values
VOID
public static final TypeKind VOID
void type, for absence of a value. While this is not a data type, this can be a method return type indicating no change in operand stack depth.- See Java Virtual Machine Specification:
- 4.3.3 Method Descriptors
Method Details
values
public static TypeKind[] values()
- Returns:
- an array containing the constants of this enum class, in the order they are declared
valueOf
public static TypeKind valueOf(String name)
- 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 name -
NullPointerException- if the argument is null
upperBound
public ClassDesc upperBound()
void and Object descriptor for reference.- Returns:
- the most specific upper bound field descriptor that can store any value of this type
newarrayCode
public int newarrayCode()
newarray instruction to create an array of this component type, or -1 if this type is not supported by newarray.- Returns:
- the code used by the
newarrayinstruction to create an array of this component type, or-1if this type is not supported bynewarray - See Java Virtual Machine Specification:
- 6.5.newarray newarray
- See Also:
slotSize
public int slotSize()
pop versus pop2.- Returns:
- the number of local variable index or operand stack depth consumed by this type
- See Java Virtual Machine Specification:
- 2.6.1 Local Variables
2.6.2 Operand Stacks
asLoadable
public TypeKind asLoadable()
- Returns:
- the computational type for this type, or
voidforvoid - See Also:
fromNewarrayCode
public static TypeKind fromNewarrayCode(int newarrayCode)
newarray.- 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 - See Java Virtual Machine Specification:
- 6.5.newarray newarray
- See Also:
fromDescriptor
public static TypeKind fromDescriptor(CharSequence s)
- Parameters:
-
s- the field descriptor - Returns:
- the type associated with the specified field descriptor
- Throws:
-
IllegalArgumentException- only if the descriptor is not valid
from
public static TypeKind from(TypeDescriptor.OfField<?> descriptor)
- Parameters:
-
descriptor- the field descriptor - Returns:
- the type associated with the specified field descriptor
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.