Skip to content

Apache Lucene open-source search software

LUCENE-8035: Run tests with JDK-specific options: --illegal-access=deny on Java 9+

Uwe Schindler4ca51a06f768
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index f2224700445..87ddccab2e8 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -63,6 +63,11 @@ Optimizations
number of hits is small relative to the number of unique facet labels
(Dawid Weiss, Robert Muir, Mike McCandless)
+Tests
+
+* LUCENE-8035: Run tests with JDK-specific options: --illegal-access=deny
+ on Java 9+. (Uwe Schindler)
+
Build
* LUCENE-6144: Upgrade Ivy to 2.4.0; 'ant ivy-bootstrap' now removes old Ivy
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index ae93ab6a6cf..663e733f6b0 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -959,6 +959,12 @@
<condition property="java.security.manager" value="org.apache.lucene.util.TestSecurityManager">
<istrue value="${tests.useSecurityManager}"/>
</condition>
+
+ <!-- additional arguments for Java 9+ -->
+ <local name="tests.runtimespecific.args"/>
+ <condition property="tests.runtimespecific.args" value="" else="--illegal-access=deny">
+ <equals arg1="${build.java.runtime}" arg2="1.8"/>
+ </condition>
<!-- create a fileset pattern that matches ${tests.class}. -->
<loadresource property="tests.explicitclass" quiet="true">
@@ -1040,6 +1046,7 @@
<jvmarg line="${tests.clover.args}"/>
<jvmarg line="@{additional.vm.args}"/>
<jvmarg line="${tests.asserts.args}"/>
+ <jvmarg line="${tests.runtimespecific.args}"/>
<!-- set the number of times tests should run -->
<sysproperty key="tests.iters" value="${tests.iters}"/>