2489 validateHasContainerFor(t.tsym, s, pos); |
2489 validateHasContainerFor(t.tsym, s, pos); |
2490 validateRetention(t.tsym, s, pos); |
2490 validateRetention(t.tsym, s, pos); |
2491 validateDocumented(t.tsym, s, pos); |
2491 validateDocumented(t.tsym, s, pos); |
2492 validateInherited(t.tsym, s, pos); |
2492 validateInherited(t.tsym, s, pos); |
2493 validateTarget(t.tsym, s, pos); |
2493 validateTarget(t.tsym, s, pos); |
|
2494 validateDefault(t.tsym, s, pos); |
2494 } |
2495 } |
2495 |
2496 |
2496 /** |
2497 /** |
2497 * Validate the proposed container 'containerFor' on the |
2498 * Validate the proposed container 'containerFor' on the |
2498 * annotation type symbol 's'. Report errors at position |
2499 * annotation type symbol 's'. Report errors at position |
2667 } |
2668 } |
2668 if (!currentElementOk) |
2669 if (!currentElementOk) |
2669 return false; |
2670 return false; |
2670 } |
2671 } |
2671 return true; |
2672 return true; |
|
2673 } |
|
2674 |
|
2675 private void validateDefault(Symbol container, Symbol contained, DiagnosticPosition pos) { |
|
2676 // validate that all other elements of containing type has defaults |
|
2677 Scope scope = container.members(); |
|
2678 for(Symbol elm : scope.getElements()) { |
|
2679 if (elm.name != names.value && |
|
2680 elm.kind == Kinds.MTH && |
|
2681 ((MethodSymbol)elm).defaultValue == null) { |
|
2682 log.error(pos, |
|
2683 "invalid.containedby.annotation.elem.nondefault", |
|
2684 container, |
|
2685 elm); |
|
2686 } |
|
2687 } |
2672 } |
2688 } |
2673 |
2689 |
2674 /** Is s a method symbol that overrides a method in a superclass? */ |
2690 /** Is s a method symbol that overrides a method in a superclass? */ |
2675 boolean isOverrider(Symbol s) { |
2691 boolean isOverrider(Symbol s) { |
2676 if (s.kind != MTH || s.isStatic()) |
2692 if (s.kind != MTH || s.isStatic()) |