69 /** JDK 11. */
70 JDK1_11("11", 55, 0),
71
72 /** JDK 12. */
73 JDK1_12("12", 56, 0);
74
75 private static final Context.Key<Target> targetKey = new Context.Key<>();
76
77 public static Target instance(Context context) {
78 Target instance = context.get(targetKey);
79 if (instance == null) {
80 Options options = Options.instance(context);
81 String targetString = options.get(TARGET);
82 if (targetString != null) instance = lookup(targetString);
83 if (instance == null) instance = DEFAULT;
84 context.put(targetKey, instance);
85 }
86 return instance;
87 }
88
89 public static final Target MIN = Target.JDK1_6;
90
91 private static final Target MAX = values()[values().length - 1];
92
93 private static final Map<String,Target> tab = new HashMap<>();
94 static {
95 for (Target t : values()) {
96 tab.put(t.name, t);
97 }
98 tab.put("5", JDK1_5);
99 tab.put("6", JDK1_6);
100 tab.put("7", JDK1_7);
101 tab.put("8", JDK1_8);
102 tab.put("9", JDK1_9);
103 tab.put("10", JDK1_10);
104 tab.put("11", JDK1_11);
105 tab.put("12", JDK1_12);
106 }
107
108 public final String name;
109 public final int majorVersion;
|
69 /** JDK 11. */
70 JDK1_11("11", 55, 0),
71
72 /** JDK 12. */
73 JDK1_12("12", 56, 0);
74
75 private static final Context.Key<Target> targetKey = new Context.Key<>();
76
77 public static Target instance(Context context) {
78 Target instance = context.get(targetKey);
79 if (instance == null) {
80 Options options = Options.instance(context);
81 String targetString = options.get(TARGET);
82 if (targetString != null) instance = lookup(targetString);
83 if (instance == null) instance = DEFAULT;
84 context.put(targetKey, instance);
85 }
86 return instance;
87 }
88
89 public static final Target MIN = Target.JDK1_7;
90
91 private static final Target MAX = values()[values().length - 1];
92
93 private static final Map<String,Target> tab = new HashMap<>();
94 static {
95 for (Target t : values()) {
96 tab.put(t.name, t);
97 }
98 tab.put("5", JDK1_5);
99 tab.put("6", JDK1_6);
100 tab.put("7", JDK1_7);
101 tab.put("8", JDK1_8);
102 tab.put("9", JDK1_9);
103 tab.put("10", JDK1_10);
104 tab.put("11", JDK1_11);
105 tab.put("12", JDK1_12);
106 }
107
108 public final String name;
109 public final int majorVersion;
|