From 8fb36157292db01854fbfa40815e0a37db6332e1 Mon Sep 17 00:00:00 2001 From: Tobias Thierer Date: Thu, 6 Sep 2018 17:30:28 +0100 Subject: 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 --- tools/processors/unsupportedappusage/Android.bp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/processors/unsupportedappusage/Android.bp b/tools/processors/unsupportedappusage/Android.bp index 98f3c955a2d2..1aca3edfab88 100644 --- a/tools/processors/unsupportedappusage/Android.bp +++ b/tools/processors/unsupportedappusage/Android.bp @@ -11,5 +11,15 @@ java_library_host { "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, } -- cgit v1.2.3-59-g8ed1b