|| context.types.isSameType(context.symtab.stringType, caseStatement.pat.type)) { if (caseStatement.pat instanceof JCIdent) { Object value = ((VarSymbol) ((JCIdent) caseStatement.pat).sym).getConstValue(); if (context.types.isSameType(context.symtab.stringType, caseStatement.pat.type)) { print("\"" + value + "\" /* " + caseStatement.pat + " */");
/** * Get the value of a constant field. * * @return the value of a constant field. The value is * automatically wrapped in an object if it has a primitive type. * If the field is not constant, returns null. */ public Object constantValue() { Object result = sym.getConstValue(); if (result != null && sym.type.hasTag(BOOLEAN)) // javac represents false and true as Integers 0 and 1 result = Boolean.valueOf(((Integer)result).intValue() != 0); return result; }
/** Return the selected enumeration constant symbol, or null. */ private Symbol enumConstant(JCTree tree, Type enumType) { if (!tree.hasTag(IDENT)) { log.error(tree.pos(), "enum.label.must.be.unqualified.enum"); return syms.errSymbol; } JCIdent ident = (JCIdent)tree; Name name = ident.name; for (Scope.Entry e = enumType.tsym.members().lookup(name); e.scope != null; e = e.next()) { if (e.sym.kind == VAR) { Symbol s = ident.sym = e.sym; ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated ident.type = s.type; return ((s.flags_field & Flags.ENUM) == 0) ? null : s; } } return null; }
private void visitSymbol(Symbol _sym) { Symbol sym = _sym; if (sym.kind == VAR || sym.kind == MTH) { while (sym != null && sym.owner != owner) sym = proxies.lookup(proxyName(sym.name)).sym; if (sym != null && sym.owner == owner) { VarSymbol v = (VarSymbol)sym; if (v.getConstValue() == null) { addFreeVar(v); } } else { if (outerThisStack.head != null && outerThisStack.head != _sym) visitSymbol(outerThisStack.head); } } }
@Override void visitSymbol(Symbol _sym) { Symbol sym = _sym; if (sym.kind == VAR || sym.kind == MTH) { while (sym != null && sym.owner != owner) sym = proxies.lookup(proxyName(sym.name)).sym; if (sym != null && sym.owner == owner) { VarSymbol v = (VarSymbol)sym; if (v.getConstValue() == null) { addFreeVar(v); } } else { if (outerThisStack.head != null && outerThisStack.head != _sym) visitSymbol(outerThisStack.head); } } }
private void visitSymbol(Symbol _sym) { Symbol sym = _sym; if (sym.kind == VAR || sym.kind == MTH) { while (sym != null && sym.owner != owner) sym = proxies.lookup(proxyName(sym.name)).sym; if (sym != null && sym.owner == owner) { VarSymbol v = (VarSymbol)sym; if (v.getConstValue() == null) { addFreeVar(v); } } else { if (outerThisStack.head != null && outerThisStack.head != _sym) visitSymbol(outerThisStack.head); } } }
public Object getConstantValue() { // Mirror API return Constants.decode(getConstValue(), type); }
public static boolean isConstant(Symbol.VarSymbol symbol) { return symbol.getConstValue() != null; }
public Object getConstantValue() { // Mirror API return Constants.decode(getConstValue(), type); }
public static boolean isConstant(Symbol.VarSymbol symbol) { return symbol.getConstValue() != null; }
public Object getConstantValue() { // Mirror API return Constants.decode(getConstValue(), type); }
public Object getConstantValue() { // Mirror API return Constants.decode(getConstValue(), type); }
public static boolean isConstant(Symbol.VarSymbol symbol) { return symbol.getConstValue() != null; } }
public void visitVarDef(JCVariableDecl tree) { VarSymbol v = tree.sym; code.newLocal(v); if (tree.init != null) { checkStringConstant(tree.init.pos(), v.getConstValue()); if (v.getConstValue() == null || varDebugInfo) { genExpr(tree.init, v.erasure(types)).load(); items.makeLocalItem(v).store(); } } checkDimension(tree.pos(), v.type); }
public boolean hasNonNullConstantValue() { return symbol.getConstValue() != null; } }
public static boolean isConstant(Symbol.VarSymbol symbol) { return symbol.getConstValue() != null; } }
public void visitVarDef(JCVariableDecl tree) { VarSymbol v = tree.sym; code.newLocal(v); if (tree.init != null) { checkStringConstant(tree.init.pos(), v.getConstValue()); if (v.getConstValue() == null || varDebugInfo) { genExpr(tree.init, v.erasure(types)).load(); items.makeLocalItem(v).store(); } } checkDimension(tree.pos(), v.type); }
public void visitVarDef(JCVariableDecl tree) { VarSymbol v = tree.sym; code.newLocal(v); if (tree.init != null) { checkStringConstant(tree.init.pos(), v.getConstValue()); if (v.getConstValue() == null || varDebugInfo) { genExpr(tree.init, v.erasure(types)).load(); items.makeLocalItem(v).store(); } } checkDimension(tree.pos(), v.type); }
public void visitVarDef(JCVariableDecl tree) { VarSymbol v = tree.sym; code.newLocal(v); if (tree.init != null) { checkStringConstant(tree.init.pos(), v.getConstValue()); if (v.getConstValue() == null || varDebugInfo) { genExpr(tree.init, v.erasure(types)).load(); items.makeLocalItem(v).store(); } } checkDimension(tree.pos(), v.type); }
public boolean hasNonNullConstantValue() { return symbol.getConstValue() != null; } }