Summary: | [code assist] autocomplete with anonymous classes does stop working | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | moormaster Mising name <moormaster> | ||||
Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | Olivier_Thomann, srikanth_sankaran | ||||
Version: | 3.4.1 | Flags: | Olivier_Thomann:
review+
|
||||
Target Milestone: | 3.6 M7 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
moormaster Mising name
2008-10-05 11:10:43 EDT
Ayush, please take a look. May have some common ground with bug# 292087 The parser doesnt seem to generate the completion node in this scenario. Commenting out either the try catch or the array initializer suddenly makes code assist work. Array initializer in a local declaration statement also doesnt seem to cause any grief. Will investigate further.Doesnt seem to have much in common with bug# 292087 This problem is not due to anonymous type per se. The above reported case is one of the random cases in which this problem can manifest. The problem is as follows: During the recovery parse when we're inside the array initializer, in CompletionParser.prepareForBlockStatements() called via AssistParser#resumeAfterRecovery(), we prematurely pop elements from elementKindStack and reach upto the enclosing block of the array initializer. So in the above reported case, when we are at the closing brace of the array initializer, the parser thinks that the brace closes the enclosing block instead, and thus pops it off from elementKindStack, even when it shud've popped off the array initializer instead. So we end up in the incorrect scope, and as the subsequent closing braces are encountered, the wrong element is popped each time. Thus, this problem can occur in cases like above, where there are a number of block delimiters. Notice that any modification in the above example makes content assist work again. Created attachment 163912 [details]
proposed fix v1.0 + regression tests
The fix basically prevents popping a block delimiter when the parser is looking inside the array initializer.
Added test CompletionTest#testBug24970
Looks good. I'll release later today. Released for 3.6M7. Regression test added in: CompletionTests#testBug249704 Verified for 3.6M7 using build I20100424-2000 |