Java SE 5.0 added the -Xlint option to the compiler for spotting common code problems.
For example, if you compile with the command
javac -Xlint:fallthrough
then the compiler reports missing break statements in switch statements. (The term
“lint” originally described a tool for locating potential problems in C programs, and
is now generically applied to tools that flag constructs that are questionable but not
illegal.)
The following options are available:
-Xlint or -Xlint:all Carries out all checks
-Xlint:deprecation Same as -deprecation, checks for deprecated methods
-Xlint:fallthrough Checks for missing break statements in switch statements
-Xlint:finally Warns about finally clauses that cannot complete normally
-Xlint:none Carries out none of the checks
-Xlint:path Checks that all directories on the class path and source
path exist
-Xlint:serial Warns about serializable classes without serialVersionUID
(see Chapter 1 of Volume II)
-Xlint:unchecked Warns of unsafe conversions between generic and raw
types (see Chapter 12)
No comments:
Post a Comment