Community
Participate
Working Groups
Platform: Eclipse 1.2.1 Build id: 200306271545. Assuming the following interfaces/classes: ============================================= public interface ObjectAlgorithm { void operate(Object pObject); } public interface DoubleAlgorithm extends ObjectAlgorithm { void operate(Double pDouble); } public abstract class AbstractDoubleAlgorithm implements DoubleAlgorithm { public void operate(Object pObject) { operate((Double)pObject); } // uncomment the next line for correct 1.4 operation // public abstract void operate(Double pDouble); } public class ConcreteDoubleAlgorithm extends AbstractDoubleAlgorithm { public void operate(Double pDouble) { System.out.println("method correctly invoked."); } } ============================================= The following line of code causes a stack overflow: ((ObjectAlgorithm)(new ConcreteDoubleAlgorithm())).operate(new Double(0)); Uncommenting the marked line above (for obvious reasons) clears up the problem. This problem seesm similar to bug 30856, but not quite the same. Thanks for any help!
Reproduced in 1.4 compliant mode in build 20030717.
In 1.4 mode, we incorrectly bind message send in AbstractDoubleAlgorithm public void operate(Object pObject) { operate((Double)pObject); ---> bound to #operate(Object) instead of #operate(Double) }
In 1.4 mode, since AbstractDoubleAlgorithm doesn't get default abstract operate (Double) for free, our lookup algorithm got fooled into thinking operate (Object) was good enough, causing the recursion. It should still have considered inherited default abstracts with better match. Scope.findMethod was wrong, misplaced closing curly brace. Fixed, added compliance regression tests.
Still have an issue on following variation, with extra signature operate(X): public class X extends AbstractDoubleAlgorithm { public static void main(String[] args) { ((ObjectAlgorithm)(new X())).operate(new Double(0)); } public void operate(Double pDouble) { System.out.println("method correctly invoked."); } } abstract class AbstractDoubleAlgorithm implements DoubleAlgorithm { public void operate(Object pObject) { operate((Double)pObject); } public void operate(X x) { } } interface DoubleAlgorithm extends ObjectAlgorithm { void operate(Double pDouble); } interface ObjectAlgorithm { void operate(Object pObject); }
Fixed last scenario as well.
Verified.
Candidate for 2.1.2
Verified with build 2.1.2 RC1
Verified with build 2.1.2 RC2