Class KotlinAliasReferenceFixer
- java.lang.Object
-
- proguard.classfile.editor.KotlinAliasReferenceFixer
-
- All Implemented Interfaces:
KotlinTypeVisitor,ClassVisitor
public class KotlinAliasReferenceFixer extends java.lang.Object implements ClassVisitor, KotlinTypeVisitor
ThisClassVisitorfixes thealiasNameof Kotlin types that reference a type alias whose declaration container has been renamed.ClassReferenceFixerre-derives a type'sclassNamefrom its referenced class, but it leavesaliasNamealone, becausealiasNameis a plain string naming the alias's declaration site rather than a reference thatClassReferenceFixerresolves. Run this fixer over the program class pool afterClassReferenceFixer(so the declaration containers already carry their new names) to keep those strings consistent with the renamed declarations.The recorded format matches what
ClassReferenceInitializerparses back: an alias declared in a class is<declaring class>.<simple name>; one declared in a file facade (or multi-file part) is<facade package>/<simple name>. Both pieces are read from the post-rename declaration container, so the rewrite holds under any renaming, including a move to another package. An unresolved reference (no referenced type alias) is left untouched, mirroring howClassReferenceFixerskips unresolved references.- See Also:
ClassReferenceFixer
-
-
Constructor Summary
Constructors Constructor Description KotlinAliasReferenceFixer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisitAnyClass(Clazz clazz)Visits any Clazz instance.voidvisitAnyType(Clazz clazz, KotlinTypeMetadata kotlinTypeMetadata)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface proguard.classfile.visitor.ClassVisitor
visitLibraryClass, visitProgramClass
-
Methods inherited from interface proguard.classfile.kotlin.visitor.KotlinTypeVisitor
visitAbbreviation, visitAliasExpandedType, visitAliasUnderlyingType, visitAnyContextReceiverType, visitClassContextReceiverType, visitConstructorValParamType, visitConstructorValParamVarArgType, visitFunctionContextReceiverType, visitFunctionReceiverType, visitFunctionReturnType, visitFunctionValParamType, visitFunctionValParamVarArgType, visitInlineClassUnderlyingPropertyType, visitOuterClass, visitParameterUpperBound, visitPropertyContextReceiverType, visitPropertyReceiverType, visitPropertyType, visitPropertyValParamType, visitPropertyValParamVarArgType, visitStarProjection, visitSuperType, visitTypeArgument, visitTypeOfIsExpression, visitTypeUpperBound
-
-
-
-
Method Detail
-
visitAnyClass
public void visitAnyClass(Clazz clazz)
Description copied from interface:ClassVisitorVisits any Clazz instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyClassin interfaceClassVisitor
-
visitAnyType
public void visitAnyType(Clazz clazz, KotlinTypeMetadata kotlinTypeMetadata)
- Specified by:
visitAnyTypein interfaceKotlinTypeVisitor
-
-