[java] Remove support for Java 16 Preview
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
/**
|
||||
* Support "JEP 420: Pattern Matching for switch (Second Preview)" for Java 18 Preview
|
||||
* There were no grammar changes between 18-preview and 17-preview
|
||||
* Remove support for Java 16 preview language features
|
||||
* Andreas Dangel 03/2022
|
||||
*====================================================================
|
||||
* Promote "JEP 409: Sealed Classes" as permanent language feature with Java 17.
|
||||
* Support "JEP 406: Pattern Matching for switch (Preview)" for Java 17 Preview.
|
||||
* Remove support for Java 15 preview language features
|
||||
@@ -445,11 +450,11 @@ public class JavaParser {
|
||||
if (jdkVersion >= 16 && "record".equals(image)) {
|
||||
throwParseException("With JDK >= 16, 'record' is a contextual keyword and cannot be used for type declarations!");
|
||||
}
|
||||
if ((jdkVersion == 16 && preview || jdkVersion >= 17) && "sealed".equals(image)) {
|
||||
throwParseException("With JDK 16 Preview and JDK >= 17, 'sealed' is a contextual keyword and cannot be used for type declarations!");
|
||||
if (jdkVersion >= 17 && "sealed".equals(image)) {
|
||||
throwParseException("With JDK >= 17, 'sealed' is a contextual keyword and cannot be used for type declarations!");
|
||||
}
|
||||
if ((jdkVersion == 16 && preview || jdkVersion >= 17) && "permits".equals(image)) {
|
||||
throwParseException("With JDK 16 Preview and JDK >= 17, 'permits' is a contextual keyword and cannot be used for type declarations!");
|
||||
if (jdkVersion >= 17 && "permits".equals(image)) {
|
||||
throwParseException("With JDK >= 17, 'permits' is a contextual keyword and cannot be used for type declarations!");
|
||||
}
|
||||
}
|
||||
private void checkForMultipleCaseLabels() {
|
||||
@@ -519,12 +524,12 @@ public class JavaParser {
|
||||
}
|
||||
|
||||
private boolean isSealedClassSupported() {
|
||||
return jdkVersion == 16 && preview || jdkVersion >= 17;
|
||||
return jdkVersion >= 17;
|
||||
}
|
||||
|
||||
private void checkForSealedClassUsage() {
|
||||
if (!isSealedClassSupported()) {
|
||||
throwParseException("Sealed Classes are only supported with JDK 16 Preview and JDK >= 17.");
|
||||
throwParseException("Sealed Classes are only supported with JDK >= 17.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user