提交 a31fc2dd 编写于 作者: J jfranck

7199925: Separate compilation breaks check that elements have a default for...

7199925: Separate compilation breaks check that elements have a default for the containing annotation
Reviewed-by: jjg, mcimadamore
上级 ffc9ce1e
......@@ -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=\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册