From fc475721d261d719aeb7b4c2f635f1de63f0f345 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Tue, 8 Nov 2022 17:27:38 -0500 Subject: [PATCH] Allow mmap to use new preview JDK-19 APIs in Apache Lucene 9.4+ (#5151) * Allow mmap to use new preview JDK-19 APIs in Apache Lucene 9.4+ Signed-off-by: Andriy Redko * Align javadoc release with target compatibility settings Signed-off-by: Andriy Redko Signed-off-by: Andriy Redko --- CHANGELOG.md | 1 + build.gradle | 8 ++++---- distribution/src/config/jvm.options | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7920007bad2cc..26ba49fcbdd76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Apply reproducible builds configuration for OpenSearch plugins through gradle plugin ([#4746](https://github.com/opensearch-project/OpenSearch/pull/4746)) - Add project health badges to the README.md ([#4843](https://github.com/opensearch-project/OpenSearch/pull/4843)) - [Test] Add IAE test for deprecated edgeNGram analyzer name ([#5040](https://github.com/opensearch-project/OpenSearch/pull/5040)) +- Allow mmap to use new JDK-19 preview APIs in Apache Lucene 9.4+ ([#5151](https://github.com/opensearch-project/OpenSearch/pull/5151)) ### Dependencies - Bumps `log4j-core` from 2.18.0 to 2.19.0 diff --git a/build.gradle b/build.gradle index 1fb6cc3849710..076894863b1bf 100644 --- a/build.gradle +++ b/build.gradle @@ -316,10 +316,7 @@ allprojects { javadoc.options.encoding = 'UTF8' javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet') javadoc.options.tags = ["opensearch.internal", "opensearch.api", "opensearch.experimental"] - if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_19) { - javadoc.options.addBooleanOption("-enable-preview", true) - javadoc.options.addStringOption("-release", BuildParams.runtimeJavaVersion.majorVersion) - } + javadoc.options.addStringOption("-release", targetCompatibility.majorVersion) } // support for reproducible builds @@ -416,6 +413,9 @@ gradle.projectsEvaluated { if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_17) { task.jvmArgs += ["-Djava.security.manager=allow"] } + if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_19) { + task.jvmArgs += ["--enable-preview"] + } } } diff --git a/distribution/src/config/jvm.options b/distribution/src/config/jvm.options index ef1035489c9fc..6cd5feadbef87 100644 --- a/distribution/src/config/jvm.options +++ b/distribution/src/config/jvm.options @@ -78,3 +78,6 @@ ${error.file} # Explicitly allow security manager (https://bugs.openjdk.java.net/browse/JDK-8270380) 18-:-Djava.security.manager=allow + +# Allow mmap to use new JDK-19 preview APIs in Apache Lucene 9.4 (https://github.com/opensearch-project/OpenSearch/issues/4637) +19-:--enable-preview