Fix Java flags in TF template to work with JDK 17+
Isolated TF tests are failing since the `--add-exports` option cannot be
parsed by JDK 17+ due to a missing '<target-module>' component. This
change resolves the issue by adjusting the options in the TF template to
export the source package to all unnamed modules.
See
https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-2F61F3A9-0979-46A4-8B49-325BA0EE8B66
for more information.
Test: atest --host HelloWorldHostTest
Change-Id: Iccb8a8dcd3707237e018d6feb6b6a0e8d2bc9a86
diff --git a/core/java_host_unit_test_config_template.xml b/core/java_host_unit_test_config_template.xml
index 1516ab2..9a7e972 100644
--- a/core/java_host_unit_test_config_template.xml
+++ b/core/java_host_unit_test_config_template.xml
@@ -24,6 +24,6 @@
<test class="com.android.tradefed.testtype.IsolatedHostTest" >
<option name="jar" value="{MODULE}.jar" />
<option name="java-flags" value="--add-modules=jdk.compiler"/>
- <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.api"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
</test>
</configuration>