Signature.TypeArg (Java SE 26 & JDK 26)
Description: declaration: module: java.base, package: java.lang.classfile, interface: Signature, interface: TypeArg
Keywords: java.lang.classfile.Signature.TypeArg interface

# Interface Signature.TypeArg

All Known Subinterfaces:
  `Signature.TypeArg.Bounded, Signature.TypeArg.Unbounded`

Enclosing interface:
  `Signature`

public static sealed interface Signature.TypeArg permits Signature.TypeArg.Unbounded, Signature.TypeArg.Bounded
Models a type argument, an argument to a type parameter.

See Java Language Specification:
  4.5.1 Type Arguments of Parameterized Types
See Java Virtual Machine Specification:
  4.7.9.1 Signatures
Sealed Class Hierarchy Graph:
Since:
  24
See Also:
  - `Type`
  - `WildcardType`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `Signature.TypeArg.Bounded`
  Models a type argument with an explicit bound type.
  `static interface`
  `Signature.TypeArg.Unbounded`
  Models an unbounded wildcard type argument `*`, or `?` in Java programs.

- ## Method Summary

  Static Methods
  Modifier and Type
  Method
  Description
  `static Signature.TypeArg.Bounded`
  `bounded(Signature.TypeArg.Bounded.WildcardIndicator wildcard, Signature.RefTypeSig boundType)`
  Returns a bounded type argument.
  `static Signature.TypeArg.Bounded`
  `extendsOf(Signature.RefTypeSig boundType)`
  Returns an upper-bounded wildcard type argument.
  `static Signature.TypeArg.Bounded`
  `of(Signature.RefTypeSig boundType)`
  Returns a type argument of a reference type.
  `static Signature.TypeArg.Bounded`
  `superOf(Signature.RefTypeSig boundType)`
  Returns a lower-bounded wildcard type argument.
  `static Signature.TypeArg.Unbounded`
  `unbounded()`
  Returns an unbounded wildcard type argument `*`.

- ## Method Details

  - ### of

    static Signature.TypeArg.Bounded of(Signature.RefTypeSig boundType)
    Returns a type argument of a reference type.
    Parameters:
      `boundType` - the reference type
    Returns:
      a type argument of a reference type
    See Also:
      - `Signature.TypeArg.Bounded.WildcardIndicator.NONE`

  - ### unbounded

    static Signature.TypeArg.Unbounded unbounded()
    Returns an unbounded wildcard type argument `*`.
    Returns:
      an unbounded wildcard type argument `*`

  - ### extendsOf

    static Signature.TypeArg.Bounded extendsOf(Signature.RefTypeSig boundType)
    Returns an upper-bounded wildcard type argument.
    Parameters:
      `boundType` - the upper bound
    Returns:
      an upper-bounded wildcard type argument
    See Also:
      - `Signature.TypeArg.Bounded.WildcardIndicator.EXTENDS`

  - ### superOf

    static Signature.TypeArg.Bounded superOf(Signature.RefTypeSig boundType)
    Returns a lower-bounded wildcard type argument.
    Parameters:
      `boundType` - the lower bound
    Returns:
      a lower-bounded wildcard type argument
    See Also:
      - `Signature.TypeArg.Bounded.WildcardIndicator.SUPER`

  - ### bounded

    static Signature.TypeArg.Bounded bounded(Signature.TypeArg.Bounded.WildcardIndicator wildcard, Signature.RefTypeSig boundType)
    Returns a bounded type argument.
    Parameters:
      `wildcard` - the wildcard indicator
      `boundType` - the bound type
    Returns:
      a bounded type argument