Fix compilation when targeting OpenJDK 9.
CL [1] added a new compilation target that uses internal API
that is now in the jdk.compiler module and is not exported
(it is subject to removal without notice in future versions of
OpenJDK). The fact that these packages are not exported suggests
that a replacement API is already available, but I don't know the
details.
For now, this CL uses javac command-line flags to export these
packages, which fixes compilation. Since the commit message from
CL [1] implies that the entire tool can be removed once bug 77284273
is fixed, a longer-term solution should not be required.
[1] https://android-review.googlesource.com/c/platform/frameworks/base/+/745655
commit bad89e5e5b171a71e42d7c738ec97a39747e4318
Test: The following breaks before but not after this CL:
EXPERIMENTAL_USE_OPENJDK9=true make unsupportedappusage-annotation-processor
Bug: 113853502
Change-Id: I24b77af9262891428a01e2eccc18fa3a5c3b3bc9
diff --git a/tools/processors/unsupportedappusage/Android.bp b/tools/processors/unsupportedappusage/Android.bp
index 98f3c95..1aca3ed 100644
--- a/tools/processors/unsupportedappusage/Android.bp
+++ b/tools/processors/unsupportedappusage/Android.bp
@@ -11,5 +11,15 @@
"guava",
"unsupportedappusage-annotation"
],
+ openjdk9: {
+ javacflags: [
+ "--add-modules=jdk.compiler",
+ "--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
+ "--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
+ "--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
+ "--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
+ ],
+ },
+
use_tools_jar: true,
}