Interface Descriptor

All Known Implementing Classes:
ArrayType, ClassInfo, ClassType, FieldInfo, MethodInfo, ParameterizedType, PrimitiveType, RecordComponentInfo, Type, TypeVariable, TypeVariableReference, UnresolvedTypeVariable, VoidType, WildcardType

public interface Descriptor
Implementations of this interface have a bytecode descriptor, as defined in JVMS 17, chapter 4.3.
  • Field Details

  • Method Details

    • descriptor

      default String descriptor()
      Returns a bytecode descriptor of this element.

      Note that the return value does not come directly from bytecode. Jandex does not store the descriptor strings. Instead, the return value is reconstructed from the Jandex object model.

      Returns:
      a bytecode descriptor of this declaration, never null
    • descriptor

      String descriptor(Function<String,Type> typeVariableSubstitution)
      Returns a bytecode descriptor of this element.

      Descriptors of type variables are substituted for descriptors of types provided by the substitution function typeVariableSubstitution. If the substitution function returns null for some type variable identifier, or if it returns the type variable itself, no substitution happens and the type variable descriptor is used unmodified.

      Note that the return value does not come directly from bytecode. Jandex does not store the descriptor strings. Instead, the return value is reconstructed from the Jandex object model.

      Parameters:
      typeVariableSubstitution - a substitution function from type variable identifiers to types
      Returns:
      a bytecode descriptor of this declaration, never null
    • forType

      static void forType(Type type, Function<String,Type> typeVariableSubstitution, StringBuilder result)
      Appends a bytecode descriptor of a single type to given StringBuilder.

      Descriptors of type variables are substituted for descriptors of types provided by the substitution function typeVariableSubstitution. If the substitution function returns null for some type variable identifier, or if it returns the type variable itself, no substitution happens and the type variable descriptor is used unmodified.

      Parameters:
      type - a type whose bytecode descriptor is appended to result
      typeVariableSubstitution - a substitution function from type variable identifiers to types
      result - the StringBuilder to which the bytecode descriptor is appended