Class SignatureUtils
java.lang.Object
io.micronaut.sourcegen.bytecode.core.SignatureUtils
JVM generic-signature operations shared by bytecode writers.
The result is the standard JVMS signature string. Keeping this operation independent of a bytecode library lets the ASM and JDK ClassFile backends use exactly the same generic metadata.
- Since:
- 2.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic intboundIndex(List<TypeDef> bounds, int index) The index a bound of a type parameter has in a type annotation's target: 0 is the class bound, which is absent where the first bound is an interface, whose bounds then count from 1.static StringgetClassSignature(ClassDef classDef) The signature outside the write of an inner class: no variables of an enclosing class are in scope.static StringgetClassSignature(ClassDef classDef, EnclosingScope enclosing) static @Nullable StringgetFieldSignature(@Nullable ObjectDef objectDef, FieldDef fieldDef) The signature outside the write of an inner class: no variables of an enclosing class are in scope.static @Nullable StringgetFieldSignature(@Nullable ObjectDef objectDef, FieldDef fieldDef, EnclosingScope enclosing) static @Nullable StringgetInterfaceSignature(InterfaceDef interfaceDef) The signature outside the write of an inner class: no variables of an enclosing class are in scope.static @Nullable StringgetInterfaceSignature(InterfaceDef interfaceDef, EnclosingScope enclosing) static @Nullable StringgetMethodSignature(@Nullable ObjectDef objectDef, MethodDef methodDef) The signature outside the write of an inner class: no variables of an enclosing class are in scope.static @Nullable StringgetMethodSignature(@Nullable ObjectDef objectDef, MethodDef methodDef, EnclosingScope enclosing) static StringgetRecordSignature(RecordDef recordDef) The signature outside the write of an inner class: no variables of an enclosing class are in scope.static StringgetRecordSignature(RecordDef recordDef, EnclosingScope enclosing)
-
Method Details
-
getFieldSignature
The signature outside the write of an inner class: no variables of an enclosing class are in scope.- Parameters:
objectDef- The contextual object, if anyfieldDef- The field- Returns:
- The field signature, or
nullwhen its descriptor is sufficient
-
getFieldSignature
public static @Nullable String getFieldSignature(@Nullable ObjectDef objectDef, FieldDef fieldDef, EnclosingScope enclosing) - Parameters:
objectDef- The contextual object, if anyfieldDef- The fieldenclosing- The enclosing scope of the class being written- Returns:
- The field signature, or
nullwhen its descriptor is sufficient
-
getClassSignature
-
getClassSignature
- Parameters:
classDef- The classenclosing- The enclosing scope of the class being written- Returns:
- The class signature
-
getRecordSignature
-
getRecordSignature
- Parameters:
recordDef- The recordenclosing- The enclosing scope of the class being written- Returns:
- The record signature
-
getInterfaceSignature
The signature outside the write of an inner class: no variables of an enclosing class are in scope.- Parameters:
interfaceDef- The interface- Returns:
- The interface signature, or
nullwhen no generic metadata is needed
-
getInterfaceSignature
public static @Nullable String getInterfaceSignature(InterfaceDef interfaceDef, EnclosingScope enclosing) - Parameters:
interfaceDef- The interfaceenclosing- The enclosing scope of the class being written- Returns:
- The interface signature, or
nullwhen no generic metadata is needed
-
getMethodSignature
public static @Nullable String getMethodSignature(@Nullable ObjectDef objectDef, MethodDef methodDef) The signature outside the write of an inner class: no variables of an enclosing class are in scope.- Parameters:
objectDef- The contextual object, if anymethodDef- The method- Returns:
- The method signature, or
nullwhen its descriptor is sufficient
-
getMethodSignature
public static @Nullable String getMethodSignature(@Nullable ObjectDef objectDef, MethodDef methodDef, EnclosingScope enclosing) - Parameters:
objectDef- The contextual object, if anymethodDef- The methodenclosing- The enclosing scope of the class being written- Returns:
- The method signature, or
nullwhen its descriptor is sufficient
-
boundIndex
The index a bound of a type parameter has in a type annotation's target: 0 is the class bound, which is absent where the first bound is an interface, whose bounds then count from 1.- Parameters:
bounds- The bounds of the type parameterindex- The position of the bound among them- Returns:
- The bound index
- Since:
- 2.3
-