You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2022/09/17 17:54:31 UTC

[groovy] 01/01: GROOVY-10278: set bytecode version as JDK11

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

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

commit 1a19f313c5e7376d472a57109cc2d601cd9826ff
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Sep 18 01:54:13 2022 +0800

    GROOVY-10278: set bytecode version as JDK11
---
 build.gradle                                                         | 4 ++--
 gradle.properties                                                    | 4 ++--
 gradle/idea.gradle                                                   | 4 ++--
 src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java | 4 +---
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/build.gradle b/build.gradle
index 9f8bcb573e..34657ca847 100644
--- a/build.gradle
+++ b/build.gradle
@@ -194,8 +194,8 @@ def compileTestExtensionModule = tasks.register("compileTestExtensionModule", Ja
     classpath = files(tasks.named('jar'))
     source fileTree(extModuleFixtureDir.dir("src/main/java"))
     destinationDirectory = extModuleOutputDir.map  { it.dir("classes") }
-    sourceCompatibility = 1.8
-    targetCompatibility = 1.8
+    sourceCompatibility = sharedConfiguration.targetJavaVersion.get()
+    targetCompatibility = sharedConfiguration.targetJavaVersion.get()
 }
 
 def testExtensionModuleJar = tasks.register("testExtensionModuleJar", Jar) {
diff --git a/gradle.properties b/gradle.properties
index 1e0082e429..6e31193bbe 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,8 +17,8 @@ groovyVersion=5.0.0-SNAPSHOT
 # bundle version format: major('.'minor('.'micro('.'qualifier)?)?)? (first 3 only digits)
 groovyBundleVersion=5.0.0.SNAPSHOT
 
-groovyTargetBytecodeVersion=1.8
-targetJavaVersion=8
+groovyTargetBytecodeVersion=11
+targetJavaVersion=11
 
 binaryCompatibilityBaseline=4.0.0
 gradle_version=7.5.1
diff --git a/gradle/idea.gradle b/gradle/idea.gradle
index 7e0df9d766..1166e206e8 100644
--- a/gradle/idea.gradle
+++ b/gradle/idea.gradle
@@ -50,8 +50,8 @@ if (gradle.startParameter.taskNames.any { it =~ /(?i)idea/ }) {
 
                     // jdk, language level fix
                     def pRoot = node.component.find { it.'@name' == 'ProjectRootManager' }
-                    pRoot.'@languageLevel' = 'JDK_1_8'
-                    pRoot.'@project-jdk-name' = '1.8'
+                    pRoot.'@languageLevel' = 'JDK_11'
+                    pRoot.'@project-jdk-name' = '11'
 
                     // Use git
                     def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
diff --git a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index a6b121bf66..92ba6100d0 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -1093,9 +1093,7 @@ public class CompilerConfiguration {
             throw new GroovyBugError("Bytecode version '" + getTargetBytecode() + "' is not supported by the compiler");
         }
 
-        if (bytecodeVersion <= Opcodes.V1_8) {
-            return Opcodes.V1_8;
-        } else if (isPreviewFeatures()) {
+        if (isPreviewFeatures()) {
             return bytecodeVersion | Opcodes.V_PREVIEW;
         } else {
             return bytecodeVersion;