8080726: Redundant error message on private abstract interface method with body.
Reviewed-by: mcimadamore
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Fri May 22 16:44:49 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Wed May 27 11:27:42 2015 +0530
@@ -2749,7 +2749,7 @@
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) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Fri May 22 16:44:49 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Wed May 27 11:27:42 2015 +0530
@@ -985,7 +985,7 @@
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 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/private/Private10.java Wed May 27 11:27:42 2015 +0530
@@ -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() {}
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/private/Private10.out Wed May 27 11:27:42 2015 +0530
@@ -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