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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3e3475de6e GROOVY-11497: add JDK24 constant
3e3475de6e is described below

commit 3e3475de6e56d90ce034e3567bebb375f95694e4
Author: Daniel Sun <[email protected]>
AuthorDate: Sun Oct 20 13:33:37 2024 +0800

    GROOVY-11497: add JDK24 constant
---
 .github/workflows/groovy-build-test.yml            | 50 +++++++++++-----------
 .../groovy/control/CompilerConfiguration.java      |  5 ++-
 .../groovy/control/CompilerConfigurationTest.java  |  4 +-
 3 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/.github/workflows/groovy-build-test.yml 
b/.github/workflows/groovy-build-test.yml
index a8f721c83c..6f35de0495 100644
--- a/.github/workflows/groovy-build-test.yml
+++ b/.github/workflows/groovy-build-test.yml
@@ -62,28 +62,28 @@ jobs:
       - name: Test with Gradle
         run: ./gradlew test
         timeout-minutes: 60
-#  ea:
-#    #if: github.event_name == 'push'
-#    strategy:
-#      fail-fast: false
-#      matrix:
-#        os: [ubuntu-latest]
-#        # The jdk links of "install-jdk.sh" are sometimes outdated, so we 
have to download openjdk releases from https://jdk.java.net/ by ourselves.
-#        jdk:
-#          - 
"https://download.java.net/java/early_access/jdk23/25/GPL/openjdk-23-ea+25_linux-x64_bin.tar.gz";
-#    runs-on: ${{ matrix.os }}
-#    steps:
-#      - name: Download JDK ${{ matrix.jdk }}
-#        run: wget -c ${{ matrix.jdk }} -O /tmp/openjdk.tar.gz
-#      - name: Set up JDK ${{ matrix.jdk }}
-#        run: mkdir -p /home/runner/openjdk && tar -xvf /tmp/openjdk.tar.gz -C 
/home/runner/openjdk && chmod -R 755 /home/runner/openjdk && mv 
/home/runner/openjdk/jdk*/* /home/runner/openjdk/
-#      - uses: actions/checkout@v4
-#      - uses: actions/setup-java@v4
-#        with:
-#          distribution: 'zulu'
-#          java-version: 21
-#          check-latest: true
-#      - uses: gradle/actions/setup-gradle@v4
-#      - name: Test with Gradle
-#        run: ./gradlew test -Ptarget.java.home=/home/runner/openjdk
-#        timeout-minutes: 60
+  ea:
+    #if: github.event_name == 'push'
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ubuntu-latest]
+        # The jdk links of "install-jdk.sh" are sometimes outdated, so we have 
to download openjdk releases from https://jdk.java.net/ by ourselves.
+        jdk:
+          - 
"https://download.java.net/java/early_access/jdk24/20/GPL/openjdk-24-ea+20_linux-x64_bin.tar.gz";
+    runs-on: ${{ matrix.os }}
+    steps:
+      - name: Download JDK ${{ matrix.jdk }}
+        run: wget -c ${{ matrix.jdk }} -O /tmp/openjdk.tar.gz
+      - name: Set up JDK ${{ matrix.jdk }}
+        run: mkdir -p /home/runner/openjdk && tar -xvf /tmp/openjdk.tar.gz -C 
/home/runner/openjdk && chmod -R 755 /home/runner/openjdk && mv 
/home/runner/openjdk/jdk*/* /home/runner/openjdk/
+      - uses: actions/checkout@v4
+      - uses: actions/setup-java@v4
+        with:
+          distribution: 'zulu'
+          java-version: 21
+          check-latest: true
+      - uses: gradle/actions/setup-gradle@v4
+      - name: Test with Gradle
+        run: ./gradlew test -Ptarget.java.home=/home/runner/openjdk
+        timeout-minutes: 60
diff --git 
a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java 
b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index 54e5d3ca46..688157aa8e 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -105,6 +105,8 @@ public class CompilerConfiguration {
     public static final String JDK22 = "22";
     /** This (<code>"23"</code>) is the value for targetBytecode to compile 
for a JDK 23. */
     public static final String JDK23 = "23";
+    /** This (<code>"23"</code>) is the value for targetBytecode to compile 
for a JDK 23. */
+    public static final String JDK24 = "24";
 
     /**
      * JDK version to bytecode version mapping.
@@ -122,7 +124,8 @@ public class CompilerConfiguration {
             JDK20, Opcodes.V20,
             JDK21, Opcodes.V21,
             JDK22, Opcodes.V22,
-            JDK23, Opcodes.V23
+            JDK23, Opcodes.V23,
+            JDK24, Opcodes.V24
     );
 
     public static final String DEFAULT_TARGET_BYTECODE = 
defaultTargetBytecode();
diff --git 
a/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java 
b/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java
index 3a5311aa85..2d0b4d6437 100644
--- a/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java
+++ b/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java
@@ -297,8 +297,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"};
-        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", "23"};
+        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"};
+        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", "24"};
         assertArrayEquals(expect, Arrays.stream(inputs).map(v -> { 
config.setTargetBytecode(v); return config.getTargetBytecode(); 
}).toArray(String[]::new));
     }
 }

Reply via email to