diff -r 6e0f31d61e56 -r 4788eb38cac5 src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Sat Nov 09 15:24:38 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Nov 11 09:47:46 2013 -0500 @@ -58,7 +58,6 @@ import static com.sun.tools.javac.code.Kinds.ERRONEOUS; import static com.sun.tools.javac.code.TypeTag.*; import static com.sun.tools.javac.code.TypeTag.WILDCARD; -import static com.sun.tools.javac.code.TypeTag.ARRAY; import static com.sun.tools.javac.tree.JCTree.Tag.*; /** This is the main context-dependent analysis phase in GJC. It @@ -806,44 +805,33 @@ Type t = tree.type != null ? tree.type : attribType(tree, env); - return checkBase(t, tree, env, classExpected, interfaceExpected, false, checkExtensible); + return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible); } Type checkBase(Type t, JCTree tree, Env env, boolean classExpected, - boolean interfacesOnlyExpected, - boolean interfacesOrArraysExpected, + boolean interfaceExpected, boolean checkExtensible) { if (t.isErroneous()) return t; - if (t.hasTag(TYPEVAR) && !classExpected && - !interfacesOrArraysExpected && !interfacesOnlyExpected) { + if (t.hasTag(TYPEVAR) && !classExpected && !interfaceExpected) { // check that type variable is already visible if (t.getUpperBound() == null) { log.error(tree.pos(), "illegal.forward.ref"); return types.createErrorType(t); } - } else if (classExpected) { + } else { t = chk.checkClassType(tree.pos(), t, checkExtensible|!allowGenerics); - } else { - t = chk.checkClassOrArrayType(tree.pos(), t, - checkExtensible|!allowGenerics); } - if (interfacesOnlyExpected && !t.tsym.isInterface()) { + if (interfaceExpected && (t.tsym.flags() & INTERFACE) == 0) { log.error(tree.pos(), "intf.expected.here"); // return errType is necessary since otherwise there might // be undetected cycles which cause attribution to loop return types.createErrorType(t); - } else if (interfacesOrArraysExpected && - !(t.tsym.isInterface() || t.getTag() == ARRAY)) { - log.error(tree.pos(), "intf.or.array.expected.here"); - // return errType is necessary since otherwise there might - // be undetected cycles which cause attribution to loop - return types.createErrorType(t); } else if (checkExtensible && classExpected && - t.tsym.isInterface()) { + (t.tsym.flags() & INTERFACE) != 0) { log.error(tree.pos(), "no.intf.expected.here"); return types.createErrorType(t); } @@ -855,12 +843,6 @@ chk.checkNonCyclic(tree.pos(), t); return t; } - //where - private Object asTypeParam(Type t) { - return (t.hasTag(TYPEVAR)) - ? diags.fragment("type.parameter", t) - : t; - } Type attribIdentAsEnumType(Env env, JCIdent id) { Assert.check((env.enclClass.sym.flags() & ENUM) != 0); @@ -3985,7 +3967,7 @@ Set boundSet = new HashSet(); if (bounds.nonEmpty()) { // accept class or interface or typevar as first bound. - bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false, false); + bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false); boundSet.add(types.erasure(bounds.head.type)); if (bounds.head.type.isErroneous()) { return bounds.head.type; @@ -4001,7 +3983,7 @@ // if first bound was a class or interface, accept only interfaces // as further bounds. for (JCExpression bound : bounds.tail) { - bound.type = checkBase(bound.type, bound, env, false, false, true, false); + bound.type = checkBase(bound.type, bound, env, false, true, false); if (bound.type.isErroneous()) { bounds = List.of(bound); }