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

@Qualifier annotations and proguard rules #408

Open
horseunnamed opened this issue May 27, 2020 · 1 comment
Open

@Qualifier annotations and proguard rules #408

horseunnamed opened this issue May 27, 2020 · 1 comment
Labels

Comments

@horseunnamed
Copy link

Hi. I noticed that proguard rules at TP wiki don't cover situations when we use injections with qualifiers.

For example, I have

@Qualifier
annotation class MyQualifier

And class with such constructor

class Foo @Inject constructor(@MyQualifier bar: String)

Toothpick generates Foo__Factory with code that tries to get instance of qualified argument with full classname of MyQualifier before obfuscation.

String param1 = scope.getInstance(String.class, "com.example.MyQualifier");

But in runtime it will be bound with full classname after obfuscation and that causes crash. I tried proguard rules from TP Wiki with R8 to reproduce this case.

This proguard rule helped me to avoid crash:

-keep @javax.inject.Qualifier @interface *

Should it be added to wiki or am I missing something?

@dlemures
Copy link
Collaborator

dlemures commented Jun 12, 2020

Hi @horseunnamed

It looks like our rules on the wiki and inside smoothie might not cover that use case. Taking into account that you already found the solution, do you wanna contribute by updating:

  1. https://github.com/stephanenicolas/toothpick/blob/master/smoothie/proguard-rules.txt
  2. Wiki: https://github.com/stephanenicolas/toothpick/wiki/Proguard-&-TP

Thx for the issue!

btw, sorry for the delay

@dlemures dlemures added the bug label Jun 13, 2020
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