-Xlint and its variations - so many to choose from! 1st -Xlint:unchecked
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
-Xlint, naked without its ':unchecked' param!
-Xlint
....without the :unchecked option. A little naked the poor tool feels now. This effectively says to the compiler use the lint tool (via the -X property) and just call it without any parameters. This has the effect of calling lint and using all of its checks rather than, like in our case above for :unchecked, using just the generic checks/warnings (by passing through the 'unchecked' parameter to the lint tool.
-Xlint and all of :unchecked's many, many friends!
So then, what checks are possible? When calling -Xlint what is it that we are actually doing (besides popping up a huuuuuge amount of warnings in most cases). Well, calling -Xlint is effectively the same as passing in several parameters to the lint tool. What are these parameters....well Ive listed them below as to what it is that you can add to the -Xlint call as arguments to determine what checks the javac compiler should make when compiling the code and what warnings it should then report back on.-Xlint:{all,cast,deprecation,divzero,empty,unchecked,fallthrough,path,serial,finally,overrides}
Thats a lot of options. Here is some info about them from the javac compiler options page:
- -Xlint
- Enable all recommended warnings. In this release, all available warnings are recommended.
- -Xlint:none
- Disable all warnings not mandated by the Java Language Specification.
- -Xlint:-name
- Disable warning name, where name is one of the warning names supported for -Xlint:name, below.
- -Xlint:unchecked
- Give more detail for unchecked conversion warnings that are mandated by the Java Language Specification.
- -Xlint:path
- Warn about nonexistent path (classpath, sourcepath, etc) directories.
- -Xlint:serial
- Warn about missing
serialVersionUID
definitions on serializable classes. - -Xlint:finally
- Warn about
finally
clauses that cannot complete normally. - -Xlint:fallthrough
- Check switch blocks for fall-through cases and provide a warning message for any that are found. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to "fall through" from that case to the next case. For example, the code following the case 1 label in this switch block does not end with a break statement:
switch (x) { case 1: System.out.println("1"); // No break; statement here. case 2: System.out.println("2"); }
-Xlint:{all,cast,deprecation,divzero,empty,unchecked,fallthrough,path,serial,finally,overrides}-cast,-deprecation,-divzero,-empty,-unchecked,-fallthrough,-path,-serial,-finally,-overrides,none}Enable or disable specific warnings
http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#nonstandard
http://mark.koli.ch/2009/04/configuring-ant-to-use-javacs--xlintunchecked-option.html