< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/TransValues.java

Print this page
rev 55090 : secret-sfac


 104     private boolean staticInitValueFactory;
 105 
 106     // Map from constructor symbols to factory symbols.
 107     private Map<MethodSymbol, MethodSymbol> init2factory = new HashMap<>();
 108 
 109     public static TransValues instance(Context context) {
 110         TransValues instance = context.get(transValuesKey);
 111         if (instance == null)
 112             instance = new TransValues(context);
 113         return instance;
 114     }
 115 
 116     protected TransValues(Context context) {
 117         context.put(transValuesKey, this);
 118         syms = Symtab.instance(context);
 119         make = TreeMaker.instance(context);
 120         types = Types.instance(context);
 121         names = Names.instance(context);
 122         Options options = Options.instance(context);
 123         staticInitValueFactory = options.isSet("staticInitValueFactory");

 124     }
 125 
 126     @SuppressWarnings("unchecked")
 127     public <T extends JCTree> T translate(T tree, boolean requireRVal) {
 128         boolean priorRequireRVal = this.requireRVal;
 129         try {
 130             this.requireRVal = requireRVal;
 131             if (tree == null) {
 132                 return null;
 133             } else {
 134                 tree.accept(this);
 135                 JCTree tmpResult = this.result;
 136                 this.result = null;
 137                 return (T)tmpResult; // XXX cast
 138             }
 139         } finally {
 140              this.requireRVal = priorRequireRVal;
 141         }
 142     }
 143 




 104     private boolean staticInitValueFactory;
 105 
 106     // Map from constructor symbols to factory symbols.
 107     private Map<MethodSymbol, MethodSymbol> init2factory = new HashMap<>();
 108 
 109     public static TransValues instance(Context context) {
 110         TransValues instance = context.get(transValuesKey);
 111         if (instance == null)
 112             instance = new TransValues(context);
 113         return instance;
 114     }
 115 
 116     protected TransValues(Context context) {
 117         context.put(transValuesKey, this);
 118         syms = Symtab.instance(context);
 119         make = TreeMaker.instance(context);
 120         types = Types.instance(context);
 121         names = Names.instance(context);
 122         Options options = Options.instance(context);
 123         staticInitValueFactory = options.isSet("staticInitValueFactory");
 124         staticInitValueFactory |= !options.isSet("noStaticInitValueFactory");
 125     }
 126 
 127     @SuppressWarnings("unchecked")
 128     public <T extends JCTree> T translate(T tree, boolean requireRVal) {
 129         boolean priorRequireRVal = this.requireRVal;
 130         try {
 131             this.requireRVal = requireRVal;
 132             if (tree == null) {
 133                 return null;
 134             } else {
 135                 tree.accept(this);
 136                 JCTree tmpResult = this.result;
 137                 this.result = null;
 138                 return (T)tmpResult; // XXX cast
 139             }
 140         } finally {
 141              this.requireRVal = priorRequireRVal;
 142         }
 143     }
 144 


< prev index next >