--- old/test/langtools/tools/javac/processing/model/TestSourceVersion.java 2017-09-27 15:46:12.811959472 -0700 +++ new/test/langtools/tools/javac/processing/model/TestSourceVersion.java 2017-09-27 15:46:12.483959460 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 7025809 8028543 6415644 8028544 8029942 + * @bug 7025809 8028543 6415644 8028544 8029942 8187982 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,21 @@ } } + 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); + + // The string "var" doesn't have special handling until release 10. + boolean lessThan10 = version.compareTo(RELEASE_10) < 0; + check(lessThan10, isName("var", version), "name", version); + check(lessThan10, 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) {