8080726: Redundant error message on private abstract interface method with body
Reviewed-by: mcimadamore
This commit is contained in:
parent
81ae8feaed
commit
385f5d800a
@ -2749,7 +2749,7 @@ public class Types {
|
|||||||
Scope s = c.members();
|
Scope s = c.members();
|
||||||
for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
|
for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
|
||||||
if (sym.kind == MTH &&
|
if (sym.kind == MTH &&
|
||||||
(sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
|
(sym.flags() & (ABSTRACT|IPROXY|DEFAULT|PRIVATE)) == ABSTRACT) {
|
||||||
MethodSymbol absmeth = (MethodSymbol)sym;
|
MethodSymbol absmeth = (MethodSymbol)sym;
|
||||||
MethodSymbol implmeth = absmeth.implementation(impl, this, true);
|
MethodSymbol implmeth = absmeth.implementation(impl, this, true);
|
||||||
if (implmeth == null || implmeth == absmeth) {
|
if (implmeth == null || implmeth == absmeth) {
|
||||||
|
@ -985,7 +985,7 @@ public class Attr extends JCTree.Visitor {
|
|||||||
if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
|
if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
|
||||||
!relax)
|
!relax)
|
||||||
log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
|
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) {
|
if ((owner.flags() & INTERFACE) != 0) {
|
||||||
log.error(tree.body.pos(), "intf.meth.cant.have.body");
|
log.error(tree.body.pos(), "intf.meth.cant.have.body");
|
||||||
} else {
|
} else {
|
||||||
|
@ -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() {}
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user