< prev index next >
test/langtools/tools/javac/processing/model/TestSourceVersion.java
Print this page
*** 21,31 ****
* questions.
*/
/*
* @test
! * @bug 7025809 8028543 6415644 8028544 8029942
* @summary Test latest, latestSupported, underscore as keyword, etc.
* @author Joseph D. Darcy
* @modules java.compiler
* jdk.compiler
*/
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 7025809 8028543 6415644 8028544 8029942 8187982 8187951
* @summary Test latest, latestSupported, underscore as keyword, etc.
* @author Joseph D. Darcy
* @modules java.compiler
* jdk.compiler
*/
*** 40,49 ****
--- 40,50 ----
public class TestSourceVersion {
public static void main(String... args) {
testLatestSupported();
testVersionVaryingKeywords();
testRestrictedKeywords();
+ testVar();
}
private static void testLatestSupported() {
if (SourceVersion.latest() != RELEASE_10 ||
SourceVersion.latestSupported() != RELEASE_10)
*** 94,103 ****
--- 95,119 ----
check(true, isName(key, version), "name", version);
}
}
}
+ 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) {
throw new RuntimeException("Unexpected " + message + "-ness of _ on " + version);
}
< prev index next >