resultInfo = resultInfoCtor.newInstance( Attr.instance(inliner.getContext()), KindSelector.PCK, Type.noType); } catch (ReflectiveOperationException e) { throw new LinkageError(e.getMessage(), e);
private Symbol attribIdent(String name) { Attr attr = Attr.instance(context); TreeMaker tm = TreeMaker.instance(context); return attr.attribIdent(tm.Ident(getName(name)), compilationUnit); }
attribExpr(tree.encl, env)); attribIdentAsEnumType(env, (JCIdent)clazz) : attribType(clazz, env); int pkind = attribArgs(tree.args, localEnv, argtypesBuf); List<Type> argtypes = argtypesBuf.toList(); List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv); ResultInfo diamondResult = new ResultInfo(MTH, newMethodTemplate(resultInfo.pt, argtypes, typeargtypes), new Check.NestedCheckContext(resultInfo.checkContext) { @Override public void report(DiagnosticPosition _unused, JCDiagnostic details) { constructorType = checkId(tree, site, constructor, diamondEnv, tree.pos(), rsEnv, clazztype, argtypes, typeargtypes); if (cdef == null) { //do not check twice! tree.constructorType = checkId(tree, clazztype, tree.constructor, rsEnv, new ResultInfo(pkind, newMethodTemplate(syms.voidType, argtypes, typeargtypes))); if (rsEnv.info.lastResolveVarargs()) Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null); clazztype.getTypeArguments().nonEmpty() && findDiamonds) {
if (checkFirstConstructorStat(tree, env)) { int kind = attribArgs(MTH, tree.args, localEnv, argtypesBuf); argtypes = argtypesBuf.toList(); typeargtypes = attribTypes(tree.typeargs, localEnv); attribExpr(qualifier, localEnv, encl)); } else if (methName == names._super) { Type mpt = newMethodTemplate(resultInfo.pt, argtypes, typeargtypes); checkId(tree.meth, site, sym, localEnv, new ResultInfo(kind, mpt)); int kind = attribArgs(VAL, tree.args, localEnv, argtypesBuf); argtypes = argtypesBuf.toList(); typeargtypes = attribAnyTypes(tree.typeargs, localEnv); Type mpt = newMethodTemplate(resultInfo.pt, argtypes, typeargtypes); localEnv.info.pendingResolutionPhase = null; Type mtype = attribTree(tree.meth, localEnv, new ResultInfo(kind, mpt, resultInfo.checkContext)); ? ((JCFieldAccess) tree.meth).selected.type : env.enclClass.sym.type; restype = adjustMethodReturnType(qualifier, methName, argtypes, restype); result = check(tree, capture(restype), VAL, resultInfo);
attribExpr(tree.encl, env)); clazzid1 = make.at(clazz.pos).Select(make.Type(encltype), ((JCIdent) clazzid).name); tree.clazz.pos(), attribType(clazz, env), true); chk.validate(clazz); if (tree.encl != null) { List<Type> argtypes = attribArgs(tree.args, localEnv); List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv); tree.constructor = rs.resolveConstructor( tree.pos(), localEnv, clazztype, argtypes, typeargtypes); Type ctorType = checkMethod(clazztype, tree.constructor, localEnv, attribStat(cdef, localEnv); tree.args = tree.args.prepend(makeNullCheck(tree.encl)); argtypes = argtypes.prepend(tree.encl.type); tree.encl = null; owntype = clazztype; result = check(tree, owntype, VAL, pkind, pt); chk.validate(tree.typeargs);
if (checkFirstConstructorStat(tree, env)) { argtypes = attribArgs(tree.args, localEnv); typeargtypes = attribTypes(tree.typeargs, localEnv); attribExpr(qualifier, localEnv, site.getEnclosingType())); } else if (methName == names._super) { Type mpt = newMethTemplate(argtypes, typeargtypes); checkId(tree.meth, site, sym, localEnv, MTH, mpt, tree.varargsElement != null); argtypes = attribArgs(tree.args, localEnv); typeargtypes = attribTypes(tree.typeargs, localEnv); Type mpt = newMethTemplate(argtypes, typeargtypes); localEnv.info.varArgs = false; Type mtype = attribExpr(tree.meth, localEnv, mpt); if (localEnv.info.varArgs) assert mtype.isErroneous() || tree.varargsElement != null; result = check(tree, capture(restype), VAL, pkind, pt);
public void visitSwitch(JCSwitch tree) { Type seltype = attribExpr(tree.selector, env); if (c.pat != null) { if (enumSwitch) { Symbol sym = enumConstant(c.pat, seltype); if (sym == null) { log.error(c.pat.pos(), "enum.const.req"); Type pattype = attribExpr(c.pat, switchEnv, seltype); if (pattype.tag != ERROR) { if (pattype.constValue() == null) { hasDefault = true; attribStats(c.stats, caseEnv); caseEnv.info.scope.leave(); addVars(c.stats, switchEnv.info.scope);
? attr.attribBase(tree.extending, baseEnv, true, false, true) : ((tree.mods.flags & Flags.ENUM) != 0 && !target.compilerBootstrap(c)) ? attr.attribBase(enumBase(tree.pos, c), baseEnv, true, false, false) : (c.fullname == names.java_lang_Object) Type i = attr.attribBase(iface, baseEnv, false, true, true); if (i.tag == CLASS) { interfaces.append(i); attr.attribAnnotationTypes(tree.mods.annotations, baseEnv); if (hasDeprecatedAnnotation(tree.mods.annotations)) c.flags_field |= DEPRECATED; annotateLater(tree.mods.annotations, baseEnv, c); attr.attribTypeVariables(tree.typarams, baseEnv);
public void visitIf(JCIf tree) { attribExpr(tree.cond, env, syms.booleanType); attribStat(tree.thenpart, env); if (tree.elsepart != null) attribStat(tree.elsepart, env); chk.checkEmptyIf(tree); result = null; }
public void visitTypeCast(JCTypeCast tree) { Type clazztype = attribType(tree.clazz, env); Type exprtype = attribExpr(tree.expr, env, Infer.anyPoly); Type owntype = chk.checkCastable(tree.expr.pos(), exprtype, clazztype); if (exprtype.constValue() != null) owntype = cfolder.coerce(exprtype, owntype); result = check(tree, capture(owntype), VAL, pkind, pt); }
public void visitAssign(JCAssign tree) { Type owntype = attribTree(tree.lhs, env.dup(tree), varInfo); Type capturedType = capture(owntype); attribExpr(tree.rhs, env, owntype); result = check(tree, capturedType, VAL, resultInfo); }
public void visitConditional(JCConditional tree) { attribExpr(tree.cond, env, syms.booleanType); attribExpr(tree.truepart, env); attribExpr(tree.falsepart, env); result = check(tree, capture(condType(tree.pos(), tree.cond.type, tree.truepart.type, tree.falsepart.type)), VAL, pkind, pt); } //where
/** * For internal use only. This method will be * removed without warning. */ public Type parseType(String expr, TypeElement scope) { if (expr == null || expr.equals("")) throw new IllegalArgumentException(); compiler = JavaCompiler.instance(context); JavaFileObject prev = compiler.log.useSource(null); ParserFactory parserFactory = ParserFactory.instance(context); Attr attr = Attr.instance(context); try { CharBuffer buf = CharBuffer.wrap((expr+"\u0000").toCharArray(), 0, expr.length()); Parser parser = parserFactory.newParser(buf, false, false, false); JCTree tree = parser.parseType(); return attr.attribType(tree, (Symbol.TypeSymbol)scope); } finally { compiler.log.useSource(prev); } }
public void visitIndexed(JCArrayAccess tree) { Type owntype = types.createErrorType(tree.type); Type atype = attribExpr(tree.indexed, env); attribExpr(tree.index, env, syms.intType); if (types.isArray(atype)) owntype = types.elemtype(atype); else if (!atype.hasTag(ERROR)) log.error(tree.pos(), "array.req.but.found", atype); if ((pkind() & VAR) == 0) owntype = capture(owntype); result = check(tree, owntype, VAR, resultInfo); }
public void visitTypeTest(JCInstanceOf tree) { Type exprtype = chk.checkNullOrRefType( tree.expr.pos(), attribExpr(tree.expr, env)); Type clazztype = chk.checkReifiableReferenceType( tree.clazz.pos(), attribType(tree.clazz, env)); chk.checkCastable(tree.expr.pos(), exprtype, clazztype); result = check(tree, syms.booleanType, VAL, pkind, pt); }
public void visitIndexed(JCArrayAccess tree) { Type owntype = syms.errType; Type atype = attribExpr(tree.indexed, env); attribExpr(tree.index, env, syms.intType); if (types.isArray(atype)) owntype = types.elemtype(atype); else if (atype.tag != ERROR) log.error(tree.pos(), "array.req.but.found", atype); if ((pkind & VAR) == 0) owntype = capture(owntype); result = check(tree, owntype, VAR, pkind, pt); }
void attribBounds(List<JCTypeParameter> typarams) { for (JCTypeParameter typaram : typarams) { Type bound = typaram.type.getUpperBound(); if (bound != null && bound.tsym instanceof ClassSymbol) { ClassSymbol c = (ClassSymbol)bound.tsym; if ((c.flags_field & COMPOUND) != 0) { assert (c.flags_field & UNATTRIBUTED) != 0 : c; attribClass(typaram.pos(), c); } } } }
public void visitAnnotatedType(JCAnnotatedType tree) { Type underlyingType = attribType(tree.getUnderlyingType(), env); this.attribAnnotationTypes(tree.annotations, env); annotateType(tree, tree.annotations); result = tree.type = underlyingType; }
attribClass((ClassSymbol)st.tsym); attribClass((ClassSymbol)c.owner); log.error(env.tree.pos(), "enum.types.not.extensible"); attribClassBody(env, c);
attribClass((ClassSymbol)st.tsym); attribClass((ClassSymbol)c.owner); if (isSerializable(c.type)) { env.info.isSerializable = true; attribClassBody(env, c);