You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2023/01/11 07:15:59 UTC

[GitHub] [netbeans] lkishalmi opened a new pull request, #5271: Fix Java version detection in GradleJavaCompatProblemProvider

lkishalmi opened a new pull request, #5271:
URL: https://github.com/apache/netbeans/pull/5271

   
   Fix for #5252.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] mbien commented on a diff in pull request #5271: Fix Java version detection in GradleJavaCompatProblemProvider

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #5271:
URL: https://github.com/apache/netbeans/pull/5271#discussion_r1066650447


##########
extide/gradle/src/org/netbeans/modules/gradle/GradleJavaCompatProblemsProvider.java:
##########
@@ -143,8 +143,12 @@ private static int getJavaMajorVersion(File javaHome) {
 
             }
             String javaVersion = releasePros.getProperty("JAVA_VERSION"); //NOI18N
+            // This should look like "17" or "17.0.9"
             if ((javaVersion != null) && javaVersion.startsWith("\"") && javaVersion.endsWith("\"")) {
-                javaVersion = javaVersion.substring(1, javaVersion.indexOf('.'));
+                int dot = javaVersion.indexOf('.');
+                javaVersion = dot > 0
+                        ? javaVersion.substring(1, javaVersion.indexOf('.'))
+                        : javaVersion.substring(1, javaVersion.length() - 1);

Review Comment:
   this could be using:
   https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Runtime.Version.html#parse(java.lang.String)
   
   once the module moved to 11 so that we don't have to come up with so many ways how to parse java versions.
   Maybe mark the spot with a TODO?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lkishalmi merged pull request #5271: Fix Java version detection in GradleJavaCompatProblemProvider

Posted by GitBox <gi...@apache.org>.
lkishalmi merged PR #5271:
URL: https://github.com/apache/netbeans/pull/5271


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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