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

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


The following commit(s) were added to refs/heads/master by this push:
     new b2db3a6941 Let NetBeans know that Gradle 8.5 is good with Java 21
b2db3a6941 is described below

commit b2db3a6941e9c324e22cb435d1a66eead78ec668
Author: Laszlo Kishalmi <laszlo.kisha...@gmail.com>
AuthorDate: Wed Dec 6 15:35:34 2023 -0800

    Let NetBeans know that Gradle 8.5 is good with Java 21
---
 .../gradle/api/execute/GradleDistributionManager.java     | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
 
b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
index 1cc156d0f6..c903160774 100644
--- 
a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
+++ 
b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
@@ -100,6 +100,7 @@ public final class GradleDistributionManager {
         GradleVersion.version("7.5"), // JDK-18
         GradleVersion.version("7.6"), // JDK-19
         GradleVersion.version("8.3"), // JDK-20
+        GradleVersion.version("8.5"), // JDK-21
     };
 
     final File gradleUserHome;
@@ -484,12 +485,22 @@ public final class GradleDistributionManager {
          * Checks if this Gradle distribution is compatible with the given
          * major version of Java. Java 1.6, 1.7 and 1.8 are treated as major
          * version 6, 7, and 8.
-         *
+         * <p>
+         * NetBeans uses a built in fixed list of compatibility matrix. That
+         * means it might not know about the compatibility of newer Gradle
+         * versions. Optimistic bias would return {@code true} on these
+         * versions form 2.37. 
+         * </p>
          * @param jdkMajorVersion the major version of the JDK
          * @return <code>true</code> if this version is supported with that 
JDK.
          */
         public boolean isCompatibleWithJava(int jdkMajorVersion) {
-            return jdkMajorVersion <= lastSupportedJava();
+            
+            GradleVersion lastKnown = JDK_COMPAT[JDK_COMPAT.length - 1];
+            // Optimistic bias, if the GradleVersion is newer than the last NB
+            // knows, we say it's compatible with any JDK
+            return lastKnown.compareTo(version.getBaseVersion()) < 0 
+                    || jdkMajorVersion <= lastSupportedJava();
         }
 
         /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to