2518 List<Type> bs = types.getBounds(a); |
2518 List<Type> bs = types.getBounds(a); |
2519 if (tree.bounds.nonEmpty()) { |
2519 if (tree.bounds.nonEmpty()) { |
2520 // accept class or interface or typevar as first bound. |
2520 // accept class or interface or typevar as first bound. |
2521 Type b = checkBase(bs.head, tree.bounds.head, env, false, false, false); |
2521 Type b = checkBase(bs.head, tree.bounds.head, env, false, false, false); |
2522 boundSet.add(types.erasure(b)); |
2522 boundSet.add(types.erasure(b)); |
2523 if (b.tag == TYPEVAR) { |
2523 if (b.isErroneous()) { |
|
2524 a.bound = b; |
|
2525 } |
|
2526 else if (b.tag == TYPEVAR) { |
2524 // if first bound was a typevar, do not accept further bounds. |
2527 // if first bound was a typevar, do not accept further bounds. |
2525 if (tree.bounds.tail.nonEmpty()) { |
2528 if (tree.bounds.tail.nonEmpty()) { |
2526 log.error(tree.bounds.tail.head.pos(), |
2529 log.error(tree.bounds.tail.head.pos(), |
2527 "type.var.may.not.be.followed.by.other.bounds"); |
2530 "type.var.may.not.be.followed.by.other.bounds"); |
2528 tree.bounds = List.of(tree.bounds.head); |
2531 tree.bounds = List.of(tree.bounds.head); |
2532 // if first bound was a class or interface, accept only interfaces |
2535 // if first bound was a class or interface, accept only interfaces |
2533 // as further bounds. |
2536 // as further bounds. |
2534 for (JCExpression bound : tree.bounds.tail) { |
2537 for (JCExpression bound : tree.bounds.tail) { |
2535 bs = bs.tail; |
2538 bs = bs.tail; |
2536 Type i = checkBase(bs.head, bound, env, false, true, false); |
2539 Type i = checkBase(bs.head, bound, env, false, true, false); |
2537 if (i.tag == CLASS) |
2540 if (i.isErroneous()) |
|
2541 a.bound = i; |
|
2542 else if (i.tag == CLASS) |
2538 chk.checkNotRepeated(bound.pos(), types.erasure(i), boundSet); |
2543 chk.checkNotRepeated(bound.pos(), types.erasure(i), boundSet); |
2539 } |
2544 } |
2540 } |
2545 } |
2541 } |
2546 } |
2542 bs = types.getBounds(a); |
2547 bs = types.getBounds(a); |