You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/05/22 04:27:38 UTC

(groovy) branch master updated (8309173c5a -> 9414e6ca4a)

This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


    from 8309173c5a GROOVY-12021: Add DO macro for monadic comprehensions over Optional/Stream/Awaitable and @Monadic types
     new 69d49bac68 GROOVY-12028: Add JDK27 constants
     new 9414e6ca4a GROOVY-12027: Align CompilerConfiguration with JDK17 minimum

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../groovy/control/CompilerConfiguration.java      | 31 ++++++++++++----------
 .../transform/RecordTypeASTTransformation.java     |  2 +-
 .../groovy/control/CompilerConfigurationTest.java  |  4 +--
 3 files changed, 20 insertions(+), 17 deletions(-)


(groovy) 02/02: GROOVY-12027: Align CompilerConfiguration with JDK17 minimum

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 9414e6ca4aa7d2ea4791033f233a649120079c25
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri May 22 14:27:27 2026 +1000

    GROOVY-12027: Align CompilerConfiguration with JDK17 minimum
---
 .../groovy/control/CompilerConfiguration.java      | 26 +++++++++++-----------
 .../transform/RecordTypeASTTransformation.java     |  2 +-
 .../groovy/control/CompilerConfigurationTest.java  |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index 2f1ec07db3..763a6d1e21 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -81,17 +81,17 @@ public class CompilerConfiguration {
     /** This (<code>"10"</code>) is the value for targetBytecode to compile for a JDK 10. */
     @Deprecated public static final String JDK10 = "10";
     /** This (<code>"11"</code>) is the value for targetBytecode to compile for a JDK 11. */
-    public static final String JDK11 = "11";
+    @Deprecated public static final String JDK11 = "11";
     /** This (<code>"12"</code>) is the value for targetBytecode to compile for a JDK 12. */
-    public static final String JDK12 = "12";
+    @Deprecated public static final String JDK12 = "12";
     /** This (<code>"13"</code>) is the value for targetBytecode to compile for a JDK 13. */
-    public static final String JDK13 = "13";
+    @Deprecated public static final String JDK13 = "13";
     /** This (<code>"14"</code>) is the value for targetBytecode to compile for a JDK 14. */
-    public static final String JDK14 = "14";
+    @Deprecated public static final String JDK14 = "14";
     /** This (<code>"15"</code>) is the value for targetBytecode to compile for a JDK 15. */
-    public static final String JDK15 = "15";
+    @Deprecated public static final String JDK15 = "15";
     /** This (<code>"16"</code>) is the value for targetBytecode to compile for a JDK 16. */
-    public static final String JDK16 = "16";
+    @Deprecated public static final String JDK16 = "16";
     /** This (<code>"17"</code>) is the value for targetBytecode to compile for a JDK 17. */
     public static final String JDK17 = "17";
     /** This (<code>"18"</code>) is the value for targetBytecode to compile for a JDK 18. */
@@ -119,12 +119,6 @@ public class CompilerConfiguration {
      * JDK version to bytecode version mapping.
      */
     public static final Map<String, Integer> JDK_TO_BYTECODE_VERSION_MAP = Maps.of(
-            JDK11, Opcodes.V11,
-            JDK12, Opcodes.V12,
-            JDK13, Opcodes.V13,
-            JDK14, Opcodes.V14,
-            JDK15, Opcodes.V15,
-            JDK16, Opcodes.V16,
             JDK17, Opcodes.V17,
             JDK18, Opcodes.V18,
             JDK19, Opcodes.V19,
@@ -659,6 +653,7 @@ public class CompilerConfiguration {
      * @param bytecodeVersion The parameter can take one of the values in {@link #ALLOWED_JDKS}.
      * @return true if the bytecode version is JDK 11+
      */
+    @Deprecated
     public static boolean isPostJDK11(final String bytecodeVersion) {
         return isAtLeast(bytecodeVersion, JDK11);
     }
@@ -669,6 +664,7 @@ public class CompilerConfiguration {
      * @param bytecodeVersion The parameter can take one of the values in {@link #ALLOWED_JDKS}.
      * @return true if the bytecode version is JDK 12+
      */
+    @Deprecated
     public static boolean isPostJDK12(final String bytecodeVersion) {
         return isAtLeast(bytecodeVersion, JDK12);
     }
@@ -679,6 +675,7 @@ public class CompilerConfiguration {
      * @param bytecodeVersion The parameter can take one of the values in {@link #ALLOWED_JDKS}.
      * @return true if the bytecode version is JDK 13+
      */
+    @Deprecated
     public static boolean isPostJDK13(final String bytecodeVersion) {
         return isAtLeast(bytecodeVersion, JDK13);
     }
@@ -689,6 +686,7 @@ public class CompilerConfiguration {
      * @param bytecodeVersion The parameter can take one of the values in {@link #ALLOWED_JDKS}.
      * @return true if the bytecode version is JDK 14+
      */
+    @Deprecated
     public static boolean isPostJDK14(final String bytecodeVersion) {
         return isAtLeast(bytecodeVersion, JDK14);
     }
@@ -699,6 +697,7 @@ public class CompilerConfiguration {
      * @param bytecodeVersion The parameter can take one of the values in {@link #ALLOWED_JDKS}.
      * @return true if the bytecode version is JDK 15+
      */
+    @Deprecated
     public static boolean isPostJDK15(final String bytecodeVersion) {
         return isAtLeast(bytecodeVersion, JDK15);
     }
@@ -709,6 +708,7 @@ public class CompilerConfiguration {
      * @param bytecodeVersion The parameter can take one of the values in {@link #ALLOWED_JDKS}.
      * @return true if the bytecode version is JDK 16+
      */
+    @Deprecated
     public static boolean isPostJDK16(final String bytecodeVersion) {
         return isAtLeast(bytecodeVersion, JDK16);
     }
@@ -1181,7 +1181,7 @@ public class CompilerConfiguration {
         if (JDK_TO_BYTECODE_VERSION_MAP.containsKey(javaVersion)) {
             return javaVersion;
         }
-        return JDK11;
+        return JDK17;
     }
 
     /**
diff --git a/src/main/java/org/codehaus/groovy/transform/RecordTypeASTTransformation.java b/src/main/java/org/codehaus/groovy/transform/RecordTypeASTTransformation.java
index 31ce116433..e7bcf72136 100644
--- a/src/main/java/org/codehaus/groovy/transform/RecordTypeASTTransformation.java
+++ b/src/main/java/org/codehaus/groovy/transform/RecordTypeASTTransformation.java
@@ -214,7 +214,7 @@ public class RecordTypeASTTransformation extends AbstractASTTransformation imple
     public static boolean wouldBeNativeRecord(final ClassNode cNode, final String targetBytecode) {
         if (cNode == null || cNode.getAnnotations(MY_TYPE).isEmpty()) return false;
         if (targetBytecode == null || targetBytecode.trim().isEmpty()) return false;
-        if (!isAtLeast(targetBytecode, CompilerConfiguration.JDK16)) return false;
+        if (!isAtLeast(targetBytecode, CompilerConfiguration.JDK17)) return false;
         AnnotationNode options = getRecordOptions(cNode);
         return getMode(options, "mode") != RecordTypeMode.EMULATE;
     }
diff --git a/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java b/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java
index ae5ca37331..4251d187c7 100644
--- a/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java
+++ b/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java
@@ -287,7 +287,7 @@ public final class CompilerConfigurationTest {
     public void testTargetVersion() {
         CompilerConfiguration config = new CompilerConfiguration();
         String[] inputs = {"1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "5" , "6" , "7" , "8" , "9" , "9.0", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28"};
-        String[] expect = {"11" , "11" , "11" , "11" , "11" , "11" , "11" , "11", "11", "11", "11", "11", "11" , "11", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "27"};
+        String[] expect = {"17" , "17" , "17" , "17" , "17" , "17" , "17" , "17", "17", "17", "17", "17", "17" , "17", "17", "17", "17", "17", "17", "17", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "27"};
         assertArrayEquals(expect, Arrays.stream(inputs).map(v -> { config.setTargetBytecode(v); return config.getTargetBytecode(); }).toArray(String[]::new));
     }
 }


(groovy) 01/02: GROOVY-12028: Add JDK27 constants

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 69d49bac68b5b67b1bc98d5117cffb9b547a6ff7
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri May 22 14:12:22 2026 +1000

    GROOVY-12028: Add JDK27 constants
---
 src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java | 5 ++++-
 .../org/codehaus/groovy/control/CompilerConfigurationTest.java       | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index 8a8aaaddb1..2f1ec07db3 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -112,6 +112,8 @@ public class CompilerConfiguration {
     public static final String JDK25 = "25";
     /** This (<code>"26"</code>) is the value for targetBytecode to compile for a JDK 26. */
     public static final String JDK26 = "26";
+    /** This (<code>"27"</code>) is the value for targetBytecode to compile for a JDK 27. */
+    public static final String JDK27 = "27";
 
     /**
      * JDK version to bytecode version mapping.
@@ -132,7 +134,8 @@ public class CompilerConfiguration {
             JDK23, Opcodes.V23,
             JDK24, Opcodes.V24,
             JDK25, Opcodes.V25,
-            JDK26, Opcodes.V26
+            JDK26, Opcodes.V26,
+            JDK27, Opcodes.V27
     );
 
     public static final String DEFAULT_TARGET_BYTECODE = defaultTargetBytecode();
diff --git a/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java b/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java
index 44d93e17df..ae5ca37331 100644
--- a/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java
+++ b/src/test/groovy/org/codehaus/groovy/control/CompilerConfigurationTest.java
@@ -286,8 +286,8 @@ public final class CompilerConfigurationTest {
     @Test // GROOVY-10278
     public void testTargetVersion() {
         CompilerConfiguration config = new CompilerConfiguration();
-        String[] inputs = {"1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "5" , "6" , "7" , "8" , "9" , "9.0", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27"};
-        String[] expect = {"11" , "11" , "11" , "11" , "11" , "11" , "11" , "11", "11", "11", "11", "11", "11" , "11", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "26"};
+        String[] inputs = {"1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "5" , "6" , "7" , "8" , "9" , "9.0", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28"};
+        String[] expect = {"11" , "11" , "11" , "11" , "11" , "11" , "11" , "11", "11", "11", "11", "11", "11" , "11", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "27"};
         assertArrayEquals(expect, Arrays.stream(inputs).map(v -> { config.setTargetBytecode(v); return config.getTargetBytecode(); }).toArray(String[]::new));
     }
 }