checkDimension(l.head.pos(), l.head.sym.type); code.setDefined(code.newLocal(l.head.sym));
warnUnchecked(tree.params.head.pos(), "unchecked.varargs.non.reifiable.type", varargElemType);
chk.checkDeprecatedAnnotation(tree.pos(), v);
warnUnchecked(tree.params.head.pos(), "unchecked.varargs.non.reifiable.type", varargElemType);
/** * Attribute a "lazy constant value". * @param env The env for the const value * @param initializer The initializer for the const value * @param type The expected type, or null * @see VarSymbol#setLazyConstValue */ public Object attribLazyConstantValue(Env<AttrContext> env, JCVariableDecl variable, Type type) { DiagnosticPosition prevLintPos = deferredLintHandler.setPos(variable.pos()); try { // Use null as symbol to not attach the type annotation to any symbol. // The initializer will later also be visited and then we'll attach // to the symbol. // This prevents having multiple type annotations, just because of // lazy constant value evaluation. memberEnter.typeAnnotate(variable.init, env, null, variable.pos()); annotate.flush(); Type itype = attribExpr(variable.init, env, type); if (itype.constValue() != null) { return coerce(itype, type).constValue(); } else { return null; } } finally { deferredLintHandler.setPos(prevLintPos); } }
/** * Attribute a "lazy constant value". * @param env The env for the const value * @param initializer The initializer for the const value * @param type The expected type, or null * @see VarSymbol#setLazyConstValue */ public Object attribLazyConstantValue(Env<AttrContext> env, JCVariableDecl variable, Type type) { DiagnosticPosition prevLintPos = deferredLintHandler.setPos(variable.pos()); try { // Use null as symbol to not attach the type annotation to any symbol. // The initializer will later also be visited and then we'll attach // to the symbol. // This prevents having multiple type annotations, just because of // lazy constant value evaluation. memberEnter.typeAnnotate(variable.init, env, null, variable.pos()); annotate.flush(); Type itype = attribExpr(variable.init, env, type); if (itype.constValue() != null) { return coerce(itype, type).constValue(); } else { return null; } } finally { deferredLintHandler.setPos(prevLintPos); } }
public void visitVarDef(JCVariableDecl tree) { Env<AttrContext> localEnv = env; if ((tree.mods.flags & STATIC) != 0 || (env.info.scope.owner.flags() & INTERFACE) != 0) { localEnv = env.dup(tree, env.info.dup()); localEnv.info.staticLevel++; } attr.attribType(tree.vartype, localEnv); Scope enclScope = enter.enterScope(env); VarSymbol v = new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); tree.sym = v; if (tree.init != null) { v.flags_field |= HASINIT; if ((v.flags_field & FINAL) != 0 && tree.init.tag != JCTree.NEWCLASS) v.setLazyConstValue(initEnv(tree, env), log, attr, tree.init); } if (chk.checkUnique(tree.pos(), v, enclScope)) { chk.checkTransparentVar(tree.pos(), v, enclScope); enclScope.enter(v); } annotateLater(tree.mods.annotations, localEnv, v); v.pos = tree.pos; }
public void visitVarDef(JCVariableDecl tree) { Env<AttrContext> localEnv = env; if ((tree.mods.flags & STATIC) != 0 || (env.info.scope.owner.flags() & INTERFACE) != 0) { localEnv = env.dup(tree, env.info.dup()); localEnv.info.staticLevel++; } attr.attribType(tree.vartype, localEnv); Scope enclScope = enter.enterScope(env); VarSymbol v = new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); tree.sym = v; if (tree.init != null) { v.flags_field |= HASINIT; if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS) v.setLazyConstValue(initEnv(tree, env), log, attr, tree.init); } if (chk.checkUnique(tree.pos(), v, enclScope)) { chk.checkTransparentVar(tree.pos(), v, enclScope); enclScope.enter(v); } annotateLater(tree.mods.annotations, localEnv, v); v.pos = tree.pos; }
public void visitVarDef(JCVariableDecl tree) { Lint lintPrev = lint; lint = lint.augment(tree.sym); try{ boolean track = trackable(tree.sym); if (track && tree.sym.owner.kind == MTH) { newVar(tree); } if (tree.init != null) { scanExpr(tree.init); if (track) { letInit(tree.pos(), tree.sym); } } } finally { lint = lintPrev; } }
@Override public void visitVarDef(final JCVariableDecl tree) { DiagnosticPosition prevPos = deferPos; deferPos = tree.pos(); try { if (sym != null && sym.kind == Kinds.VAR) { // Don't visit a parameter once when the sym is the method // and once when the sym is the parameter. scan(tree.mods); scan(tree.vartype); } scan(tree.init); } finally { deferPos = prevPos; } }
@Override public void visitVarDef(final JCVariableDecl tree) { DiagnosticPosition prevPos = deferPos; deferPos = tree.pos(); try { if (sym != null && sym.kind == Kinds.VAR) { // Don't visit a parameter once when the sym is the method // and once when the sym is the parameter. scan(tree.mods); scan(tree.vartype); } scan(tree.init); } finally { deferPos = prevPos; } }
public void visitVarDef(JCVariableDecl tree) { boolean track = trackable(tree.sym); if (track && tree.sym.owner.kind == MTH) newVar(tree.sym); if (tree.init != null) { Lint lintPrev = lint; lint = lint.augment(tree.sym.attributes_field); try{ scanExpr(tree.init); if (track) letInit(tree.pos(), tree.sym); } finally { lint = lintPrev; } } }
public void visitVarDef(JCVariableDecl tree) { boolean track = trackable(tree.sym); if (track && tree.sym.owner.kind == MTH) newVar(tree.sym); if (tree.init != null) { Lint lintPrev = lint; lint = lint.augment(tree.sym.attributes_field); try{ scanExpr(tree.init); if (track) letInit(tree.pos(), tree.sym); } finally { lint = lintPrev; } } }
@Override public void visitVarDef(JCVariableDecl that) { if (that.sym.owner.kind == TYP) { chk.checkConflicts(that.pos(), that.sym, currentClass); } super.visitVarDef(that); }
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 void visitVarDef(JCVariableDecl tree) { boolean track = trackable(tree.sym); if (track && tree.sym.owner.kind == MTH) { newVar(tree); } if (tree.init != null) { scanExpr(tree.init); if (track) { letInit(tree.pos(), tree.sym); } } }
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); }
@Override public void visitVarDef(JCVariableDecl that) { if (that.sym.owner.kind == TYP) { chk.checkConflicts(that.pos(), that.sym, currentClass); } super.visitVarDef(that); }