Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 122981

Summary: [convert local] Comments Eaten When Field Created
Product: [Eclipse Project] JDT Reporter: Shaun Skelton <shaun>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Shaun Skelton CLA 2006-01-06 16:58:25 EST
Eclipse 3.2 M4

When refactoring a local variable to a field, comments above seem to be eaten.

Procedure:
-Create Local variable with a block comment above

i.e 
/**
* Comment
*/

ResourceManager resource = ...

-Select and right-click
-Refactor -> Convert Local Variable to Field
-Block Comment should dissapear
Comment 1 Martin Aeschlimann CLA 2006-01-10 12:39:10 EST
In the example you give, the comment is not associated with the local (empty line in between) and will not be touched. So no problem there.
But without empty line you're right. The created field should get the comment that was associated with the VariableDeclarationFragment before.

This could be solved with a trick to simply move the VariableDeclarationFragment (instead of creating a FielDeclaration)
Comment 2 Deepak Azad CLA 2011-02-09 09:11:44 EST

*** This bug has been marked as a duplicate of bug 66457 ***