Community
Participate
Working Groups
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.
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.
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.
What is the sources of the cus of these 2 methods ?
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.
Thanks Markus. I understand the problem now.
Changed MethodBinding#isSubSignature(...) to check type parameters as well. Added regression test CompatibilityRulesTests#test031()
Verified in I20050920-0010 for 3.2M2
I modified the ASTView to show the isSubsignature when comparing IMethodBinding in the comparison tray.