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); }
/** Attribute a type argument list, returning a list of types. */ List<Type> attribTypes(List<JCExpression> trees, Env<AttrContext> env) { ListBuffer<Type> argtypes = new ListBuffer<Type>(); for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail) argtypes.append(chk.checkRefType(l.head.pos(), attribType(l.head, env))); return argtypes.toList(); }
/** Attribute the arguments in a method call, returning a list of types. */ List<Type> attribArgs(List<JCExpression> trees, Env<AttrContext> env) { ListBuffer<Type> argtypes = new ListBuffer<Type>(); for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail) argtypes.append(chk.checkNonVoid( l.head.pos(), types.upperBound(attribTree(l.head, env, VAL, Infer.anyPoly)))); return argtypes.toList(); }
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 visitAssert(JCAssert tree) { attribExpr(tree.cond, env, syms.booleanType); if (tree.detail != null) { chk.checkNonVoid(tree.detail.pos(), attribExpr(tree.detail, env)); } result = null; }
/** Attribute a type argument list, returning a list of types. */ List<Type> attribTypes(List<JCExpression> trees, Env<AttrContext> env) { ListBuffer<Type> argtypes = new ListBuffer<Type>(); for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail) argtypes.append(chk.checkRefType(l.head.pos(), attribType(l.head, env))); return argtypes.toList(); }
/** Unbox an object to a primitive value. */ JCExpression unbox(JCExpression tree, Type primitive) { Type unboxedType = types.unboxedType(tree.type); // note: the "primitive" parameter is not used. There muse be // a conversion from unboxedType to primitive. make_at(tree.pos()); Symbol valueSym = lookupMethod(tree.pos(), unboxedType.tsym.name.append(names.Value), // x.intValue() tree.type, List.<Type>nil()); return make.App(make.Select(tree, valueSym)); }
/** Check that each type is a reference type, i.e. a class, interface or array type * or a type variable. * @param trees Original trees, used for error reporting. * @param types The types to be checked. */ List<Type> checkRefTypes(List<JCExpression> trees, List<Type> types) { List<JCExpression> tl = trees; for (List<Type> l = types; l.nonEmpty(); l = l.tail) { l.head = checkRefType(tl.head.pos(), l.head); tl = tl.tail; } return types; }
public void visitAssert(JCAssert tree) { attribExpr(tree.cond, env, syms.booleanType); if (tree.detail != null) { chk.checkNonVoid(tree.detail.pos(), attribExpr(tree.detail, env)); } result = 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); }
/** Unbox an object to a primitive value. */ JCExpression unbox(JCExpression tree, Type primitive) { Type unboxedType = types.unboxedType(tree.type); // note: the "primitive" parameter is not used. There muse be // a conversion from unboxedType to primitive. make_at(tree.pos()); Symbol valueSym = lookupMethod(tree.pos(), unboxedType.tsym.name.append(names.Value), // x.intValue() tree.type, List.<Type>nil()); return make.App(make.Select(tree, valueSym)); }
@Override public void visitSelect(JCFieldAccess tree) { if (tree.selected.type.hasTag(CLASS)) { makeRef(tree.selected.pos(), tree.selected.type); } }
@Override public void visitSelect(JCFieldAccess tree) { if (tree.selected.type.hasTag(CLASS)) { makeRef(tree.selected.pos(), tree.selected.type); } }
public void visitAssert(JCAssert tree) { attribExpr(tree.cond, env, syms.booleanType); if (tree.detail != null) { chk.checkNonVoid(tree.detail.pos(), attribExpr(tree.detail, env)); } result = 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 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 visitAssert(JCAssert tree) { attribExpr(tree.cond, env, syms.booleanType); if (tree.detail != null) { chk.checkNonVoid(tree.detail.pos(), attribExpr(tree.detail, env)); } result = null; }
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); }
/** Attribute the arguments in a method call, returning a list of types. */ List<Type> attribArgs(List<JCExpression> trees, Env<AttrContext> env) { ListBuffer<Type> argtypes = new ListBuffer<Type>(); for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail) argtypes.append(chk.checkNonVoid( l.head.pos(), types.upperBound(attribTree(l.head, env, VAL, Infer.anyPoly)))); return argtypes.toList(); }