It Usually Begins with javac
While you can't overlook the fact that the standard Java compiler
javac
from Sun includes a lot of error
checking that is mandated by the Java language, you can easily miss the
fact that it has a bunch of extra checking that is yours for the asking.
Simply add the command-line option -Xlint
and you will see a number of additional
warnings. You can optionally append a comma-separated list of categories
to this option, as shown in the "javac Xlint options" table—for example,
-Xlint:deprecation,unchecked
will run
the standard compiler with extra details on use of deprecated code and
unchecked type conversions.
javac -Xlint options
Option | Meaning |
---|---|
| Enable all optional
warnings; default if |
| Disable all optional
warnings; default if |
| Enable/disable warnings about deprecated code, code that is no longer a recommended part of the API. |
| Enable/disable detailed warnings about unchecked type conversions. |
| Enable/disable warnings
about case labels that should be preceded by |
| Enable/disable warnings
about missing/unreadable |
| Enable/disable warnings about missing "serial version unique identifiers" (discussed in the section "Enabling Useful Warnings" under Eclipse). ... |
Get Checking Java Programs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.