You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/12/06 22:07:28 UTC
[commons-statistics] branch master updated: Fix build on JDK 9+ using compiler release property
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
The following commit(s) were added to refs/heads/master by this push:
new c4047c9 Fix build on JDK 9+ using compiler release property
c4047c9 is described below
commit c4047c95cfc9d308fdcfe368caf10b3ec296954a
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Dec 6 22:07:14 2022 +0000
Fix build on JDK 9+ using compiler release property
---
pom.xml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/pom.xml b/pom.xml
index 677f932..7a9f1e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,8 @@
<commons.jira.id>STATISTICS</commons.jira.id>
<commons.jira.pid>12321632</commons.jira.pid>
<commons.encoding>UTF-8</commons.encoding>
+ <!-- JVM target version, in the newer JDK 9+ format. -->
+ <jvm.target>8</jvm.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Workaround to avoid duplicating config files. -->
@@ -461,6 +463,24 @@
</reporting>
<profiles>
+ <profile>
+ <id>compiler-release-property</id>
+ <activation>
+ <jdk>[9,)</jdk>
+ </activation>
+ <properties>
+ <!--
+ The "release" compiler property (available in JDK 9+) must be set in order to generate
+ binary-compatible artifacts for the target JVM. This flag sets the version of the platform
+ APIs to compile against, which is necessary when building with a later JDK but targeting
+ an earlier one. For example, use of the method reference new SplittableRandom()::nextInt
+ must target the method in SplittableRandom and not java.util.random.RandomGenerator
+ (added in JDK 17). If the release property is not set when compiling for Java 8, then the
+ Java 17 method will be referenced in the bytecode, causing a runtime error when running on 8.
+ -->
+ <maven.compiler.release>${jvm.target}</maven.compiler.release>
+ </properties>
+ </profile>
<profile>
<!-- Override a parent property if the SVN site checkout should not be performed.
This should activate for child modules. -->