The following test case exposes a failure also detected by jacks test 8.1.1.1-default-abstract-9
==================== Tryit.java ====================
1 /*
2 * @test %W% %E%
3 * @bug 4686811
4 * @summary package private methods do not override across package boundary
5 * @author gafter
6 *
7 * @compile p1/A.java p1/C.java p2/B.java
8 */
==================== p1/A.java ====================
1 package p1;
2
3 public abstract class A {
4 abstract void f();
5 }
==================== p1/C.java ====================
1 package p1;
2 public abstract class C extends p2.B {
3 void f() {} // overrides noninherited A.f()
4 }
==================== p2/B.java ====================
1 package p2;
2
3 public abstract class B extends p1.A {
4 }
5
6 class D extends p1.C {
7 }
==================== Tryit.java ====================
1 /*
2 * @test %W% %E%
3 * @bug 4686811
4 * @summary package private methods do not override across package boundary
5 * @author gafter
6 *
7 * @compile p1/A.java p1/C.java p2/B.java
8 */
==================== p1/A.java ====================
1 package p1;
2
3 public abstract class A {
4 abstract void f();
5 }
==================== p1/C.java ====================
1 package p1;
2 public abstract class C extends p2.B {
3 void f() {} // overrides noninherited A.f()
4 }
==================== p2/B.java ====================
1 package p2;
2
3 public abstract class B extends p1.A {
4 }
5
6 class D extends p1.C {
7 }
- relates to
-
JDK-4362349 Cannot override abstract method in same package
- Closed