Use -identifiernamestring for split compat implementation classes
This change adds a @IdentifierNameString annotation to use the -identifiernamestring R8 rule. There are a few limitations to this: - -identifiernamestring only obfuscates the string, it does not actually check that the class exists. - If a field has the annotation, it must be non-final, otherwise javac will inline the constant and R8 won't obfuscate it. - Any field/method must be assigned/called with a String literal, otherwise R8 won't obfuscate the string and there will be issues at runtime. Due to these limitations, I ended up adding a getIdentifierName() method to SplitCompatUtils which returns the obfuscated name of implementation classes for split compat. I also added a PRESUBMIT check to enforce that only string literals are passed to that method. There can be cases where R8 will not fail, but a string variable is silently ignored if it is not a String literal. Bug: 1126301 Change-Id: Ie5216e6a81cdbca71cc117460704ea4d9122fc78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451388 Commit-Queue: Clark DuVall <cduvall@chromium.org> Reviewed-by:Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#814212}
Showing
Please register or sign in to comment