test/langtools/tools/javac/processing/model/TestSourceVersion.java
changeset 48499 239c7d9bb192
parent 47283 ce5fd3ba3fea
child 48538 82c3d4173a53
--- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java	Mon Jan 08 14:06:25 2018 -0500
+++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java	Mon Jan 08 17:32:54 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7025809 8028543 6415644 8028544 8029942
+ * @bug 7025809 8028543 6415644 8028544 8029942 8187951
  * @summary Test latest, latestSupported, underscore as keyword, etc.
  * @author  Joseph D. Darcy
  * @modules java.compiler
@@ -42,6 +42,7 @@
         testLatestSupported();
         testVersionVaryingKeywords();
         testRestrictedKeywords();
+        testVar();
     }
 
     private static void testLatestSupported() {
@@ -96,6 +97,19 @@
         }
     }
 
+    private static void testVar() {
+
+        for(SourceVersion version : SourceVersion.values()) {
+            check(false, isKeyword("var",     version), "keyword", version);
+            check(false, isKeyword("foo.var", version), "keyword", version);
+            check(false, isKeyword("var.foo", version), "keyword", version);
+
+            check(true, isName("var", version),     "name", version);
+            check(true, isName("foo.var", version), "name", version);
+            check(true, isName("var.foo", version), "name", version);
+        }
+    }
+
     private static void check(boolean result, boolean expected,
                               String message, SourceVersion version) {
         if (result != expected) {