Interface Signature.ClassTypeSig

All Superinterfaces:
Signature, Signature.RefTypeSig, Signature.ThrowableSig
Enclosing interface:
Signature

public static sealed interface Signature.ClassTypeSig extends Signature.RefTypeSig, Signature.ThrowableSig
Models the signature of a possibly-parameterized class or interface type.

These are examples of class type signatures:

  • Lcom/example/Outer; for Outer
    Has class name com/example/Outer and no outer type or type argument.
  • Lcom/example/Outer$Nested<TA;>; for Outer.Nested<A>
    Has class name com/example/Outer$Nested representing a nested class, no outer type, and a single type argument of type variable A.
  • Lcom/example/GenericOuter<TA;>.Inner; for GenericOuter<A>.Inner
    Has class name Inner, a simple class name, outer type Lcom/example/GenericOuter<TA;>; for GenericOuter<A>, and no type argument.

If the outer type exists, the class name is the simple name of the nested type. Otherwise, it is a binary name in internal form (separated by /).

If a nested type does not have any enclosing parameterization, it may be represented without an outer type and as an internal binary name, in which nesting is represented by $ instead of ..

See Java Virtual Machine Specification:
4.7.9.1 Signatures
Since:
24
See Also:
  • Method Details

    • outerType

      Returns the signature of the class that this class is a member of, only if this is a member class. Note that the outer class may be absent if this is a member class without any parameterized enclosing type.
      Returns:
      the signature of the class that this class is a member of, only if this is a member class
      See Java Language Specification:
      4.5 Parameterized Types
    • className

      String className()
      Returns the class or interface name; includes the slash-separated package name if there is no outer type. Note this may indicate a nested class name with $ separators if there is no parameterized enclosing type.
      Returns:
      the class or interface name; includes the slash-separated package name if there is no outer type
    • classDesc

      default ClassDesc classDesc()
      Returns this class or interface, as a symbolic descriptor.
      Returns:
      this class or interface, as a symbolic descriptor
    • typeArgs

      List<Signature.TypeArg> typeArgs()
      Returns the type arguments of this class or interface. Note that the outer type may have more type arguments.
      Returns:
      the type arguments of this class or interface
      See Java Language Specification:
      4.5 Parameterized Types
    • of

      static Signature.ClassTypeSig of(ClassDesc className, Signature.TypeArg... typeArgs)
      Returns a class or interface signature without an outer type.
      Parameters:
      className - the name of the class or interface
      typeArgs - the type arguments
      Returns:
      a class or interface signature without an outer type
      Throws:
      IllegalArgumentException - if className does not represent a class or interface, or if it cannot be denoted
    • of

      @Deprecated(since="26", forRemoval=true) static Signature.ClassTypeSig of(Signature.ClassTypeSig outerType, ClassDesc className, Signature.TypeArg... typeArgs)
      Deprecated, for removal: This API element is subject to removal in a future version.
      The resulting signature does not denote the class represented by className when outerType is not null. Use of(ClassTypeSig, String, TypeArg...) instead.
      Returns a class or interface signature.
      Parameters:
      outerType - signature of the outer type, may be null
      className - the name of this class or interface
      typeArgs - the type arguments
      Returns:
      a class or interface signature
      Throws:
      IllegalArgumentException - if className does not represent a class or interface, or if it cannot be denoted
    • of

      static Signature.ClassTypeSig of(String className, Signature.TypeArg... typeArgs)
      Returns a class or interface signature without an outer type.
      Parameters:
      className - the name of the class or interface, may use / to separate
      typeArgs - the type arguments
      Returns:
      a class or interface signature without an outer type
      Throws:
      IllegalArgumentException - if className cannot be denoted
    • of

      static Signature.ClassTypeSig of(Signature.ClassTypeSig outerType, String className, Signature.TypeArg... typeArgs)
      Returns a class type signature.
      Parameters:
      outerType - signature of the outer type, may be null
      className - the name of this class or interface, may use / to separate if outer type is absent
      typeArgs - the type arguments
      Returns:
      a class type signature
      Throws:
      IllegalArgumentException - if className cannot be denoted