Menu

#170 Compilation can fail after re-ordering of 'static's

open
5
2004-08-02
2004-08-02
Anonymous
No

Using JPrettyPrinter (and the default .settings file) to
format a class that contains the following static
references will cause compilation errors thereafter:

private static String DOG = new String("dog");
public static String K9S = new String(DOG + "S");

The lines will be sorted by the protection modifier and
the 'public' constant will be defined first. Compilation
then fails due to forward referencing of the static 'DOG'
variable.

Since it is impossible to know in advance which
protection modifiers will be used with which static
variables, the only solution is turn-off this type of
sorting (i.e. comment out the 'sort.3=Protection(public)'
setting).

Submitted by: mwestacott@companieshouse.gov.uk

Discussion


Log in to post a comment.

Auth0 Logo