mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 00:54:38 +02:00
8187951: Update javax.lang.model.SourceVersion for "var" name
Reviewed-by: jjg, mcimadamore
This commit is contained in:
parent
a316ab9ef3
commit
edd2c3b6ca
2 changed files with 26 additions and 9 deletions
|
@ -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 @@ public class TestSourceVersion {
|
|||
testLatestSupported();
|
||||
testVersionVaryingKeywords();
|
||||
testRestrictedKeywords();
|
||||
testVar();
|
||||
}
|
||||
|
||||
private static void testLatestSupported() {
|
||||
|
@ -96,6 +97,19 @@ public class TestSourceVersion {
|
|||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue