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

jlahoda 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 1c4e68a  jackpot sourceVersion() fix for java 8 and newer.
1c4e68a is described below

commit 1c4e68afd7ca1b248488392648241163c8a8d15e
Author: Michael Bien <[email protected]>
AuthorDate: Sun Sep 19 11:07:29 2021 +0200

    jackpot sourceVersion() fix for java 8 and newer.
---
 .../modules/java/hints/declarative/conditionapi/Context.java | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git 
a/java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/conditionapi/Context.java
 
b/java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/conditionapi/Context.java
index b9820fc..0632315 100644
--- 
a/java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/conditionapi/Context.java
+++ 
b/java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/conditionapi/Context.java
@@ -43,7 +43,6 @@ import javax.lang.model.type.TypeKind;
 import javax.lang.model.type.TypeMirror;
 import org.netbeans.api.annotations.common.CheckForNull;
 import org.netbeans.api.annotations.common.NonNull;
-import org.netbeans.api.java.queries.SourceLevelQuery;
 import org.netbeans.api.java.source.TreeUtilities;
 import org.netbeans.modules.java.hints.declarative.APIAccessor;
 import org.netbeans.modules.java.hints.spiimpl.Hacks;
@@ -70,16 +69,7 @@ public class Context {
     }
 
     public @NonNull SourceVersion sourceVersion() {
-        String sourceLevel = 
SourceLevelQuery.getSourceLevel(ctx.getInfo().getFileObject());
-
-        if (sourceLevel == null) {
-            return SourceVersion.latest(); //TODO
-        }
-
-        String[] splited = sourceLevel.split("\\.");
-        String   spec    = splited[1];
-
-        return SourceVersion.valueOf("RELEASE_"+  spec);//!!!
+        return ctx.getInfo().getSourceVersion();
     }
 
     public @NonNull Set<Modifier> modifiers(@NonNull Variable variable) {

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to