John's Java pretty Printer [Insert image here]

 

The official download location is

http://cohesion.it.swin.edu.au/teamb/downloads/style.zip

but you can also get (an old version) it from here.

The source code is GNU and is available here (version 0.10).   This is no longer being actively developed but I am happy to provide info in anyone wants to use or develop it further.

You can view the readme here.

Known problems

I know of one problem which is quite difficult to fix.  If you have a } followed by a ; the two get separated and then when the functions get re-arranged, the ; gets separated.  This only causes problems when you have something like this:

class foo
{
    int bar()
    {
        return 0;
    }

    int a[4] = {1, 2, 3, 4};
}
It gets changed into something like this
class foo
{
    int a[4] = {1, 2, 3, 4}
    int bar()
    {
        return 0;
    }
    ;
}

(The ; after the array declaration is required but often gets separated).  The solution is to only run the style program once over the file and fix it by hand, or fix the program.  I guess the moral of the story is use a lexer and a parser to do this kind of thing and not something you hacked up your self.  But that in it's self is a lesson worth learning the hard way.

John.


Last modified 06/09/01
Maintained by John Newbigin