Skip to content

Project does not compile with Java 21 language level #424

Open
@cushon

Description

@cushon

Project does not compile with Java 21 language and API level.

The definition of namedGroups() clashes with a JDK API was added in JDK 20: https://bugs.openjdk.org/browse/JDK-8292872

Repro:

JAVA_HOME=<path to JDK 21> ant
...
    [javac] ./synoptic/src/synoptic/util/matching/NamedMatcher.java:107: error: namedGroups() in NamedMatcher cannot implement namedGroups() in MatchResult
    [javac]     public Map<String, String> namedGroups() {
    [javac]                                ^
    [javac]   return type Map<String,String> is not compatible with Map<String,Integer>
    [javac] ./synoptic/src/synoptic/util/matching/INamedMatchResult.java:15: error: namedGroups() in INamedMatchResult clashes with namedGroups() in MatchResult
    [javac]     Map<String, String> namedGroups();
    [javac]                         ^
    [javac]   return type Map<String,String> is not compatible with Map<String,Integer>

The repro requires updating the source version from 1.7 to 8, the latest javac versions to not support -source 1.7:

diff --git a/InvariMint/build.xml b/InvariMint/build.xml
index 6576fb28..2ab9b08b 100644
--- a/InvariMint/build.xml
+++ b/InvariMint/build.xml
@@ -18,8 +18,8 @@

        <property name="debuglevel" value="source,lines,vars"/>

-       <property name="target" value="1.7"/>
-    <property name="source" value="1.7"/>
+       <property name="target" value="8"/>
+    <property name="source" value="8"/>

     <!-- Where to find the generated synoptic classes. -->
     <path id="invarimint.classes.classpath">
diff --git a/csight/build.xml b/csight/build.xml
index 1548fb74..c80c4050 100644
--- a/csight/build.xml
+++ b/csight/build.xml
@@ -15,8 +15,8 @@
     <property name="csight.jarpath" value="${util.synoptic.libdir}/csight.jar"/>
     <property name="junit.output.dir" value="junit"/>
     <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.7"/>
-    <property name="source" value="1.7"/>
+    <property name="target" value="8"/>
+    <property name="source" value="8"/>

     <!-- Where to find the generated synoptic classes. -->
     <path id="csight.classes.classpath">
diff --git a/daikonizer/build.xml b/daikonizer/build.xml
index bc4269ec..7f23a34a 100644
--- a/daikonizer/build.xml
+++ b/daikonizer/build.xml
@@ -35,8 +35,8 @@
     </manifestclasspath>

     <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.7"/>
-    <property name="source" value="1.7"/>
+    <property name="target" value="8"/>
+    <property name="source" value="8"/>

     <!--=====================================================================-->
     <target name="clean">
diff --git a/synoptic/build.xml b/synoptic/build.xml
index a6731474..0612f10b 100644
--- a/synoptic/build.xml
+++ b/synoptic/build.xml
@@ -45,8 +45,8 @@
     </manifestclasspath>

     <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.7"/>
-    <property name="source" value="1.7"/>
+    <property name="target" value="8"/>
+    <property name="source" value="8"/>

     <!--=====================================================================-->
     <target name="clean">
diff --git a/synopticjung/build.xml b/synopticjung/build.xml
index 98942bb2..2a7c8e09 100644
--- a/synopticjung/build.xml
+++ b/synopticjung/build.xml
@@ -4,8 +4,8 @@
     <property environment="env"/>
     <property name="SYNOPTIC_LIB" value="../lib"/>
     <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.7"/>
-    <property name="source" value="1.7"/>
+    <property name="target" value="8"/>
+    <property name="source" value="8"/>

        <path id="SynopticJung.classpath">
         <pathelement location="bin"/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions