Skip to content

Commit

Permalink
Use --add-opens to allow tests to pass on recent JDKs.
Browse files Browse the repository at this point in the history
We make the same changes to `pom.xml` in the Android branch, even though they have no effect there. That's just to minimize differences between the two branches.

More progress toward #5801 (maybe enough to close it?)

RELNOTES=n/a
PiperOrigin-RevId: 436528838
  • Loading branch information
eamonnmcmanus authored and Google Java Core Libraries committed Mar 22, 2022
1 parent 53fa691 commit b59971a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
25 changes: 24 additions & 1 deletion android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.add.opens></test.add.opens>
</properties>
<issueManagement>
<system>GitHub Issues</system>
Expand Down Expand Up @@ -230,7 +231,7 @@
<runOrder>alphabetical</runOrder>
<!-- Set max heap for tests. -->
<!-- Catch dependencies on the default locale by setting it to hi-IN. -->
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN</argLine>
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN ${test.add.opens}</argLine>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -404,5 +405,27 @@
<maven-javadoc-plugin.additionalJOptions>--no-module-directories</maven-javadoc-plugin.additionalJOptions>
</properties>
</profile>
<profile>
<id>open-jre-modules</id>
<activation>
<jdk>[9,]</jdk>
</activation>
<properties>
<!--
Some tests need reflective access to the internals of these packages. It is ony the
tests themselves and not the code being tested that needs that access, though there's no
obvious way to ensure that.
We could consider arranging things so that only the tests we know need this would get
the add-opens. Right now that doesn't seem worth the effort, though.
-->
<test.add.opens>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.util.concurrent.locks=ALL-UNNAMED
--add-opens java.base/sun.security.jca=ALL-UNNAMED
</test.add.opens>
</properties>
</profile>
</profiles>
</project>
25 changes: 24 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.add.opens></test.add.opens>
</properties>
<issueManagement>
<system>GitHub Issues</system>
Expand Down Expand Up @@ -224,7 +225,7 @@
<runOrder>alphabetical</runOrder>
<!-- Set max heap for tests. -->
<!-- Catch dependencies on the default locale by setting it to hi-IN. -->
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN</argLine>
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN ${test.add.opens}</argLine>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -411,5 +412,27 @@
<maven-javadoc-plugin.additionalJOptions>--no-module-directories</maven-javadoc-plugin.additionalJOptions>
</properties>
</profile>
<profile>
<id>open-jre-modules</id>
<activation>
<jdk>[9,]</jdk>
</activation>
<properties>
<!--
Some tests need reflective access to the internals of these packages. It is ony the
tests themselves and not the code being tested that needs that access, though there's no
obvious way to ensure that.
We could consider arranging things so that only the tests we know need this would get
the add-opens. Right now that doesn't seem worth the effort, though.
-->
<test.add.opens>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.util.concurrent.locks=ALL-UNNAMED
--add-opens java.base/sun.security.jca=ALL-UNNAMED
</test.add.opens>
</properties>
</profile>
</profiles>
</project>

0 comments on commit b59971a

Please sign in to comment.