Bug 77388

Summary: [compiler] Reference to constructor includes space after closing parenthesis
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: Olivier_Thomann, vulcannis
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 74035    
Attachments:
Description Flags
This patch to fixes the problem... none

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