yGuard icon indicating copy to clipboard operation
yGuard copied to clipboard

Remove Kotlin Metadata annotations

Open ctadlock opened this issue 3 years ago • 2 comments

Kotlin adds a Metadata annotationto every class which includes the class name and all function names; mostly defeating the purpose of renaming. There in an unmeta plugin, but it would be better if it was incorporated into this one so didnt have to deal with both.

ctadlock avatar Nov 22 '22 05:11 ctadlock

IIRC, by default yGuard already removes annotations that are not marked as runtime visible annotations. Can you please provide more information about how these annotations work (are annotated) and how they are used? Because if they don't get removed, then these should be runtime visible annotations which again would indicate that Kotlin might need them at runtime. Pointing to relevant documentation would be helpful to decide on how to proceed. Thanks

yGuy avatar Nov 22 '22 11:11 yGuy

There's a comprehensive blog article from the R8 team here. The Gist is that:

  • removing the annotations breaks Kotlin support
  • the annotation references superclass names (these need to be adjusted)

To correctly support Kotlin we should therefore adjust superclass references in Kotlin annotations

Fohlen avatar Mar 18 '23 09:03 Fohlen