Package Summary Overview Summary

Module java.base
Package java.lang.classfilePREVIEW

# Enum Class TypeKind

java.lang.Object
java.lang.Enum<TypeKindPREVIEW>
java.lang.classfile.TypeKind

All Implemented Interfaces:
  `Serializable`, `Comparable<TypeKindPREVIEW>`, `Constable`

public enum TypeKind extends Enum<TypeKindPREVIEW>
`TypeKind` is a preview API of the Java platform.
Programs can only use `TypeKind` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Describes the types that can be part of a field or method descriptor.

Since:
  22

- ## Nested Class Summary

  ## Nested classes/interfaces declared in class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `BooleanType`
  the primitive type boolean
  `ByteType`
  the primitive type byte
  `CharType`
  the primitive type char
  `DoubleType`
  the primitive type double
  `FloatType`
  the primitive type float
  `IntType`
  the primitive type int
  `LongType`
  the primitive type long
  `ReferenceType`
  a reference type
  `ShortType`
  the primitive type short
  `VoidType`
  void

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TypeKindPREVIEW`
  `asLoadable()`
  Erase this type kind to the type which will be used for xLOAD, xSTORE, and xRETURN bytecodes
  `String`
  `descriptor()`
  Returns the field descriptor character corresponding to this type.
  `static TypeKindPREVIEW`
  `from (TypeDescriptor.OfField<?> descriptor)`
  Returns the type kind associated with the specified field descriptor.
  `static TypeKindPREVIEW`
  `fromDescriptor (CharSequence s)`
  Returns the type kind associated with the specified field descriptor.
  `static TypeKindPREVIEW`
  `fromNewArrayCode (int newarraycode)`
  Returns the type kind associated with the array type described by the array code used as an operand to `newarray`.
  `int`
  `newarraycode()`
  Returns the code used by the `newarray` opcode corresponding to this type.
  `int`
  `slotSize()`
  Returns the number of local variable slots consumed by this type.
  `String`
  `typeName()`
  Returns the human-readable name corresponding to this type.
  `static TypeKindPREVIEW`
  `valueOf (String name)`
  Returns the enum constant of this class with the specified name.
  `static TypeKindPREVIEW[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods declared in class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods declared in class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### ByteType

    public static final TypeKindPREVIEW ByteType
    the primitive type byte

  - ### ShortType

    public static final TypeKindPREVIEW ShortType
    the primitive type short

  - ### IntType

    public static final TypeKindPREVIEW IntType
    the primitive type int

  - ### FloatType

    public static final TypeKindPREVIEW FloatType
    the primitive type float

  - ### LongType

    public static final TypeKindPREVIEW LongType
    the primitive type long

  - ### DoubleType

    public static final TypeKindPREVIEW DoubleType
    the primitive type double

  - ### ReferenceType

    public static final TypeKindPREVIEW ReferenceType
    a reference type

  - ### CharType

    public static final TypeKindPREVIEW CharType
    the primitive type char

  - ### BooleanType

    public static final TypeKindPREVIEW BooleanType
    the primitive type boolean

  - ### VoidType

    public static final TypeKindPREVIEW VoidType
    void

- ## Method Details

  - ### values

    public static TypeKindPREVIEW[] values()
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns:
      an array containing the constants of this enum class, in the order they are declared

  - ### valueOf

    public static TypeKindPREVIEW valueOf (String name)
    Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum 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 name
      `NullPointerException` - if the argument is null

  - ### typeName

    public String typeName()
    Returns the human-readable name corresponding to this type.
    Returns:
      the human-readable name corresponding to this type

  - ### descriptor

    public String descriptor()
    Returns the field descriptor character corresponding to this type.
    Returns:
      the field descriptor character corresponding to this type

  - ### newarraycode

    public int newarraycode()
    Returns the code used by the `newarray` opcode corresponding to this type.
    Returns:
      the code used by the `newarray` opcode corresponding to this type

  - ### slotSize

    public int slotSize()
    Returns the number of local variable slots consumed by this type.
    Returns:
      the number of local variable slots consumed by this type

  - ### asLoadable

    public TypeKindPREVIEW asLoadable()
    Erase this type kind to the type which will be used for xLOAD, xSTORE, and xRETURN bytecodes
    Returns:
      the erased type kind

  - ### fromNewArrayCode

    public static TypeKindPREVIEW fromNewArrayCode (int newarraycode)
    Returns the type kind associated with the array type described by the array code used as an operand to `newarray`.
    Parameters:
      `newarraycode` - the operand of the `newarray` instruction
    Returns:
      the type kind associated with the array type described by the array code used as an operand to `newarray`

  - ### fromDescriptor

    public static TypeKindPREVIEW fromDescriptor (CharSequence s)
    Returns the type kind associated with the specified field descriptor.
    Parameters:
      `s` - the field descriptor
    Returns:
      the type kind associated with the specified field descriptor

  - ### from

    public static TypeKindPREVIEW from (TypeDescriptor.OfField<?> descriptor)
    Returns the type kind associated with the specified field descriptor.
    Parameters:
      `descriptor` - the field descriptor
    Returns:
      the type kind associated with the specified field descriptor