463 // if no bounds are given, assume a single bound of |
463 // if no bounds are given, assume a single bound of |
464 // java.lang.Object. |
464 // java.lang.Object. |
465 types.setBounds(a, List.of(syms.objectType)); |
465 types.setBounds(a, List.of(syms.objectType)); |
466 } |
466 } |
467 } |
467 } |
|
468 } |
|
469 |
|
470 void attribBounds(List<JCTypeParameter> typarams, Env<AttrContext> env) { |
468 for (JCTypeParameter tvar : typarams) |
471 for (JCTypeParameter tvar : typarams) |
469 chk.checkNonCyclic(tvar.pos(), (TypeVar)tvar.type); |
472 chk.checkNonCyclic(tvar.pos(), (TypeVar)tvar.type); |
470 attribStats(typarams, env); |
473 attribStats(typarams, env); |
471 } |
|
472 |
|
473 void attribBounds(List<JCTypeParameter> typarams) { |
|
474 for (JCTypeParameter typaram : typarams) { |
474 for (JCTypeParameter typaram : typarams) { |
475 Type bound = typaram.type.getUpperBound(); |
475 Type bound = typaram.type.getUpperBound(); |
476 if (bound != null && bound.tsym instanceof ClassSymbol) { |
476 if (bound != null && bound.tsym instanceof ClassSymbol) { |
477 ClassSymbol c = (ClassSymbol)bound.tsym; |
477 ClassSymbol c = (ClassSymbol)bound.tsym; |
478 if ((c.flags_field & COMPOUND) != 0) { |
478 if ((c.flags_field & COMPOUND) != 0) { |
579 Lint lint = env.info.lint.augment(m.attributes_field, m.flags()); |
579 Lint lint = env.info.lint.augment(m.attributes_field, m.flags()); |
580 Lint prevLint = chk.setLint(lint); |
580 Lint prevLint = chk.setLint(lint); |
581 try { |
581 try { |
582 chk.checkDeprecatedAnnotation(tree.pos(), m); |
582 chk.checkDeprecatedAnnotation(tree.pos(), m); |
583 |
583 |
584 attribBounds(tree.typarams); |
584 attribBounds(tree.typarams, env); |
585 |
585 |
586 // If we override any other methods, check that we do so properly. |
586 // If we override any other methods, check that we do so properly. |
587 // JLS ??? |
587 // JLS ??? |
588 chk.checkOverride(tree, m); |
588 chk.checkOverride(tree, m); |
589 |
589 |
2685 |
2685 |
2686 // Validate annotations |
2686 // Validate annotations |
2687 chk.validateAnnotations(tree.mods.annotations, c); |
2687 chk.validateAnnotations(tree.mods.annotations, c); |
2688 |
2688 |
2689 // Validate type parameters, supertype and interfaces. |
2689 // Validate type parameters, supertype and interfaces. |
2690 attribBounds(tree.typarams); |
2690 attribBounds(tree.typarams, env); |
2691 chk.validateTypeParams(tree.typarams); |
2691 chk.validateTypeParams(tree.typarams); |
2692 chk.validate(tree.extending); |
2692 chk.validate(tree.extending); |
2693 chk.validate(tree.implementing); |
2693 chk.validate(tree.implementing); |
2694 |
2694 |
2695 // If this is a non-abstract class, check that it has no abstract |
2695 // If this is a non-abstract class, check that it has no abstract |