Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318509 - Navigation to constructor/method intertype broken if regular declaration with same number of args exists
Summary: Navigation to constructor/method intertype broken if regular declaration with...
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: UI (show other bugs)
Version: 2.0.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 2.1.0   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-30 14:02 EDT by Kris De Volder CLA
Modified: 2010-07-27 01:03 EDT (History)
2 users (show)

See Also:
andrew.eisenberg: review+


Attachments
zip of a source folder with small example (few classes and an aspect) (2.83 KB, application/zip)
2010-06-30 14:02 EDT, Kris De Volder CLA
no flags Details
mylyn/context/zip (339.35 KB, application/octet-stream)
2010-06-30 19:52 EDT, Kris De Volder CLA
no flags Details
patch fixing this bug + testcase (19.89 KB, patch)
2010-06-30 20:00 EDT, Kris De Volder CLA
andrew.eisenberg: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kris De Volder CLA 2010-06-30 14:02:59 EDT
Created attachment 173135 [details]
zip of a source folder with small example (few classes and an aspect)

When there are two constructors for a type, both with the same number of arguments but overloaded on type, one of the constructors defined in the class itself and the other one defined as a intertype member... when we navigate from a call to a constructor to its declaration we always get taken to the constructor in the class (even when we should be taken to the one in the aspect).

This doesn't seem to happen when the constructors have different numbers of arguments.

I am attaching a .zip file with a small example. 

In the method com.springsource,DeparmentTest.testDepartmentBean()

there are two calls to Deparment constructors one in an aspect and one in the class itself.
Comment 1 Kris De Volder CLA 2010-06-30 15:46:13 EDT
This bug is not restricted to constructors. I have verified... it also happens for ordinary methods.

The reason why it happens is that Java's selection finder does not bother to check the argument types when it only finds one method/constructor in the declaring type that has the same name and number of arguments as the selection.

AJDT's intertype finder explicitly assumes that if exactly one element is found by the java selection finder it must be correct and so it does not try to find ITDs.
Comment 2 Kris De Volder CLA 2010-06-30 19:52:41 EDT
Created attachment 173159 [details]
mylyn/context/zip

Mylin context for work on this bug
Comment 3 Kris De Volder CLA 2010-06-30 20:00:51 EDT
Created attachment 173160 [details]
patch fixing this bug + testcase

I also fixed a small bug in the findRegion method used across the other test cases. I pulled that bugfix up to a superclass so it is shared by all sub testcases that had replicated copies.

Luckily fixing the bug in that method, didn't actually cause any of the existing tests to fail :-)
Comment 4 Andrew Eisenberg CLA 2010-06-30 23:25:27 EDT
Thanks, Kris.  I will apply this patch when I return from vacation.
Comment 5 Kris De Volder CLA 2010-07-24 12:13:53 EDT
Did this patch ever get applied?
Comment 6 Andrew Eisenberg CLA 2010-07-24 18:42:59 EDT
Nope.  It is now.  Applied patch.  Thanks.