Bug in Move Line?

I am using 12.1.2 on XP and I am seeing a minor issue with the move line command.

If I have the cursor focus sit on the very last brace of my java class, move that brace up one line with the keyboard shortcut, all the imports from the top of the file gets moved to the bottom of the class.

The reason why I am moving that last brace up is just to clear some empty lines, instead of just going to that line and deleting it.


Hi Gary,

That is expected behavior because basically your file has two sections at that level - 'imports section' and 'class section'. If your caret is located at the line with closing class bracket, it's just moved up, i.e. swaps positions with 'imports section'. You can observe the same behavior when, for example, the caret is located at the line where a method is defined. 'Move up/down' action effectively moves the method up/down then.



Thanks for the explanation, I was use to Eclipse where it literraly just move lines, without awareness of scope.


There are two types of actions, "Move statement up/down" and "Move line up/down", the second one does the thing you want.


Please sign in to leave a comment.