Top Description Fields Methods
org.jboss.jandex

public Interface GenericSignature

Known Direct Implementers
org.jboss.jandex.MethodInfo, org.jboss.jandex.RecordComponentInfo, org.jboss.jandex.ClassInfo, org.jboss.jandex.FieldInfo
Imports
java.util.List, java.util.function.Function

Implementations of this interface have a generic signature, as defined in JVMS 17, chapter 4.7.9.1.

Field Summary

Modifier and TypeField and Description
public static final Function<String, Type>

Method Summary

Modifier and TypeMethod and Description
public static void
forType(Type
a type parameters whose generic signature is appended to result
type
,
Function<String, Type>
a substitution function from type variable identifiers to types
typeVariableSubstitution
,
StringBuilder
the StringBuilder to which the generic signature is appended
result
)

Appends a generic signature of a single type to given StringBuilder.

public static void
forTypeParameters(List<TypeVariable>
a list of type parameters whose generic signature is appended to result
typeParameters
,
Function<String, Type>
a substitution function from type variable identifiers to types
typeVariableSubstitution
,
StringBuilder
the StringBuilder to which the generic signature is appended
result
)

Appends a generic signature of a type parameter list, including the < at the beginning and > at the end, to given StringBuilder.

public default String

Returns:

a generic signature of this declaration, never null
genericSignature
()

Returns a generic signature of this declaration, possibly without any generic-related information.

public String

Returns:

a generic signature of this declaration with type variables substituted, never null
genericSignature
(Function<String, Type>
a substitution function from type variable identifiers to types
typeVariableSubstitution
)

Returns a generic signature of this declaration, possibly without any generic-related information.

public default String

Returns:

a generic signature of this declaration, or null if this declaration doesn't have to have one
genericSignatureIfRequired
()

Returns a generic signature of this declaration if required.

public default String

Returns:

a generic signature of this declaration with type variables substituted, or null if this declaration does not have to have one
genericSignatureIfRequired
(Function<String, Type>
a substitution function from type variable identifiers to types
typeVariableSubstitution
)

Returns a generic signature of this declaration if required.

public boolean

Returns:

whether this declaration must have a generic signature
requiresGenericSignature
()

Returns whether this declaration must have a generic signature.

Field Detail

NO_SUBSTITUTIONback to summary
public static final Function<String, Type> NO_SUBSTITUTION

Method Detail

forTypeback to summary
public static void forType(Type type, Function<String, Type> typeVariableSubstitution, StringBuilder result)

Appends a generic signature of a single type to given StringBuilder.

Signatures of type variables are substituted for signatures 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 signature is used unmodified.

Parameters
type:Type

a type parameters whose generic signature is appended to result

typeVariableSubstitution:Function<String, Type>

a substitution function from type variable identifiers to types

result:StringBuilder

the StringBuilder to which the generic signature is appended

forTypeParametersback to summary
public static void forTypeParameters(List<TypeVariable> typeParameters, Function<String, Type> typeVariableSubstitution, StringBuilder result)

Appends a generic signature of a type parameter list, including the < at the beginning and > at the end, to given StringBuilder.

Signatures of type variables are substituted for signatures 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 signature is used unmodified.

Parameters
typeParameters:List<TypeVariable>

a list of type parameters whose generic signature is appended to result

typeVariableSubstitution:Function<String, Type>

a substitution function from type variable identifiers to types

result:StringBuilder

the StringBuilder to which the generic signature is appended

genericSignatureback to summary
public default String genericSignature()

Returns a generic signature of this declaration, possibly without any generic-related information. That is, produces a correct generic signature even if this declaration is not generic and does not use any type variables.

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

Returns:String

a generic signature of this declaration, never null

genericSignatureback to summary
public String genericSignature(Function<String, Type> typeVariableSubstitution)

Returns a generic signature of this declaration, possibly without any generic-related information. That is, produces a correct generic signature even if this declaration is not generic and does not use any type variables.

Signatures of type variables are substituted for signatures 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 signature is used unmodified.

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

Parameters
typeVariableSubstitution:Function<String, Type>

a substitution function from type variable identifiers to types

Returns:String

a generic signature of this declaration with type variables substituted, never null

genericSignatureIfRequiredback to summary
public default String genericSignatureIfRequired()

Returns a generic signature of this declaration if required.

Returns:String

a generic signature of this declaration, or null if this declaration doesn't have to have one

genericSignatureIfRequiredback to summary
public default String genericSignatureIfRequired(Function<String, Type> typeVariableSubstitution)

Returns a generic signature of this declaration if required. Type variable signatures are substituted.

Parameters
typeVariableSubstitution:Function<String, Type>

a substitution function from type variable identifiers to types

Returns:String

a generic signature of this declaration with type variables substituted, or null if this declaration does not have to have one

requiresGenericSignatureback to summary
public boolean requiresGenericSignature()

Returns whether this declaration must have a generic signature. That is, whether the Java compiler when compiling this declaration had to emit the Signature bytecode attribute.

Returns:boolean

whether this declaration must have a generic signature