Summary: | Abstract class fails to invoke interface-defined method in 1.4 compliance mode. | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Patrick Linehan <plinehan> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.1 | ||
Target Milestone: | 2.1.2 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Patrick Linehan
2003-07-17 20:34:40 EDT
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 |