Class KotlinAliasReferenceFixer

java.lang.Object
proguard.classfile.editor.KotlinAliasReferenceFixer
All Implemented Interfaces:
KotlinTypeVisitor, ClassVisitor

public class KotlinAliasReferenceFixer extends Object implements ClassVisitor, KotlinTypeVisitor
This 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 Details

    • KotlinAliasReferenceFixer

      public KotlinAliasReferenceFixer()
  • Method Details