< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java

Print this page

        

*** 1488,1498 **** public void visitForeachLoop(JCEnhancedForLoop tree) { Env<AttrContext> loopEnv = env.dup(env.tree, env.info.dup(env.info.scope.dup())); try { //the Formal Parameter of a for-each loop is not in the scope when ! //attributing the for-each expression; we mimick this by attributing //the for-each expression first (against original scope). Type exprType = types.cvarUpperBound(attribExpr(tree.expr, loopEnv)); chk.checkNonVoid(tree.pos(), exprType); Type elemtype = types.elemtype(exprType); // perhaps expr is an array? if (elemtype == null) { --- 1488,1498 ---- public void visitForeachLoop(JCEnhancedForLoop tree) { Env<AttrContext> loopEnv = env.dup(env.tree, env.info.dup(env.info.scope.dup())); try { //the Formal Parameter of a for-each loop is not in the scope when ! //attributing the for-each expression; we mimic this by attributing //the for-each expression first (against original scope). Type exprType = types.cvarUpperBound(attribExpr(tree.expr, loopEnv)); chk.checkNonVoid(tree.pos(), exprType); Type elemtype = types.elemtype(exprType); // perhaps expr is an array? if (elemtype == null) {
*** 3464,3474 **** } if (!env.info.attributionMode.isSpeculative && that.getMode() == JCMemberReference.ReferenceMode.NEW) { Type enclosingType = exprType.getEnclosingType(); if (enclosingType != null && enclosingType.hasTag(CLASS)) { ! // Check for the existence of an apropriate outer instance rs.resolveImplicitThis(that.pos(), env, exprType); } } if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) { --- 3464,3474 ---- } if (!env.info.attributionMode.isSpeculative && that.getMode() == JCMemberReference.ReferenceMode.NEW) { Type enclosingType = exprType.getEnclosingType(); if (enclosingType != null && enclosingType.hasTag(CLASS)) { ! // Check for the existence of an appropriate outer instance rs.resolveImplicitThis(that.pos(), env, exprType); } } if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
*** 4195,4205 **** case WILDCARD: throw new AssertionError(tree); case TYPEVAR: // Normally, site.getUpperBound() shouldn't be null. // It should only happen during memberEnter/attribBase ! // when determining the super type which *must* beac // done before attributing the type variables. In // other words, we are seeing this illegal program: // class B<T> extends A<T.foo> {} Symbol sym = (site.getUpperBound() != null) ? selectSym(tree, location, capture(site.getUpperBound()), env, resultInfo) --- 4195,4205 ---- case WILDCARD: throw new AssertionError(tree); case TYPEVAR: // Normally, site.getUpperBound() shouldn't be null. // It should only happen during memberEnter/attribBase ! // when determining the super type which *must* be // done before attributing the type variables. In // other words, we are seeing this illegal program: // class B<T> extends A<T.foo> {} Symbol sym = (site.getUpperBound() != null) ? selectSym(tree, location, capture(site.getUpperBound()), env, resultInfo)
*** 5168,5178 **** && (c.flags() & (Flags.ENUM | Flags.INTERFACE)) == 0 && !c.isAnonymous()) { checkSerialVersionUID(tree, c); } if (allowTypeAnnos) { ! // Correctly organize the postions of the type annotations typeAnnotations.organizeTypeAnnotationsBodies(tree); // Check type annotations applicability rules validateTypeAnnotations(tree, false); } --- 5168,5178 ---- && (c.flags() & (Flags.ENUM | Flags.INTERFACE)) == 0 && !c.isAnonymous()) { checkSerialVersionUID(tree, c); } if (allowTypeAnnos) { ! // Correctly organize the positions of the type annotations typeAnnotations.organizeTypeAnnotationsBodies(tree); // Check type annotations applicability rules validateTypeAnnotations(tree, false); }
*** 5478,5488 **** /** * Handle missing types/symbols in an AST. This routine is useful when * the compiler has encountered some errors (which might have ended up * terminating attribution abruptly); if the compiler is used in fail-over * mode (e.g. by an IDE) and the AST contains semantic errors, this routine ! * prevents NPE to be progagated during subsequent compilation steps. */ public void postAttr(JCTree tree) { new PostAttrAnalyzer().scan(tree); } --- 5478,5488 ---- /** * Handle missing types/symbols in an AST. This routine is useful when * the compiler has encountered some errors (which might have ended up * terminating attribution abruptly); if the compiler is used in fail-over * mode (e.g. by an IDE) and the AST contains semantic errors, this routine ! * prevents NPE to be propagated during subsequent compilation steps. */ public void postAttr(JCTree tree) { new PostAttrAnalyzer().scan(tree); }
< prev index next >