Suppress R8 warnings for support library annotations

Most of these annotations are stripped at dex compile-time, and are not
necessarily present in the generated dex library's classpath. As the
classpath is used to inform R8 about `libraryjars`, this can cause
reference failures during R8 execution when warnings are enabled.

For now, suppress the reference warnings. Unrecognized runtime-visible
annotations will still be kept, and this should unblock efforts to
re-enable R8 warnings for many platform targets. A proper solution will
be to ensure the appropriate annotation libs are fed as `-libraryjars`
to R8.

Bug: 242088131
Test: m + `optimize { ignore_warnings: false }`
Change-Id: Ie92db2a9725ff520b311c6b66a50feae79463925
This commit is contained in:
Jared Duke
2022-08-10 15:14:06 -07:00
parent 93ff78f3ca
commit 3ca564b047

View File

@@ -75,6 +75,19 @@
# has a fallback, but again, don't use Futures.getChecked on Android regardless.
-dontwarn java.lang.ClassValue
# Ignore missing annotation references for various support libraries.
# While this is not ideal, it should be relatively safe given that
# 1) runtime-visible annotations will still be kept, and 2) compile-time
# annotations are stripped by R8 anyway.
# Note: The ** prefix is used to accommodate jarjar repackaging.
# TODO(b/242088131): Remove these exemptions after resolving transitive libs
# dependencies that are provided to R8.
-dontwarn **android**.annotation*.**
-dontwarn **com.google.errorprone.annotations.**
-dontwarn javax.annotation.**
-dontwarn org.checkerframework.**
-dontwarn org.jetbrains.annotations.**
# Less spammy.
-dontnote