You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jl...@apache.org on 2018/02/12 20:08:34 UTC

[incubator-netbeans] 02/02: Applying changes suggested by dbalek.

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

jlahoda pushed a commit to branch jdk18_3
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git

commit aa74425b2c82b4b43adc6c8b8a6d48e1e76b6032
Author: Jan Lahoda <jl...@netbeans.org>
AuthorDate: Mon Feb 12 21:06:16 2018 +0100

    Applying changes suggested by dbalek.
---
 .../netbeans/modules/java/completion/JavaCompletionTask.java   | 10 +++++-----
 .../java/completion/JavaCompletionTask110FeaturesTest.java     |  4 ++++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java b/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
index d6770d8..ccd90c8 100644
--- a/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
+++ b/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
@@ -3746,11 +3746,6 @@ public final class JavaCompletionTask<T> extends BaseTask {
             addLocalAndImportedTypes(env, kinds, baseType);
             hasAdditionalClasses = true;
         }
-        if (SOURCE_VERSION_RELEASE_10 != null &&
-            env.getController().getSourceVersion().compareTo(SOURCE_VERSION_RELEASE_10) >= 0 &&
-            env.getPath().getLeaf().getKind() == Tree.Kind.BLOCK) {
-            results.add(itemFactory.createKeywordItem(VAR_KEYWORD, SPACE, anchorOffset, false));
-        }
         addPackages(env, null, kinds.isEmpty());
     }
 
@@ -4331,6 +4326,11 @@ public final class JavaCompletionTask<T> extends BaseTask {
             }
             tp = tp.getParentPath();
         }
+        if (SOURCE_VERSION_RELEASE_10 != null &&
+            env.getController().getSourceVersion().compareTo(SOURCE_VERSION_RELEASE_10) >= 0 &&
+            Utilities.startsWith(VAR_KEYWORD, prefix)) {
+            results.add(itemFactory.createKeywordItem(VAR_KEYWORD, SPACE, anchorOffset, false));
+        }
     }
 
     private void addKeywordsForStatement(Env env) {
diff --git a/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask110FeaturesTest.java b/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask110FeaturesTest.java
index 989c20b..f1aa051 100644
--- a/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask110FeaturesTest.java
+++ b/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask110FeaturesTest.java
@@ -54,6 +54,10 @@ public class JavaCompletionTask110FeaturesTest extends CompletionTestBase {
         performTest("Method", 935, "v", "varKeyword.pass", "1.10");
     }
 
+    public void testVarKeywordFiltered() throws Exception {
+        performTest("Method", 935, "nonExisting", "empty.pass", "1.10");
+    }
+
     public void noop() {}
 
     static {

-- 
To stop receiving notification emails like this one, please contact
jlahoda@apache.org.

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

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