Community
Participate
Working Groups
Given the following class, if the cursor is placed in the "MISSING_DATA" symbol and then Refactor->Move is selected, and another class in the same package is chosen as the destination, both the comment before and after the declaration are selected, but only the comment before actually gets moved. The comment after the declaration (with all the equals signs) disappears. public class Main { // Should be the same as the number of processors in the machine public static final int NUM_THREADS = 4; // Used internally to represent missing data public static final int MISSING_DATA = Integer.MIN_VALUE; // =============================================================================================================================== /** * Run the Analyzer class on each pair of samples, collecting the results in a ResultAccumulator. Works in parallel across NUM_THREADS threads. * * @param locOffset * * @return Returns the results of the all-pairs comparison using the specified loci. */ public ResultAccumulator analyzeLocusPair() { /*...*/ } }
Again, without line-wrapping probs: public class Main { // Should be the same as the number of processors in the machine public static final int NUM_THREADS = 4; // Used internally to represent missing data public static final int MISSING_DATA = Integer.MIN_VALUE; // ================================================================= /** * Run the Analyzer class on each pair of samples, collecting the... * * @param locOffset * * @return Returns the results of the all-pairs comparison using the... */ public ResultAccumulator analyzeLocusPair() { /*...*/ } }
Yes, sorry, thats heuristic of the AST rewriter. We associate all comments that are directly above or below an element. As the element is removed, we also have to remove the following separator, otherwise separators would add up. Unhappy in the current scenarioo, but very hard to solve for all cases. No action planed.
*** Bug 151476 has been marked as a duplicate of this bug. ***
*** Bug 258377 has been marked as a duplicate of this bug. ***
*** Bug 264941 has been marked as a duplicate of this bug. ***
*** Bug 404856 has been marked as a duplicate of this bug. ***
Comment 2 is wrong. There's no reason why a move refactoring should drop comments. Either they stay at the old location or they move with the method.
Still a problem 12 years later. Refactoring should never drop comments. Here's a minimal testcase: // BEFORE: public class MoveFieldBug { public static class Class1 { // Comment before int field; // Comment after } public static class Class2 { } } // AFTER: (Right-click "field", then choose Refactor > Move > Class2) public class MoveFieldBug { public static class Class1 { } public static class Class2 { // Comment before int field; } }
It's an issue with ASTRewrite source ranges. See bug 46171 and bug 250142 for similar cases.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
This still occurs for 4.17.