< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/CompileStates.java

Print this page




  42     protected static final Context.Key<CompileStates> compileStatesKey = new Context.Key<>();
  43 
  44     /** Get the CompileStates instance for this context. */
  45     public static CompileStates instance(Context context) {
  46         CompileStates instance = context.get(compileStatesKey);
  47         if (instance == null) {
  48             instance = new CompileStates(context);
  49         }
  50         return instance;
  51     }
  52 
  53     /** Ordered list of compiler phases for each compilation unit. */
  54     public enum CompileState {
  55         INIT(0),
  56         PARSE(1),
  57         ENTER(2),
  58         PROCESS(3),
  59         ATTR(4),
  60         FLOW(5),
  61         TRANSTYPES(6),
  62         UNLAMBDA(7),
  63         LOWER(8),
  64         GENERATE(9);

  65 
  66         CompileState(int value) {
  67             this.value = value;
  68         }
  69         public boolean isAfter(CompileState other) {
  70             return value > other.value;
  71         }
  72         public static CompileState max(CompileState a, CompileState b) {
  73             return a.value > b.value ? a : b;
  74         }
  75         private final int value;
  76     }
  77 
  78     private static final long serialVersionUID = 1812267524140424433L;
  79 
  80     protected Context context;
  81 
  82     public CompileStates(Context context) {
  83         this.context = context;
  84         context.put(compileStatesKey, this);


  42     protected static final Context.Key<CompileStates> compileStatesKey = new Context.Key<>();
  43 
  44     /** Get the CompileStates instance for this context. */
  45     public static CompileStates instance(Context context) {
  46         CompileStates instance = context.get(compileStatesKey);
  47         if (instance == null) {
  48             instance = new CompileStates(context);
  49         }
  50         return instance;
  51     }
  52 
  53     /** Ordered list of compiler phases for each compilation unit. */
  54     public enum CompileState {
  55         INIT(0),
  56         PARSE(1),
  57         ENTER(2),
  58         PROCESS(3),
  59         ATTR(4),
  60         FLOW(5),
  61         TRANSTYPES(6),
  62         TRANSPATTERNS(7),
  63         UNLAMBDA(8),
  64         LOWER(9),
  65         GENERATE(10);
  66 
  67         CompileState(int value) {
  68             this.value = value;
  69         }
  70         public boolean isAfter(CompileState other) {
  71             return value > other.value;
  72         }
  73         public static CompileState max(CompileState a, CompileState b) {
  74             return a.value > b.value ? a : b;
  75         }
  76         private final int value;
  77     }
  78 
  79     private static final long serialVersionUID = 1812267524140424433L;
  80 
  81     protected Context context;
  82 
  83     public CompileStates(Context context) {
  84         this.context = context;
  85         context.put(compileStatesKey, this);
< prev index next >