Skip to content

Add keep rule for kotlin.coroutines.Continuation#3563

Merged
JakeWharton merged 1 commit intosquare:masterfrom
mkj-gram:add-kotlin-continuation-keeprule
Jul 13, 2021
Merged

Add keep rule for kotlin.coroutines.Continuation#3563
JakeWharton merged 1 commit intosquare:masterfrom
mkj-gram:add-kotlin-continuation-keeprule

Conversation

@mkj-gram
Copy link
Copy Markdown
Contributor

I am unsure if the factory that checks for suspend functions relies on the name. If not, and the library do not need the name or location, this could be -keep,allowobfuscation instead.

@JakeWharton
Copy link
Copy Markdown
Collaborator

Sorry I missed this. We do not rely on the name so we can allow obfuscation. Also you'll need to rebase since Christoffer also sent a PR to add a rule.

The check for coroutines is the very last attempt to match a method signature so we compare against a class literal which has a try/catch:

try {
  if (Utils.getRawType(parameterType) == Continuation.class) {
    isKotlinSuspendFunction = true;
    return null;
  }
} catch (NoClassDefFoundError ignored) {
}
throw parameterError(method, p, "No Retrofit annotation found.");

Add keep rule to retain generic signature of Call
@mkj-gram mkj-gram force-pushed the add-kotlin-continuation-keeprule branch from 6901c29 to 0aef0d7 Compare July 13, 2021 07:57
@mkj-gram
Copy link
Copy Markdown
Contributor Author

I rebased (I think) and also allowed for obfuscation and shrinking.

@JakeWharton JakeWharton merged commit b33d43d into square:master Jul 13, 2021
@JakeWharton
Copy link
Copy Markdown
Collaborator

Thanks!

@Simay15
Copy link
Copy Markdown

Simay15 commented Jul 28, 2022

android.enableR8.fullMode=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants