< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
Print this page
public boolean isSupported() {
return this.compareTo(MIN) >= 0;
}
+ public static boolean isSupported(Feature feature, int majorVersion) {
+ Source source = null;
+ for (Target target : Target.values()) {
+ if (majorVersion == target.majorVersion) {
+ source = lookup(target.name);
+ }
+ }
+ if (source != null) {
+ return feature.allowedInSource(source);
+ }
+ return false;
+ }
+
public Target requiredTarget() {
return switch(this) {
case JDK24 -> Target.JDK1_24;
case JDK23 -> Target.JDK1_23;
case JDK22 -> Target.JDK1_22;
RECORD_PATTERNS(JDK21, Fragments.FeatureDeconstructionPatterns, DiagKind.PLURAL),
IMPLICIT_CLASSES(JDK21, Fragments.FeatureImplicitClasses, DiagKind.PLURAL),
WARN_ON_ILLEGAL_UTF8(MIN, JDK21),
UNNAMED_VARIABLES(JDK22, Fragments.FeatureUnnamedVariables, DiagKind.PLURAL),
PRIMITIVE_PATTERNS(JDK23, Fragments.FeaturePrimitivePatterns, DiagKind.PLURAL),
+ VALUE_CLASSES(JDK22, Fragments.FeatureValueClasses, DiagKind.PLURAL),
FLEXIBLE_CONSTRUCTORS(JDK22, Fragments.FeatureFlexibleConstructors, DiagKind.NORMAL),
MODULE_IMPORTS(JDK23, Fragments.FeatureModuleImports, DiagKind.PLURAL),
;
enum DiagKind {
< prev index next >