Rearranger has stopped sorting methods and declarations.
I wrote a primitive Rearranger.
It parses declarations or method headers, and passes the fields to a
It then can decide what order it wants the declarations methods
based on the
While it is at it, it complains about caps violations.
It would be nice if the new arranger let you write a custom
comparator on some objects with the information about a given block
encoded as strings or enums, then it would be trivial for a Java
programmer to knock off his own comparator, one each for
classes/interfaces, methods/constructors, declarations/static blocks.
You would not need to invent some elaborate specification language
that would never cover everything. Doing it that way would save you a
lot of work, and would give complete flexibility to programmers.
The program is mostly a mess of switch statement assigning keywords
and primitives to sorting priorities.
private static char calcTypeOrder( final String typeName )
if ( ST.isEmpty( typeName ) )
switch ( typeName )
// we should have a class name of some sort e.g.
if ( Character.isUpperCase( typeName.charAt( 0 ) ) )
err.println( "Class name should start with a
capital letter: " + typeName );
} // end switch
You might do your own variant where byte, char, int, long all sort
mixed together by assigning them the same ordering letter.
Roedy Green Canadian Mind Products http://mindprod.com
Computers are like Old Testament gods; lots of rules and no mercy.
~ Joseph Campbell (born: 1904-03-26 died: 1987-10-31 at age: 83)