[ANN] Rearranger plugin version 4.4

A new version of the Rearranger plugin has been released, adding support for enumerations and more flexible sorting.

The plugin

- rearranges (reorders) class and class member declarations according to a user-specified order and/or method call hierarchy;
- generates section-marking comments;
- provides several controls for spacing within and between methods and classes; and
- permits the user to manually rearrange items.

Changes:

- Added ability to select enum classes in class rules. (This allows grouping enums with constants, for example.)
- Added ability to sort fields, methods and classes by modifiers, by type, and/or by name. Type and name may be designated case insensitive. (Modifiers are all lower case anyway.)
- Modified default configuration to include a new comment ("// --- ENUMERATIONS ---") and a rule to match enumerations. This effectively separates enumerations from other inner classes which continue to match another explicit rule in the default configuration.
- Improved detection of canonical methods (regardless of whether JDK is specified).
- Simplified appearance of rule specification dialogs.
- Fixed UI problem where static and abstract attribute checkboxes overlapped in inner class rule dialog.

This version appears to work with both IDEA 5.1 and Demetra. :)

8 comments
Comment actions Permalink

I meet this exception but don't know how to reproduce (on IDEA build 5383 with Rearranger 4.4.1)

0
Comment actions Permalink

The plugin is executing a line

= 0;]]>

and it appears to be failing inside the getText() method, which is a PsiElement method. This is IDEA code; I haven't any way of debugging it or knowing why the assertion was thrown. As far as I know, getText() should return an empty string if there is no text associated with the PsiElement. Anybody from JetBrains care to investigate?

t800t8, how often does it occur? Does it only happen when you rearrange a particular file?

-Dave

0
Comment actions Permalink

Dave, I only meet it one time. And don't know how to reproduce.

0
Comment actions Permalink

Hello Dave,

DK> The plugin is executing a line
DK>
DK>

 superMethod.getModifierList().getText().indexOf("abstract") >=
DK> 0;]]>

DK>
DK> and it appears to be failing inside the getText() method, which is a
DK> PsiElement method. This is IDEA code; I haven't any way of debugging
DK> it or knowing why the assertion was thrown. As far as I know,
DK> getText() should return an empty string if there is no text
DK> associated with the PsiElement. Anybody from JetBrains care to
DK> investigate?

In this case, the super method is in a compiled class, and the exception
is related to generating the decompiled text for it. It happens once in a
while, we don't know how to reproduce it, and it's definitely not the plugin's
fault.

However, it's really much more efficient to call getModifierList().hasModifierProperty(PsiModifier.ABSTRACT)
instead of the getText().indexOf().

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Thanks, Dmitry. I'll use hasModifierProperty(); didn't realize it existed.

0
Comment actions Permalink

With some generic classes I get a rearranger warning. Attached you'll find a
screenshot with the the warning and a small example class.

Thanks for the excellent plug-in.

Tom



Attachment(s):
rearranger-warning.png
rearranger-config.zip
0
Comment actions Permalink

Tom,

Try version 4.5, just uploaded.

0
Comment actions Permalink

Thanks, Dave, the bug is fixed. :)

Tom

0

Please sign in to leave a comment.