mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-25 07:09:55 +00:00
7199925: Separate compilation breaks check that elements have a default for the containing annotation
Reviewed-by: jjg, mcimadamore
This commit is contained in:
parent
8fbd614bf3
commit
1c489c5ec5
@ -514,22 +514,6 @@ public class Annotate {
|
||||
expectedType);
|
||||
fatalError = true;
|
||||
}
|
||||
|
||||
// validate that all other elements of containing type has defaults
|
||||
scope = targetContainerType.tsym.members();
|
||||
error = false;
|
||||
for(Symbol elm : scope.getElements()) {
|
||||
if (elm.name != names.value &&
|
||||
elm.kind == Kinds.MTH &&
|
||||
((MethodSymbol)elm).defaultValue == null) {
|
||||
log.error(pos,
|
||||
"invalid.containedby.annotation.elem.nondefault",
|
||||
targetContainerType,
|
||||
elm);
|
||||
containerValueSymbol = null;
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
fatalError = true;
|
||||
}
|
||||
|
||||
@ -2491,6 +2491,7 @@ public class Check {
|
||||
validateDocumented(t.tsym, s, pos);
|
||||
validateInherited(t.tsym, s, pos);
|
||||
validateTarget(t.tsym, s, pos);
|
||||
validateDefault(t.tsym, s, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2671,6 +2672,21 @@ public class Check {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void validateDefault(Symbol container, Symbol contained, DiagnosticPosition pos) {
|
||||
// validate that all other elements of containing type has defaults
|
||||
Scope scope = container.members();
|
||||
for(Symbol elm : scope.getElements()) {
|
||||
if (elm.name != names.value &&
|
||||
elm.kind == Kinds.MTH &&
|
||||
((MethodSymbol)elm).defaultValue == null) {
|
||||
log.error(pos,
|
||||
"invalid.containedby.annotation.elem.nondefault",
|
||||
container,
|
||||
elm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Is s a method symbol that overrides a method in a superclass? */
|
||||
boolean isOverrider(Symbol s) {
|
||||
if (s.kind != MTH || s.isStatic())
|
||||
|
||||
@ -292,7 +292,7 @@ compiler.err.invalid.containedby.annotation.value.return=\
|
||||
|
||||
# 0: type, 1: symbol
|
||||
compiler.err.invalid.containedby.annotation.elem.nondefault=\
|
||||
duplicate annotation, element {1} in containing annotation {0} does not have a default value
|
||||
containing annotation {0} does not have a default value for element {1}
|
||||
|
||||
# 0: symbol, 1: type, 2: symbol, 3: type
|
||||
compiler.err.invalid.containedby.annotation.retention=\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user