langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 6582 c7a4fb5a2f86
parent 6351 84c44db80d06
child 6587 344aa81a3b35
equal deleted inserted replaced
6581:f58f0ce45802 6582:c7a4fb5a2f86
   576                    JCTree tree,
   576                    JCTree tree,
   577                    Env<AttrContext> env,
   577                    Env<AttrContext> env,
   578                    boolean classExpected,
   578                    boolean classExpected,
   579                    boolean interfaceExpected,
   579                    boolean interfaceExpected,
   580                    boolean checkExtensible) {
   580                    boolean checkExtensible) {
       
   581         if (t.isErroneous())
       
   582             return t;
   581         if (t.tag == TYPEVAR && !classExpected && !interfaceExpected) {
   583         if (t.tag == TYPEVAR && !classExpected && !interfaceExpected) {
   582             // check that type variable is already visible
   584             // check that type variable is already visible
   583             if (t.getUpperBound() == null) {
   585             if (t.getUpperBound() == null) {
   584                 log.error(tree.pos(), "illegal.forward.ref");
   586                 log.error(tree.pos(), "illegal.forward.ref");
   585                 return types.createErrorType(t);
   587                 return types.createErrorType(t);
   593             // be undetected cycles which cause attribution to loop
   595             // be undetected cycles which cause attribution to loop
   594             return types.createErrorType(t);
   596             return types.createErrorType(t);
   595         } else if (checkExtensible &&
   597         } else if (checkExtensible &&
   596                    classExpected &&
   598                    classExpected &&
   597                    (t.tsym.flags() & INTERFACE) != 0) {
   599                    (t.tsym.flags() & INTERFACE) != 0) {
   598             log.error(tree.pos(), "no.intf.expected.here");
   600                 log.error(tree.pos(), "no.intf.expected.here");
   599             return types.createErrorType(t);
   601             return types.createErrorType(t);
   600         }
   602         }
   601         if (checkExtensible &&
   603         if (checkExtensible &&
   602             ((t.tsym.flags() & FINAL) != 0)) {
   604             ((t.tsym.flags() & FINAL) != 0)) {
   603             log.error(tree.pos(),
   605             log.error(tree.pos(),
  2843             else if (b.tag == TYPEVAR) {
  2845             else if (b.tag == TYPEVAR) {
  2844                 // if first bound was a typevar, do not accept further bounds.
  2846                 // if first bound was a typevar, do not accept further bounds.
  2845                 if (tree.bounds.tail.nonEmpty()) {
  2847                 if (tree.bounds.tail.nonEmpty()) {
  2846                     log.error(tree.bounds.tail.head.pos(),
  2848                     log.error(tree.bounds.tail.head.pos(),
  2847                               "type.var.may.not.be.followed.by.other.bounds");
  2849                               "type.var.may.not.be.followed.by.other.bounds");
  2848                     log.unrecoverableError = true;
       
  2849                     tree.bounds = List.of(tree.bounds.head);
  2850                     tree.bounds = List.of(tree.bounds.head);
  2850                     a.bound = bs.head;
  2851                     a.bound = bs.head;
  2851                 }
  2852                 }
  2852             } else {
  2853             } else {
  2853                 // if first bound was a class or interface, accept only interfaces
  2854                 // if first bound was a class or interface, accept only interfaces