< prev index next > test/langtools/tools/javac/processing/model/TestSourceVersion.java
Print this page
*/
Set<String> restrictedKeywords =
Set.of("open", "module", "requires", "transitive", "exports",
"opens", "to", "uses", "provides", "with",
// Assume "record" and "sealed" will be restricted keywords.
! "record", "sealed");
for (String key : restrictedKeywords) {
for (SourceVersion version : SourceVersion.values()) {
check(false, key, (String s) -> isKeyword(s, version), "keyword", version);
check(true, key, (String s) -> isName(s, version), "name", version);
*/
Set<String> restrictedKeywords =
Set.of("open", "module", "requires", "transitive", "exports",
"opens", "to", "uses", "provides", "with",
// Assume "record" and "sealed" will be restricted keywords.
! "record", "sealed", "value");
for (String key : restrictedKeywords) {
for (SourceVersion version : SourceVersion.values()) {
check(false, key, (String s) -> isKeyword(s, version), "keyword", version);
check(true, key, (String s) -> isName(s, version), "name", version);
Predicate<String> isKeywordVersion = (String s) -> isKeyword(s, version);
Predicate<String> isNameVersion = (String s) -> isName(s, version);
for (String name : List.of("yield", "foo.yield", "yield.foo")) {
check(false, name, isKeywordVersion, "keyword", version);
+ check(true, name, isNameVersion, "name", version);
+ }
+ }
+ }
+
+ private static void testValue() {
+ for (SourceVersion version : SourceVersion.values()) {
+ Predicate<String> isKeywordVersion = (String s) -> isKeyword(s, version);
+ Predicate<String> isNameVersion = (String s) -> isName(s, version);
+
+ for (String name : List.of("value", "foo.value", "value.foo")) {
+ check(false, name, isKeywordVersion, "keyword", version);
check(true, name, isNameVersion, "name", version);
}
}
}
< prev index next >