Bug 77388 - [compiler] Reference to constructor includes space after closing parenthesis
Summary: [compiler] Reference to constructor includes space after closing parenthesis
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 79239 (view as bug list)
Depends on:
Blocks: 74035
  Show dependency tree
 
Reported: 2004-11-01 11:43 EST by Markus Keller CLA
Modified: 2004-12-14 15:28 EST (History)
2 users (show)

See Also:


Attachments
This patch to fixes the problem... (864 bytes, patch)
2004-11-24 05:56 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2004-11-01 11:43:28 EST
I200411010800 (probably already in 2.1.2, see bug 47418)

class MyClass {
	MyClass(int a, int b) {	}
	void take(MyClass mc) { }
	void run() {
		take( new MyClass(1, 2) ); // space in ") )" is in match 
	}
}

- Search for references to constructor MyClass(int a, int b).
=> Result is "new MyClass(1, 2) " (including the space!)
=> Expected: "new MyClass(1, 2)"

This leads to a problem when we try to find the ASTNode for this SearchMatch.
Comment 1 Frederic Fusier CLA 2004-11-24 05:47:49 EST
This is not a search bug while reporting the match. Match length comes from the
compiler ASTNode AllocationExpression which matches the pattern.
Comment 2 Frederic Fusier CLA 2004-11-24 05:56:56 EST
Created attachment 16094 [details]
This patch to fixes the problem...

Just store rParenPos instead of scanner.currentPosition-1 while consuming
ClassBodyopt...
Comment 3 Markus Keller CLA 2004-11-24 06:09:58 EST
So this is maybe the same as bug 79239.
Comment 4 Frederic Fusier CLA 2004-11-24 07:01:10 EST
*** Bug 79239 has been marked as a duplicate of this bug. ***
Comment 5 Frederic Fusier CLA 2004-11-24 07:51:54 EST
Fixed.

Now AllocationExpression rightly lengthes to its own closing parenthesis.

[jdt-core-internal]
Test cases added JavaSearchTest#testConstructorReferenceBug77388()
Comment 6 Frederic Fusier CLA 2004-11-24 07:52:52 EST
Olivier, may you verify that this fix is OK please, thx?
Comment 7 Olivier Thomann CLA 2004-11-24 11:45:04 EST
Verified.
Comment 8 Olivier Thomann CLA 2004-12-14 15:28:55 EST
Verified in 200412140800