Export javac classes

Errorprone used to ship with its own copy of javac, but now just
uses the compiler directly. Errorprone plugins that use javac compiler
internal classes need to tell the compiler to export those classes.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I4537a46525e75757b13af5a92dde60c50e5e660a
diff --git a/errorprone/Android.bp b/errorprone/Android.bp
index b559a15..1428b89 100644
--- a/errorprone/Android.bp
+++ b/errorprone/Android.bp
@@ -31,6 +31,14 @@
         "//external/auto:auto_service_annotations",
     ],
 
+    javacflags: [
+        // These exports are needed because this errorprone plugin access some private classes
+        // of the java compiler.
+        "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
+        "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
+        "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
+    ],
+
     plugins: [
         "//external/auto:auto_service_plugin",
     ],