< prev index next >

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

Print this page




 114         tab.put("1.8", JDK8); // Make 8 an alias for 1.8
 115         tab.put("1.9", JDK9); // Make 9 an alias for 1.9
 116         tab.put("1.10", JDK10); // Make 10 an alias for 1.10
 117         // Decline to make 1.11 an alias for 11.
 118     }
 119 
 120     private Source(String name) {
 121         this.name = name;
 122     }
 123 
 124     public static final Source MIN = Source.JDK6;
 125 
 126     private static final Source MAX = values()[values().length - 1];
 127 
 128     public static final Source DEFAULT = MAX;
 129 
 130     public static Source lookup(String name) {
 131         return tab.get(name);
 132     }
 133 




 134     public Target requiredTarget() {
 135         if (this.compareTo(JDK12) >= 0) return Target.JDK1_12;
 136         if (this.compareTo(JDK11) >= 0) return Target.JDK1_11;
 137         if (this.compareTo(JDK10) >= 0) return Target.JDK1_10;
 138         if (this.compareTo(JDK9) >= 0) return Target.JDK1_9;
 139         if (this.compareTo(JDK8) >= 0) return Target.JDK1_8;
 140         if (this.compareTo(JDK7) >= 0) return Target.JDK1_7;
 141         if (this.compareTo(JDK6) >= 0) return Target.JDK1_6;
 142         if (this.compareTo(JDK5) >= 0) return Target.JDK1_5;
 143         if (this.compareTo(JDK1_4) >= 0) return Target.JDK1_4;
 144         return Target.JDK1_1;
 145     }
 146 
 147     /**
 148      * Models a feature of the Java programming language. Each feature can be associated with a
 149      * minimum source level, a maximum source level and a diagnostic fragment describing the feature,
 150      * which is used to generate error messages of the kind {@code feature XYZ not supported in source N}.
 151      */
 152     public enum Feature {
 153 




 114         tab.put("1.8", JDK8); // Make 8 an alias for 1.8
 115         tab.put("1.9", JDK9); // Make 9 an alias for 1.9
 116         tab.put("1.10", JDK10); // Make 10 an alias for 1.10
 117         // Decline to make 1.11 an alias for 11.
 118     }
 119 
 120     private Source(String name) {
 121         this.name = name;
 122     }
 123 
 124     public static final Source MIN = Source.JDK6;
 125 
 126     private static final Source MAX = values()[values().length - 1];
 127 
 128     public static final Source DEFAULT = MAX;
 129 
 130     public static Source lookup(String name) {
 131         return tab.get(name);
 132     }
 133 
 134     public boolean isSupported() {
 135         return this.compareTo(MIN) >= 0;
 136     }
 137 
 138     public Target requiredTarget() {
 139         if (this.compareTo(JDK12) >= 0) return Target.JDK1_12;
 140         if (this.compareTo(JDK11) >= 0) return Target.JDK1_11;
 141         if (this.compareTo(JDK10) >= 0) return Target.JDK1_10;
 142         if (this.compareTo(JDK9) >= 0) return Target.JDK1_9;
 143         if (this.compareTo(JDK8) >= 0) return Target.JDK1_8;
 144         if (this.compareTo(JDK7) >= 0) return Target.JDK1_7;
 145         if (this.compareTo(JDK6) >= 0) return Target.JDK1_6;
 146         if (this.compareTo(JDK5) >= 0) return Target.JDK1_5;
 147         if (this.compareTo(JDK1_4) >= 0) return Target.JDK1_4;
 148         return Target.JDK1_1;
 149     }
 150 
 151     /**
 152      * Models a feature of the Java programming language. Each feature can be associated with a
 153      * minimum source level, a maximum source level and a diagnostic fragment describing the feature,
 154      * which is used to generate error messages of the kind {@code feature XYZ not supported in source N}.
 155      */
 156     public enum Feature {
 157 


< prev index next >