Bug 107110

Summary: IMethodBinding.isSubsignature not yet correctly implemented
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.2   
Target Milestone: 3.2 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Martin Aeschlimann CLA 2005-08-16 08:43:10 EDT
20050816 HEAD

I added a new test 'MethodOverrideTest' to test our implementation of
isSubignature but for IMethod.
The results are compared the IMethodBinding.isSubsignature, which seems to not
correctly implemented yet.

In MethodOverrideTest (org.eclipse.jdt.ui.tests) turn DEBUG_SHOWRESULTS to true
to see the problems.
Comment 1 Jerome Lanneluc CLA 2005-08-25 11:24:47 EDT
Can you please give more info on what the problem is, what you expect, and how
to reproduce it ? When turning the flag on, I see a lot of things printed to the
console, but I don't know how to interpret those.
Comment 2 Martin Aeschlimann CLA 2005-08-27 14:10:13 EDT
test1.B.tp1_xoo2() - test1.A.tp1_xoo2() (tp1_xoo2())
    IMethodBinding.overrides(): false
    IMethodBinding.isSubsignature(): true
    MethodOverrideTester.isSubsignature(): false
    Bindings.isSubsignature(): false
    Override Annotation: false

The output shows the named API's result when testing the two methods mentioned
on the first line.  See the tests for the full method signatures, search for the
method names (e.g. 'tp1_xoo2()').
So e.g. in this example IMethodBinding.isSubsignature() returns true, but
shouldn't (the type parameters don't match).
MethodOverrideTester is our implementation working on IMethods (IJavaElement)
Bindings.isSubsignature() is Markus' implementation of 'isSubsignature'. 
Override Annotation is using the @Override annotation to see what the compiler
thinks.

Our goal would be to remove Bindings.isSubsignature() and only use jdt.core's
IMethodBinding.isSubsignature().

Maybe Markus can help until I'm back.

Comment 3 Jerome Lanneluc CLA 2005-09-08 07:45:53 EDT
What is the sources of the cus of these 2 methods ?
Comment 4 Markus Keller CLA 2005-09-08 10:02:26 EDT
It's the source in testOverrideMethodTypeParams1().

The relevant parts for the problem of comment 2 are these:

package test1;
public class A<S> {
    public void tp1_xoo2() {}
}
class B extends A<String> {
    @Override public <X> void tp1_xoo2() {}
}

B#<X>tp1_xoo2() is not a subsignature of A<String>#tp1_xoo2(), since the second
 has no method type parameter.

I've added a debug statement System.out.println("--- " + getName() + " ---"); to
make it easier to find out which test produced which output.
Comment 5 Jerome Lanneluc CLA 2005-09-09 08:38:46 EDT
Thanks Markus. I understand the problem now.
Comment 6 Jerome Lanneluc CLA 2005-09-09 09:18:51 EDT
Changed MethodBinding#isSubSignature(...) to check type parameters as well.
Added regression test CompatibilityRulesTests#test031()
Comment 7 Olivier Thomann CLA 2005-09-20 13:29:44 EDT
Verified in I20050920-0010 for 3.2M2
Comment 8 Olivier Thomann CLA 2005-09-20 13:30:21 EDT
I modified the ASTView to show the isSubsignature when comparing IMethodBinding
in the comparison tray.