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 2018/02/20 08:55:02 UTC

[GitHub] jlahoda closed pull request #406: Adding basic support for vars

jlahoda closed pull request #406: Adding basic support for vars
URL: https://github.com/apache/incubator-netbeans/pull/406
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java b/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java
index 3f5b73f8d..bc89169d7 100644
--- a/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java
+++ b/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java
@@ -1050,7 +1050,7 @@ private boolean shouldChangePlatform(SpecificationVersion selectedSourceLevel,
         private static int minor(@NonNull final SpecificationVersion specVer) {
             final String s = specVer.toString();
             final int split = s.indexOf('.');   //NOI18N
-            return split < 0 ? 0 : Integer.parseInt(s.substring(split+1));
+            return split < 0 ? -1 : Integer.parseInt(s.substring(split+1));
         }
 
         private static int major(@NonNull final SpecificationVersion specVer) {
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 23e9f3276..ccd90c80e 100644
--- a/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
+++ b/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
@@ -191,6 +191,7 @@
     private static final String TRUE_KEYWORD = "true"; //NOI18N
     private static final String TRY_KEYWORD = "try"; //NOI18N
     private static final String USES_KEYWORD = "uses"; //NOI18N
+    private static final String VAR_KEYWORD = "var"; //NOI18N
     private static final String VOID_KEYWORD = "void"; //NOI18N
     private static final String VOLATILE_KEYWORD = "volatile"; //NOI18N
     private static final String WHILE_KEYWORD = "while"; //NOI18N
@@ -230,6 +231,20 @@
         TRANSIENT_KEYWORD, VOID_KEYWORD, VOLATILE_KEYWORD
     };
 
+    private static final SourceVersion SOURCE_VERSION_RELEASE_10;
+
+    static {
+        SourceVersion r10;
+
+        try {
+            r10 = SourceVersion.valueOf("RELEASE_10");
+        } catch (IllegalArgumentException ex) {
+            r10 = null;
+        }
+
+        SOURCE_VERSION_RELEASE_10 = r10;
+    }
+
     private final ItemFactory<T> itemFactory;
     private final Set<Options> options;
 
@@ -4311,6 +4326,11 @@ private void addKeywordsForBlock(Env env) {
             }
             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) {
@@ -4390,7 +4410,9 @@ private void addValueKeywords(Env env) throws IOException {
         if (Utilities.startsWith(TRUE_KEYWORD, prefix)) {
             results.add(itemFactory.createKeywordItem(TRUE_KEYWORD, null, anchorOffset, smartType));
         }
-        if (Utilities.startsWith(NULL_KEYWORD, prefix)) {
+        boolean isVar = env.getPath().getLeaf().getKind() == Tree.Kind.VARIABLE &&
+                        env.getController().getTreeUtilities().isSynthetic(new TreePath(env.getPath(), ((VariableTree) env.getPath().getLeaf()).getType()));
+        if (Utilities.startsWith(NULL_KEYWORD, prefix) && !isVar) {
             results.add(itemFactory.createKeywordItem(NULL_KEYWORD, null, anchorOffset, false));
         }
         if (Utilities.startsWith(NEW_KEYWORD, prefix)) {
@@ -4910,7 +4932,7 @@ private boolean containsAccessibleNonFinalType(Element e, Scope scope, Trees tre
             Tree tree = path.getLeaf();
             switch (tree.getKind()) {
                 case VARIABLE:
-                    TypeMirror type = controller.getTrees().getTypeMirror(new TreePath(path, ((VariableTree) tree).getType()));
+                    TypeMirror type = controller.getTrees().getTypeMirror(path);
                     if (type == null) {
                         return null;
                     }
diff --git a/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/10/emptyVar.pass b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/10/emptyVar.pass
new file mode 100644
index 000000000..99c0d25b2
--- /dev/null
+++ b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/10/emptyVar.pass
@@ -0,0 +1,137 @@
+int a
+boolean b
+protected native Object clone()
+public boolean equals(Object obj)
+protected void finalize()
+public final native Class<?> getClass()
+public native int hashCode()
+public final native void notify()
+public final native void notifyAll()
+public void op(int a, boolean b)
+public String toString()
+public final void wait()
+public final native void wait(long arg0)
+public final void wait(long timeout, int nanos)
+boolean
+byte
+char
+double
+false
+float
+int
+long
+new
+short
+super
+this
+true
+AbstractMethodError
+Appendable
+ArithmeticException
+ArrayIndexOutOfBoundsException
+ArrayStoreException
+AssertionError
+AutoCloseable
+Boolean
+BootstrapMethodError
+Byte
+CharSequence
+Character
+Class
+ClassCastException
+ClassCircularityError
+ClassFormatError
+ClassLoader
+ClassNotFoundException
+ClassValue
+CloneNotSupportedException
+Cloneable
+Comparable
+Compiler
+Deprecated
+Double
+Enum
+EnumConstantNotPresentException
+Error
+Exception
+ExceptionInInitializerError
+Float
+FunctionalInterface
+IllegalAccessError
+IllegalAccessException
+IllegalArgumentException
+IllegalCallerException
+IllegalMonitorStateException
+IllegalStateException
+IllegalThreadStateException
+IncompatibleClassChangeError
+IndexOutOfBoundsException
+InheritableThreadLocal
+InstantiationError
+InstantiationException
+Integer
+InternalError
+InterruptedException
+Iterable
+LayerInstantiationException
+LinkageError
+Long
+Math
+Module
+ModuleLayer
+NegativeArraySizeException
+NoClassDefFoundError
+NoSuchFieldError
+NoSuchFieldException
+NoSuchMethodError
+NoSuchMethodException
+NullPointerException
+Number
+NumberFormatException
+Object
+OutOfMemoryError
+Override
+Package
+Process
+ProcessBuilder
+ProcessHandle
+Readable
+ReflectiveOperationException
+Runnable
+Runtime
+RuntimeException
+RuntimePermission
+SafeVarargs
+SecurityException
+SecurityManager
+Short
+StackOverflowError
+StackTraceElement
+StackWalker
+StrictMath
+String
+StringBuffer
+StringBuilder
+StringIndexOutOfBoundsException
+SuppressWarnings
+System
+Test
+Thread
+ThreadDeath
+ThreadGroup
+ThreadLocal
+Throwable
+TypeNotPresentException
+UnknownError
+UnsatisfiedLinkError
+UnsupportedClassVersionError
+UnsupportedOperationException
+VerifyError
+VirtualMachineError
+Void
+com
+java
+javax
+netscape
+org
+sun
diff --git a/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/10/varKeyword.pass b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/10/varKeyword.pass
new file mode 100644
index 000000000..1f7154f73
--- /dev/null
+++ b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/10/varKeyword.pass
@@ -0,0 +1,2 @@
+var
+void
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
new file mode 100644
index 000000000..f1aa051cf
--- /dev/null
+++ b/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask110FeaturesTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.completion;
+
+import javax.lang.model.SourceVersion;
+import org.netbeans.junit.NbTestSuite;
+import org.netbeans.modules.java.source.parsing.JavacParser;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+public class JavaCompletionTask110FeaturesTest extends CompletionTestBase {
+
+    public JavaCompletionTask110FeaturesTest(String testName) {
+        super(testName);
+    }
+
+    public static NbTestSuite suite() {
+        NbTestSuite suite = new NbTestSuite();
+        try {
+            SourceVersion.valueOf("RELEASE_10");
+            suite.addTestSuite(JavaCompletionTask110FeaturesTest.class);
+        } catch (IllegalArgumentException ex) {
+            //OK, no RELEASE_10, skip tests
+            suite.addTest(new JavaCompletionTask110FeaturesTest("noop"));
+        }
+        return suite;
+    }
+
+    // Java 1.10 var tests -------------------------------------------
+
+    public void testVarAfterEq() throws Exception {
+        performTest("Method", 935, "var v =", "emptyVar.pass", "1.10");
+    }
+
+    public void testVarKeyword() throws Exception {
+        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 {
+        JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
+    }
+}
diff --git a/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java b/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java
index 88e61cfef..8b423ad0b 100644
--- a/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java
+++ b/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.util.concurrent.CountDownLatch;
 import java.util.regex.Pattern;
+import javax.lang.model.SourceVersion;
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ElementKind;
@@ -1008,6 +1009,46 @@ public void open(ClasspathInfo info, Element el) {
         assertEquals(golden, tooltip);
     }
 
+    public void testVar() throws Exception {
+        try {
+            SourceVersion.valueOf("RELEASE_10");
+        } catch (IllegalArgumentException ex) {
+            //OK, no RELEASE_10, skip test:
+            return ;
+        }
+        final boolean[] wasCalled = new boolean[1];
+        this.sourceLevel = "1.10";
+        final String code = "package test;\n" +
+                      "public class Test {\n" +
+                      "    private static void method() {\n" +
+                      "        var var = 0;\n" +
+                      "        int i = va|r;\n" +
+                      "    }\n" +
+                      "}\n";
+
+        performTest(code, new UiUtilsCaller() {
+            @Override public boolean open(FileObject fo, int pos) {
+                assertTrue(source == fo);
+                assertEquals(code.indexOf("var var = 0;"), pos);
+                wasCalled[0] = true;
+                return true;
+            }
+
+            @Override public void beep(boolean goToSource, boolean goToJavadoc) {
+                fail("Should not be called.");
+            }
+            @Override public boolean open(ClasspathInfo info, ElementHandle<?> el) {
+                fail("Should not be called.");
+                return true;
+            }
+            @Override public void warnCannotOpen(String displayName) {
+                fail("Should not be called.");
+            }
+        }, false, false);
+
+        assertTrue(wasCalled[0]);
+    }
+
     private String sourceLevel = "1.5";
     private FileObject source;
     
diff --git a/java.lexer/manifest.mf b/java.lexer/manifest.mf
index 0515a35a0..56e3b1ccd 100644
--- a/java.lexer/manifest.mf
+++ b/java.lexer/manifest.mf
@@ -1,5 +1,5 @@
 OpenIDE-Module: org.netbeans.modules.java.lexer/1
 OpenIDE-Module-Localizing-Bundle: org/netbeans/lib/java/lexer/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.35
+OpenIDE-Module-Specification-Version: 1.36
 OpenIDE-Module-Layer: org/netbeans/lib/java/lexer/layer.xml
 
diff --git a/java.lexer/src/org/netbeans/api/java/lexer/JavaTokenId.java b/java.lexer/src/org/netbeans/api/java/lexer/JavaTokenId.java
index 305525345..7cf0fbb98 100644
--- a/java.lexer/src/org/netbeans/api/java/lexer/JavaTokenId.java
+++ b/java.lexer/src/org/netbeans/api/java/lexer/JavaTokenId.java
@@ -113,6 +113,8 @@
     UNDERSCORE("_", "keyword"),
     /**@since 1.34*/
     USES("uses", "keyword"),
+    /**@since 1.36*/
+    VAR("var", "keyword"),
     VOID("void", "keyword"),
     VOLATILE("volatile", "keyword"),
     WHILE("while", "keyword-directive"),
diff --git a/java.lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java b/java.lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java
index 1b3bdb599..e03925995 100644
--- a/java.lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java
+++ b/java.lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java
@@ -19,6 +19,8 @@
 
 package org.netbeans.lib.java.lexer;
 
+import java.util.EnumSet;
+import java.util.Set;
 import java.util.function.Supplier;
 import org.netbeans.api.java.lexer.JavaTokenId;
 import org.netbeans.api.lexer.PartType;
@@ -1023,21 +1025,59 @@ else if ('0' <= c && c <= '9') { // float literal
                     return finishIdentifier(c);
 
                 case 'v':
-                    if ((c = nextChar()) == 'o') {
-                        switch (c = nextChar()) {
-                            case 'i':
-                                if ((c = nextChar()) == 'd')
-                                    return keywordOrIdentifier(JavaTokenId.VOID);
-                                break;
-                            case 'l':
-                                if ((c = nextChar()) == 'a'
-                                 && (c = nextChar()) == 't'
-                                 && (c = nextChar()) == 'i'
-                                 && (c = nextChar()) == 'l'
-                                 && (c = nextChar()) == 'e')
-                                    return keywordOrIdentifier(JavaTokenId.VOLATILE);
-                                break;
-                        }
+                    switch ((c = nextChar())) {
+                        case 'a':
+                            if ((c = nextChar()) == 'r') {
+                                c = nextChar();
+                                // Check whether the given char is non-ident and if so then return keyword
+                                if (c != EOF && !Character.isJavaIdentifierPart(c = translateSurrogates(c)) &&
+                                    version >= 10) {
+                                    // For surrogate 2 chars must be backed up
+                                    backup((c >= Character.MIN_SUPPLEMENTARY_CODE_POINT) ? 2 : 1);
+
+                                    int len = input.readLength();
+
+                                    Token next = nextToken();
+                                    boolean varKeyword = false;
+
+                                    if (AFTER_VAR_TOKENS.contains(next.id())) {
+                                        do {
+                                            next = nextToken();
+                                        } while (AFTER_VAR_TOKENS.contains(next.id()));
+
+                                        varKeyword = next.id() == JavaTokenId.IDENTIFIER;
+                                    }
+
+                                    input.backup(input.readLengthEOF()- len);
+
+                                    assert input.readLength() == len;
+
+                                    if (varKeyword) {
+                                        return token(JavaTokenId.VAR);
+                                    }
+                                } else {
+                                    // For surrogate 2 chars must be backed up
+                                    backup((c >= Character.MIN_SUPPLEMENTARY_CODE_POINT) ? 2 : 1);
+                                }
+                            }
+                            c = nextChar();
+                            break;
+                        case 'o':
+                            switch (c = nextChar()) {
+                                case 'i':
+                                    if ((c = nextChar()) == 'd')
+                                        return keywordOrIdentifier(JavaTokenId.VOID);
+                                    break;
+                                case 'l':
+                                    if ((c = nextChar()) == 'a'
+                                     && (c = nextChar()) == 't'
+                                     && (c = nextChar()) == 'i'
+                                     && (c = nextChar()) == 'l'
+                                     && (c = nextChar()) == 'e')
+                                        return keywordOrIdentifier(JavaTokenId.VOLATILE);
+                                    break;
+                            }
+                            break;
                     }
                     return finishIdentifier(c);
 
@@ -1251,7 +1291,12 @@ private int translateSurrogates(int c) {
                 ? tokenFactory.getFlyweightToken(id, fixedText)
                 : tokenFactory.createToken(id);
     }
-    
+
+    private static final Set<JavaTokenId> AFTER_VAR_TOKENS = EnumSet.of(
+            JavaTokenId.BLOCK_COMMENT, JavaTokenId.JAVADOC_COMMENT,
+            JavaTokenId.LINE_COMMENT, JavaTokenId.WHITESPACE
+    );
+
     public void release() {
     }
 
diff --git a/java.lexer/test/unit/src/org/netbeans/lib/java/lexer/JavaLexerBatchTest.java b/java.lexer/test/unit/src/org/netbeans/lib/java/lexer/JavaLexerBatchTest.java
index a4965ee3c..6028695d7 100644
--- a/java.lexer/test/unit/src/org/netbeans/lib/java/lexer/JavaLexerBatchTest.java
+++ b/java.lexer/test/unit/src/org/netbeans/lib/java/lexer/JavaLexerBatchTest.java
@@ -519,4 +519,80 @@ public void testBrokenUnicode() {
         LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.ERROR, "\\");
         LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "u00");
     }
+
+    public void testVarKeyword() {
+        String text = "var /*comment*/ /**comment*/ var = 0;";
+        InputAttributes attr = new InputAttributes();
+        attr.setValue(JavaTokenId.language(), "version", Integer.valueOf(10), true);
+        TokenHierarchy<?> hi = TokenHierarchy.create(text, false, JavaTokenId.language(), EnumSet.noneOf(JavaTokenId.class), attr);
+        TokenSequence<?> ts = hi.tokenSequence();
+
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.VAR, "var");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.BLOCK_COMMENT, "/*comment*/");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.JAVADOC_COMMENT, "/**comment*/");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "var");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.EQ, "=");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.INT_LITERAL, "0");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.SEMICOLON, ";");
+    }
+
+    public void testVarIdent() {
+        String text = "var var = 0;";
+        InputAttributes attr = new InputAttributes();
+        attr.setValue(JavaTokenId.language(), "version", Integer.valueOf(9), true);
+        TokenHierarchy<?> hi = TokenHierarchy.create(text, false, JavaTokenId.language(), EnumSet.noneOf(JavaTokenId.class), attr);
+        TokenSequence<?> ts = hi.tokenSequence();
+
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "var");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "var");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.EQ, "=");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.INT_LITERAL, "0");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.SEMICOLON, ";");
+    }
+
+    public void testVarWeird() {
+        String text = "var = 0; varu = 0; val = 0; if (a.var);";
+        InputAttributes attr = new InputAttributes();
+        attr.setValue(JavaTokenId.language(), "version", Integer.valueOf(10), true);
+        TokenHierarchy<?> hi = TokenHierarchy.create(text, false, JavaTokenId.language(), EnumSet.noneOf(JavaTokenId.class), attr);
+        TokenSequence<?> ts = hi.tokenSequence();
+
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "var");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.EQ, "=");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.INT_LITERAL, "0");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.SEMICOLON, ";");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "varu");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.EQ, "=");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.INT_LITERAL, "0");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.SEMICOLON, ";");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "val");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.EQ, "=");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.INT_LITERAL, "0");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.SEMICOLON, ";");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IF, "if");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.WHITESPACE, " ");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.LPAREN, "(");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "a");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.DOT, ".");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "var");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.RPAREN, ")");
+        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.SEMICOLON, ";");
+    }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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