Community
Participate
Working Groups
I20050118-1015 Search for References to methods/constructors: The source ranges sometimes include parameter lists (e.g. for MethodInvocations, ClassInstanceCreations), and sometimes don't (e.g. for MethodRefs, EnumConstantDeclarations). Is there a rationale behind these differences? If not, could the ranges be made homegenous (and documented in SearchPattern)?
Fixed. I've described selection behavior in complete document attached with bug 81377 and have to figure out how to put document it in eclipse... [jdt-core-internal] No test case added. Only existing ones modified to match described behavior.
Frederic, this bug was not about generic type parameters, but about the "old" method parameters. For example, when searching for occurrences of method m in the code below, some of the matches include the parameter list (in parentheses) and others don't: package p; import static p.A.m; /** * @see A#m(int) */ class A { static void m(int i) { p.A.m(i); } } For AST-based refactorings, we have to map search results back to ASTNodes. This is e.g. done in ChangeSignatureRefactoring#createOccurrenceUpdate(..): the ASTNode is the first node that encloses a SearchMatch's source range. The code there is specially tailored to the current behavior of the search engine, but I would like to have a more uniform mapping. I think it's also strange for other users of the search engine, that the parameter list is sometimes included and sometimes it's not.
Only happens for methods/constructors references in Javadoc (see your example)
Markus, fix is ready but have some impact on JDT-UI refactoring tests. Following tests fail in ChangeSignatureTests: - testAll58 - testAll59 - testAll60 - testEnum02 - testVararg05 If I modify ChangeSignatureRefactoring.createOccurenceUpdate method (see patch I'll attach later), then all these tests are OK. Let me know when you'll be able to modify these tests then I'll release this fix, thx
Created attachment 18487 [details] Patch which fixes this bug Apply this patch in HEAD stream on org.eclipse.jdt.core project...
Created attachment 18488 [details] Patch which fixes JDT/UI refactoring failing tests This patch was made on top of org.eclipse.jdt.ui project, version v20050301-0800.
Frederic, I released a workaround, such that Change Method Signature doesn't care about parameter inclusion. You can release your patch whenever you like. Do I see that right, that method declarations and references to enum constructors won't include the parameters list? E.g. search for references to Color(int): enum Color { RED, GREEN(), BLUE(17), PINK(1) {/*anon*/}; Color() {} Color(int i) {} } -> the range is only "BLUE", not "BLUE(17)"
Fixed. Now contructor/method references in javadoc also include parameters list. [jdt-core-internal] Changes done in JavadocParser.createMethodReference(...) Existing tests modified + test case added in JavaSearchBugsTests
Verified in I20050330-0500
Unfortunately, I missed comment 7 and didn't fix this specific issue. I've opened a new bug for it: bug 89686...