Community
Participate
Working Groups
Build Identifier: 20110615-0604 Pushing down a method enables overloading of a private method changing program behavior Reproducible: Always Steps to Reproduce: 1. Create the classes: package p1; import p2.*; public class A { public long m(){ return new B().methodid_1(2); } public static void main(String[] args) { System.out.println(new B().methodid_0()); } } package p2; import p1.*; public class B extends A { private long methodid_1( int a){ return 1; } public long methodid_1( long a){ return 0; } public long methodid_0(){ return m(); } } 2. This program prints 0. Apply a push down method on m(): package p1; import p2.*; public class A { public static void main(String[] args) { System.out.println(new B().methodid_0()); } } package p2; import p1.*; public class B extends A { public long m(){ return new B().methodid_1(2); } private long methodid_1( int a){ return 1; } public long methodid_1( long a){ return 0; } public long methodid_0(){ return m(); } } 3. The behavior of the program changes. Now, the program prints 1.
*** This bug has been marked as a duplicate of bug 211755 ***