Summary: | extract method trips up with generics and final variables | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Nikolay Metchev <nikolaymetchev> | ||||||
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | dirk_baeumer | ||||||
Version: | 3.1 | ||||||||
Target Milestone: | 3.1 RC3 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Nikolay Metchev
2005-06-10 09:48:04 EDT
Eclipse 3.1RC1, JDK 1.5.0_03 Still exists in RC2 candidate. The problem is that the underlying AST already contains three final modifiers for the declaration: final Container<Container<String>> c = (Container<Container<String>>) createContainer.getC(); Since the variable C is passed to the method the refactoring creates a new parameter and copies the modifiers from the declaration. The ASTFlattener then puts three final strings into the source code. Moving to JDT/Core. Philippe, IMO we should consider this for RC3 since none of the tooling currently expects doubled modifiers. Created attachment 22873 [details]
Screen shot showing the three final modifiers in the AST view
+1 for RC3 Dirk - pls append your vote. +1 for RC3. P.S. I forgot to mention that in the original code that this occured the end result was a little more drastic. There was a lot more than 3 final modifiers (around about 10). However even more bizzarely there were a few private modifiers scattered in between the final modifiers. I hope that by code expection it is possible to see how those things could have happend. If not please let me know and I will try and come up with a test case. Reproduced. I am investigating. Created attachment 22935 [details]
But in the AST converter parsing of modifiers
Proposed patch.
Fixed and released in HEAD. Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverter15Test.test190 Verified using build N20050616-0010 + JDT Core HEAD. |