Package proguard.classfile.util.kotlin
Class KotlinMetadataInitializer
- java.lang.Object
-
- proguard.classfile.util.kotlin.KotlinMetadataInitializer
-
- All Implemented Interfaces:
AnnotationVisitor
,ElementValueVisitor
,ConstantVisitor
,ClassVisitor
public class KotlinMetadataInitializer extends java.lang.Object implements ClassVisitor, AnnotationVisitor, ElementValueVisitor, ConstantVisitor
Initializes the kotlin metadata for a Kotlin class.Provides two APIs:
- Visitor: use as a ClassVisitor or AnnotationVisitor to initialize the Kotlin metadata contain within a
Metadata
annotation. After initialization, all info from the annotation is represented in theClazz
'sProgramClass.kotlinMetadata
field.Note: only applicable for
ProgramClass
.- `initialize`: provide the
Clazz
andMetadata
field values to theinitialize(Clazz, int, int[], String[], String[], int, String, String)
method to initialize Kotlin metadata for the givenClazz
.
-
-
Constructor Summary
Constructors Constructor Description KotlinMetadataInitializer(java.util.function.BiConsumer<Clazz,java.lang.String> errorHandler)
KotlinMetadataInitializer(WarningPrinter warningPrinter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
initialize(Clazz clazz, int k, int[] mv, java.lang.String[] d1, java.lang.String[] d2, int xi, java.lang.String xs, java.lang.String pn)
Initialize Kotlin metadata for a givenClazz
.static boolean
isSupportedMetadataVersion(KotlinMetadataVersion mv)
static boolean
isValidKotlinMetadataAnnotationField(java.lang.String name)
static KotlinMetadataType
metadataTypeOf(java.lang.String name)
void
visitAnnotation(Clazz clazz, Annotation annotation)
Visits any Annotation instance.void
visitAnyClass(Clazz clazz)
Visits any Clazz instance.void
visitArrayElementValue(Clazz clazz, Annotation annotation, ArrayElementValue arrayElementValue)
void
visitConstantElementValue(Clazz clazz, Annotation annotation, ConstantElementValue constantElementValue)
void
visitIntegerConstant(Clazz clazz, IntegerConstant integerConstant)
void
visitLibraryClass(LibraryClass libraryClass)
void
visitProgramClass(ProgramClass clazz)
void
visitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface proguard.classfile.attribute.annotation.visitor.AnnotationVisitor
visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation
-
Methods inherited from interface proguard.classfile.constant.visitor.ConstantVisitor
visitAnyConstant, visitAnyMethodrefConstant, visitAnyRefConstant, visitClassConstant, visitDoubleConstant, visitDynamicConstant, visitFieldrefConstant, visitFloatConstant, visitInterfaceMethodrefConstant, visitInvokeDynamicConstant, visitLongConstant, visitMethodHandleConstant, visitMethodrefConstant, visitMethodTypeConstant, visitModuleConstant, visitNameAndTypeConstant, visitPackageConstant, visitPrimitiveArrayConstant, visitStringConstant
-
Methods inherited from interface proguard.classfile.attribute.annotation.visitor.ElementValueVisitor
visitAnnotationElementValue, visitAnyElementValue, visitClassElementValue, visitEnumConstantElementValue
-
-
-
-
Constructor Detail
-
KotlinMetadataInitializer
public KotlinMetadataInitializer(WarningPrinter warningPrinter)
-
KotlinMetadataInitializer
public KotlinMetadataInitializer(java.util.function.BiConsumer<Clazz,java.lang.String> errorHandler)
-
-
Method Detail
-
visitAnyClass
public void visitAnyClass(Clazz clazz)
Description copied from interface:ClassVisitor
Visits any Clazz instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyClass
in interfaceClassVisitor
-
visitLibraryClass
public void visitLibraryClass(LibraryClass libraryClass)
- Specified by:
visitLibraryClass
in interfaceClassVisitor
-
visitProgramClass
public void visitProgramClass(ProgramClass clazz)
- Specified by:
visitProgramClass
in interfaceClassVisitor
-
visitAnnotation
public void visitAnnotation(Clazz clazz, Annotation annotation)
Description copied from interface:AnnotationVisitor
Visits any Annotation instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnnotation
in interfaceAnnotationVisitor
-
initialize
public void initialize(Clazz clazz, int k, int[] mv, java.lang.String[] d1, java.lang.String[] d2, int xi, java.lang.String xs, java.lang.String pn)
Initialize Kotlin metadata for a givenClazz
.- Parameters:
clazz
- TheProgramClass
orLibraryClass
.
-
visitConstantElementValue
public void visitConstantElementValue(Clazz clazz, Annotation annotation, ConstantElementValue constantElementValue)
- Specified by:
visitConstantElementValue
in interfaceElementValueVisitor
-
visitArrayElementValue
public void visitArrayElementValue(Clazz clazz, Annotation annotation, ArrayElementValue arrayElementValue)
- Specified by:
visitArrayElementValue
in interfaceElementValueVisitor
-
visitUtf8Constant
public void visitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant)
- Specified by:
visitUtf8Constant
in interfaceConstantVisitor
-
visitIntegerConstant
public void visitIntegerConstant(Clazz clazz, IntegerConstant integerConstant)
- Specified by:
visitIntegerConstant
in interfaceConstantVisitor
-
isSupportedMetadataVersion
public static boolean isSupportedMetadataVersion(KotlinMetadataVersion mv)
-
isValidKotlinMetadataAnnotationField
public static boolean isValidKotlinMetadataAnnotationField(java.lang.String name)
-
metadataTypeOf
public static KotlinMetadataType metadataTypeOf(java.lang.String name)
-
-