< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java

Print this page
*** 186,10 ***
--- 186,23 ---
  
      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 JDK22  -> Target.JDK1_22;
          case JDK21  -> Target.JDK1_21;
          case JDK20  -> Target.JDK1_20;

*** 246,10 ***
--- 259,12 ---
          RECORD_PATTERNS(JDK21, Fragments.FeatureDeconstructionPatterns, DiagKind.PLURAL),
          STRING_TEMPLATES(JDK21, Fragments.FeatureStringTemplates, DiagKind.PLURAL),
          UNNAMED_CLASSES(JDK21, Fragments.FeatureUnnamedClasses, DiagKind.PLURAL),
          WARN_ON_ILLEGAL_UTF8(MIN, JDK21),
          UNNAMED_VARIABLES(JDK22, Fragments.FeatureUnnamedVariables, DiagKind.PLURAL),
+         SUPER_INIT(JDK22, Fragments.FeatureSuperInit, DiagKind.NORMAL),
+         VALUE_CLASSES(JDK22, Fragments.FeatureValueClasses, DiagKind.PLURAL),
          ;
  
          enum DiagKind {
              NORMAL,
              PLURAL;
< prev index next >