1 JSTYLE(1ONBLD) illumos Build Tools JSTYLE(1ONBLD) 2 3 4 5 NAME 6 jstyle - check for some common stylistic errors in Java source files 7 8 SYNOPSIS 9 jstyle [-chptvC] [file...] 10 11 DESCRIPTION 12 jstyle inspects Java source files (*.java) for common stylistic errors. 13 It is similar to cstyle(1ONBLD) in that it attempts to check for the 14 style documented in /shared/ON/general_docs/cstyle.ms.pdf, although by 15 necessity is modified to work with Java-specific constructs. Note that 16 there is much in that document that cannot be checked for; just because 17 your code is jstyle(1ONBLD) clean does not mean that you've followed 18 Sun's Java style. Caveat emptor. 19 20 OPTIONS 21 The following options are supported: 22 23 -c Check continuation line indentation inside of functions. Sun's C 24 style states that all statements must be indented to an appropriate 25 tab stop, and any continuation lines after them must be indented 26 exactly four spaces from the start line. This option enables a 27 series of checks designed to find contination line problems within 28 functions only. 29 30 -h Performs heuristic checks that are sometimes wrong. Not generally 31 used. 32 33 -p Performs some of the more picky checks. You should generally use 34 this. 35 36 -t Insists on indentation with tabs. Because of the depth of nested 37 blocks that Java requires, and the commonality of long identifiers, 38 tab indentation in Java code is not always useful, assuming that 39 tabs are fixed at eight columns and that maximum line length is 40 fixed at eighty columns, so this option is not on by default. If 41 you choose to consider tabs to be four columns wide (not acceptable 42 for ON), or are writing simple enough code that the nesting is not 43 very deep, this option might be useful. Otherwise, avoid it. 44 45 -v Verbose output; includes the text of the line of error. 46 47 -C Ignore errors in header comments (i.e., block comments starting in 48 the first column). Not generally used. 49 50 NOTES 51 The jstyle rule for the OS/Net consolidation is that all new files must 52 be -p clean. For existing files, the following invocations are run 53 against both the old and new files: 54 55 jstyle file 56 57 jstyle -p file 58 59 If the old file gave no errors for one of the invocations, the new file 60 must also give no errors. This way, files cannot become unclean. 61 62 BUGS 63 jstyle(1ONBLD) cannot disambiguate Java generic type parameters or 64 arguments that span multiple lines from relational operators. For 65 example: 66 67 private class Foo<A extends Bar, 68 B extends Bar> { ... 69 70 is flagged as two lines with missing spaces around relational 71 operators. 72 73 74 75 November 22, 2005 JSTYLE(1ONBLD)