Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classes annotated with @JsonClass(generateAdapter = true) are not obfuscated #1834

Open
sanjeevirajm opened this issue Apr 9, 2024 · 1 comment
Labels

Comments

@sanjeevirajm
Copy link

Expected behaviour -
Classes annotated with @JsonClass(generateAdapter = true) no longer uses reflection, Class name and package name will be obfuscated by default when R8 is enabled.

Actual behaviour -
Class members are obfuscated but class name and package remains same.

Dependencies version -
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"

implementation "com.squareup.moshi:moshi:1.13.0"
ksp "com.squareup.moshi:moshi-kotlin-codegen:1.13.0"

Kotlin and gradle tools version - tried in multiple versions, got the same result

Proguard rule from my side - no additional rule is added

@JakeWharton
Copy link
Collaborator

no longer uses reflection

The generated adapters do not use reflection. However, in order to discover the adapters at runtime, they are looked up reflectively. There is simply no other choice for this, unless you want to manually register each generated adapter with your Moshi.Builder.

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"

Unrelated, but align those versions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants