Rearranger ignores name matching settings?

Hi there,

Is anyone else seeing this? It seems that the rearranger plugin misses the
name mathing criteria.

For instance, I have a rule that specifies the toString method to be placed
after the getters and setters, but the rule is ignored.
Another rule for static methods whose names match 'create' is also ignored.

Thx,
Andrei



3 comments
Comment actions Permalink

Hi Andrei,

What you are seeing might happen if a previous rule picks up your toString or 'create' method. For example, if your rules are:

then the public toString() method matches the first rule (all public methods) and is moved there. Put another way, there is no priority or precedence of rules; they're just taken in order, top to bottom.

To avoid that behavior in the current version of Rearranger, you'd have to change the first rule to

I've got another request to allow users to prioritize rules, so that you could specify that (using the example above) methods matching rule 3 are identified first, then getter/setters (rule 2), then public methods (rule 1). The method matching would be done in prioritized order, but the rearranged file is in order of the rules.

Then again, maybe it's a bug! :)

If what I said above doesn't seem to apply to your rules, let me know!

-Dave

0
Comment actions Permalink

Hi Dave,

That was it, the "All public methods" rule was catching it first. I guess I
was expecting the rules to be traversed in sequence, and the last one to
have the final say (the toString rule being the last one, it would override
any other decisions taken until then).

The priority stuff would take care of this (when/if implemented), until then
I'll go ahead with the workaround, it gets the job done.

Thanks for a great plugin,
Andrei


"Dave Kriewall" <no_mail@jetbrains.com> wrote in message
news:22085642.1073679095237.JavaMail.itn@is.intellij.net...

What you are seeing might happen if a previous rule picks up your toString

or 'create' method. For example, if your rules are:

All public methods > All getter/setter methods > All methods whose names match "toString" > ]]>
then the public toString() method matches the first rule (all public

methods) and is moved there. Put another way, there is no priority or
precedence of rules; they're just taken in order, top to bottom.
>

To avoid that behavior in the current version of Rearranger, you'd have to

change the first rule to
>


0
Comment actions Permalink

Hi Andrei,

Try version 1.8. Rules can now be prioritized; should simplify your rules.

-Dave

0

Please sign in to leave a comment.