Class KotlinAliasReferenceFixer
- All Implemented Interfaces:
KotlinTypeVisitor,ClassVisitor
ClassVisitor fixes the aliasName of Kotlin types that reference a type alias
whose declaration container has been renamed.
ClassReferenceFixer re-derives a type's className from its referenced class,
but it leaves aliasName alone, because aliasName is a plain string naming the
alias's declaration site rather than a reference that ClassReferenceFixer
resolves. Run this fixer over the program class pool after ClassReferenceFixer (so
the declaration containers already carry their new names) to keep those strings consistent with
the renamed declarations.
The recorded format matches what ClassReferenceInitializer
parses 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 how ClassReferenceFixer skips unresolved references.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvisitAnyClass(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, waitMethods inherited from interface proguard.classfile.visitor.ClassVisitor
visitLibraryClass, visitProgramClassMethods 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
-
Constructor Details
-
KotlinAliasReferenceFixer
public KotlinAliasReferenceFixer()
-
-
Method Details
-
visitAnyClass
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
- Specified by:
visitAnyTypein interfaceKotlinTypeVisitor
-