Xlint and Java Lint options

Source: Internet
Author: User

Java Lint Options

Options for the Java compiler include so-called standard options and non-standard options. Standard options are those that are supported in the current version of the development environment and will also be supported in future releases. Common standard options such as
-classpath and-D and so on.

Non-standard options are supported in the current version of the development environment, but are not guaranteed to be supported in the future. Non-standard options start with-X, like the Java Lint we care about here
The options start with-xlint. It is important to note that the simple option-X itself is a standard option for displaying information about non-standard options.

These options are non-standard options and are subject to change without prior notice.

~]$ Javac-x
-xlint enable recommended warnings//enabling recommended warnings
-xlint:{all,cast,classfile,deprecation,dep-ann,divzero,empty,fallthrough,finally,options,overrides,path, Processing,rawtypes,serial,static,try,unchecked,varargs,-cast,-classfile,-deprecation,-dep-ann,-divzero,-empty ,-fallthrough,-finally,-options,-overrides,-path,-processing,-rawtypes,-serial,-static,-try,-unchecked,- Varargs,none} Enable or disable specific warnings//enable or disable specific warnings
-xbootclasspath/p:<path> prepend to the bootstrap class path,//before the boot classpath
-xbootclasspath/a:<path> Append to the Bootstrap class path//After placing the boot classpath
-xbootclasspath:<path> override location of bootstrap class files//Overwrite boot class file locations
-djava.ext.dirs=<dirs> override location of installed extensions//overwrite installed extension directory locations
-djava.endorsed.dirs=<dirs> override location of endorsed standards path//overwrite the position of the signed standard path
-xmaxerrs <number> Set the maximum number of errors to print//set the maximum amount of errors to output
-xmaxwarns <number> Set the maximum number of warnings to print//set the maximum amount of warnings to output
-xstdout <filename> Redirect Standard output,//REDIRECT standards output
-xprint Print out a textual representation of specified types
-xprintrounds Print information about rounds of annotation processing
-xprintprocessorinfo Print information about which annotations a processor are asked to process
-xprefer:{source,newer} Specify which file to read when both a source file and class file is found for a implicitly comp Iled class
-xpkginfo:{always,legacy,nonempty} Specify handling of Package-info files

These options is non-standard and subject to change without notice.
~]$

Let's look at the options that involve lint in turn:

-xlint

Enable all warnings. This option is equivalent to the-xlint:all option. Conversely, the option to turn off all warnings is-xlint:none.
-xlint:unchecked

Enables warnings for so-called unchecked conversions (unchecked warning). This warning concerns new features in JDK 5.0-the paradigm (Generic
Type), which is definitely another story. If you are interested, you can search the Internet for a lot of articles about paradigms.
-xlint:path

A warning is given when a nonexistent path or directory is found, such as the Classpath (CLASSPATH) in standard options, the source code path (SourcePath), and so on.
-xlint:serial

A warning is given when the definition of serialversionuid is not found in a serializable class.
Xlint:finally

A warning is given when it is found that the finally clause does not end properly. For example, the following code:

try {

} catch (Exception e) {
} finally {
for (;;);
}

-xlint:fallthrough

A warning is given when a fall-through condition is found in a switch statement block. The Fall-through situation described here refers to the
Switch statement block, in addition to the last
The case does not contain a break statement, which causes the execution of the code to pass directly through the execution to the next scenario. For example, the following code:

switch (color) {
Case GREEN:
System.out.println ("green");
No break statement; Fall-through
Case RED:
System.out.println ("Red");
Break
Case YELLOW:
System.out.println ("yellow");

}

-xlint:deprecation

Displays detailed information about using outdated APIs. This option is equivalent to a standard option that we are familiar with, the-deprecation option. Relative to other lint
option, the special thing about this option is that even if you close it, the compiler will still simply remind you that a deprecated API is used in a class. Just when the warning is enabled, the information displayed will be more detailed.

The warning names in the lint options mentioned above (the part after the colon) can be combined to selectively turn on or off a specific set of lint warning options, such as
-xlint:deprecation,
Finally, the deprecation and finally warnings are turned on. You can also include a "-" in front of the warning name to dismiss the warning, such as
-xlint:all,-unchecked indicates that all warnings except unchecked are turned on.

For a complete reference to the Java compiler commands, see Javac-java programming language
Compiler

Http://spaces.msn.com/members/stephensuen
Http://groups.google.com/group/programmercafe

Xlint and Java Lint options

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.