src/share/classes/com/sun/tools/javac/code/Symbol.java

Print this page




 978                         log.useSource(source);
 979                     }
 980                 }
 981             });
 982         }
 983 
 984         /**
 985          * The variable's constant value, if this is a constant.
 986          * Before the constant value is evaluated, it points to an
 987          * initalizer environment.  If this is not a constant, it can
 988          * be used for other stuff.
 989          */
 990         private Object data;
 991 
 992         public boolean isExceptionParameter() {
 993             return data == ElementKind.EXCEPTION_PARAMETER;
 994         }
 995 
 996         public Object getConstValue() {
 997             // TODO: Consider if getConstValue and getConstantValue can be collapsed
 998             if (data == ElementKind.EXCEPTION_PARAMETER) {

 999                 return null;
1000             } else if (data instanceof Callable<?>) {
1001                 // In this case, this is final a variable, with an as
1002                 // yet unevaluated initializer.
1003                 Callable<?> eval = (Callable<?>)data;
1004                 data = null; // to make sure we don't evaluate this twice.
1005                 try {
1006                     data = eval.call();
1007                 } catch (Exception ex) {
1008                     throw new AssertionError(ex);
1009                 }
1010             }
1011             return data;
1012         }
1013 
1014         public void setData(Object data) {
1015             assert !(data instanceof Env<?>) : this;
1016             this.data = data;
1017         }
1018 




 978                         log.useSource(source);
 979                     }
 980                 }
 981             });
 982         }
 983 
 984         /**
 985          * The variable's constant value, if this is a constant.
 986          * Before the constant value is evaluated, it points to an
 987          * initalizer environment.  If this is not a constant, it can
 988          * be used for other stuff.
 989          */
 990         private Object data;
 991 
 992         public boolean isExceptionParameter() {
 993             return data == ElementKind.EXCEPTION_PARAMETER;
 994         }
 995 
 996         public Object getConstValue() {
 997             // TODO: Consider if getConstValue and getConstantValue can be collapsed
 998             if (data == ElementKind.EXCEPTION_PARAMETER ||
 999                 data == ElementKind.RESOURCE_VARIABLE) {
1000                 return null;
1001             } else if (data instanceof Callable<?>) {
1002                 // In this case, this is final a variable, with an as
1003                 // yet unevaluated initializer.
1004                 Callable<?> eval = (Callable<?>)data;
1005                 data = null; // to make sure we don't evaluate this twice.
1006                 try {
1007                     data = eval.call();
1008                 } catch (Exception ex) {
1009                     throw new AssertionError(ex);
1010                 }
1011             }
1012             return data;
1013         }
1014 
1015         public void setData(Object data) {
1016             assert !(data instanceof Env<?>) : this;
1017             this.data = data;
1018         }
1019