23 * questions. 24 */ 25 26 package com.sun.tools.javac.jvm; 27 28 import com.sun.tools.javac.util.Context; 29 import com.sun.tools.javac.util.Options; 30 import java.util.EnumSet; 31 import java.util.Set; 32 33 import static com.sun.tools.javac.main.Option.PROFILE; 34 35 /** The target profile. 36 * 37 * <p><b>This is NOT part of any supported API. 38 * If you write code that depends on this, you do so at your own risk. 39 * This code and its internal interfaces are subject to change or 40 * deletion without notice.</b> 41 */ 42 public enum Profile { 43 COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14), 44 COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14), 45 COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14), 46 47 DEFAULT { 48 @Override 49 public boolean isValid(Target t) { 50 return true; 51 } 52 }; 53 54 private static final Context.Key<Profile> profileKey = new Context.Key<>(); 55 56 public static Profile instance(Context context) { 57 Profile instance = context.get(profileKey); 58 if (instance == null) { 59 Options options = Options.instance(context); 60 String profileString = options.get(PROFILE); 61 if (profileString != null) instance = lookup(profileString); 62 if (instance == null) instance = DEFAULT; 63 context.put(profileKey, instance); 64 } 65 return instance; | 23 * questions. 24 */ 25 26 package com.sun.tools.javac.jvm; 27 28 import com.sun.tools.javac.util.Context; 29 import com.sun.tools.javac.util.Options; 30 import java.util.EnumSet; 31 import java.util.Set; 32 33 import static com.sun.tools.javac.main.Option.PROFILE; 34 35 /** The target profile. 36 * 37 * <p><b>This is NOT part of any supported API. 38 * If you write code that depends on this, you do so at your own risk. 39 * This code and its internal interfaces are subject to change or 40 * deletion without notice.</b> 41 */ 42 public enum Profile { 43 COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, 44 Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14, Target.JDK1_15), 45 COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, 46 Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14, Target.JDK1_15), 47 COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, 48 Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14, Target.JDK1_15), 49 50 DEFAULT { 51 @Override 52 public boolean isValid(Target t) { 53 return true; 54 } 55 }; 56 57 private static final Context.Key<Profile> profileKey = new Context.Key<>(); 58 59 public static Profile instance(Context context) { 60 Profile instance = context.get(profileKey); 61 if (instance == null) { 62 Options options = Options.instance(context); 63 String profileString = options.get(PROFILE); 64 if (profileString != null) instance = lookup(profileString); 65 if (instance == null) instance = DEFAULT; 66 context.put(profileKey, instance); 67 } 68 return instance; |