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

Reviewed-by: mcimadamore
This commit is contained in:
Srikanth Adayapalam 2015-05-27 11:27:42 +05:30
parent 81ae8feaed
commit 385f5d800a
4 changed files with 21 additions and 2 deletions

View File

@ -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) {

View File

@ -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 {

View File

@ -0,0 +1,16 @@
/*
* @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() {}
}
}

View File

@ -0,0 +1,3 @@
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