提交 d5b18e1e 编写于 作者: S sadayapalam

8080726: Redundant error message on private abstract interface method with body.

Reviewed-by: mcimadamore
上级 13e8c3e3
......@@ -2749,7 +2749,7 @@ public class Types {
Scope s = c.members();
for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
if (sym.kind == MTH &&
(sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
(sym.flags() & (ABSTRACT|IPROXY|DEFAULT|PRIVATE)) == ABSTRACT) {
MethodSymbol absmeth = (MethodSymbol)sym;
MethodSymbol implmeth = absmeth.implementation(impl, this, true);
if (implmeth == null || implmeth == absmeth) {
......
......@@ -985,7 +985,7 @@ public class Attr extends JCTree.Visitor {
if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
!relax)
log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
} else if ((tree.sym.flags() & ABSTRACT) != 0 && !isDefaultMethod) {
} else if ((tree.sym.flags() & (ABSTRACT|DEFAULT|PRIVATE)) == ABSTRACT) {
if ((owner.flags() & INTERFACE) != 0) {
log.error(tree.body.pos(), "intf.meth.cant.have.body");
} else {
......
/*
* @test /nodynamiccopyright/
* @bug 8080726
* @summary Redundant error message on private abstract interface method with body.
* @compile/fail/ref=Private10.out -XDrawDiagnostics Private10.java
*/
public class Private10 {
interface I {
private abstract void foo() {}
}
class C {
private abstract void foo() {}
}
}
Private10.java:11:31: compiler.err.illegal.combination.of.modifiers: abstract, private
Private10.java:14:31: compiler.err.illegal.combination.of.modifiers: abstract, private
2 errors
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册