Java-x Lint of makefile

Source: Internet
Author: User

E:/> javac-x
-Recommended warnings for enabling xlint
-Xlint: {all, deprecation, unchecked, fallthrough, path, serial, finally,-deprecat ion
,-Unchecked,-fallthrough,-path,-serial,-finally} enable or disable specific warnings
-Xbootclasspath/P: <path> placed before the boot class path
-Xbootclasspath/A: <path> after the boot class path
-Xbootclasspath: <path> overwrites the position of the boot class file
-Djava. Ext. dirs = <directory> overwrites the installed extension directory.
-Djava. endorsed. dirs = <directory> overwrites the location of the standard path of the signature.
-Xmaxerrs <No.> sets the maximum number of errors to be output.
-Xmaxwarns <No.> sets the maximum number of warnings to be output.
-Xstdout <File Name> Redirection standard output

 

These options are all non-standard options. Be sure to update them...

 

Let's take a look at the options that involve lint in sequence:

-Xlint

Enable all warnings. This option is equivalent to the-xlint: All option. Conversely, the option to disable all warnings is-xlint: none.
-Xlint: unchecked

Enable warning for so-called unchecked warning. This warning involves the new features in JDK 5.0, namely, the general model (generic
Type). This is definitely another story. If you are interested, you can search for many fan articles on the Internet.
-Xlint: Path

A warning is given when a nonexistent path or directory is found, such as the classpath and source code path in the standard options.
-Xlint: Serial

When serialversionuid definition is not found in serializable classes, a warning is given.
Xlint: Finally

If the finally clause cannot end normally, a warning is given. For example, the following code:

Try {

} Catch (exception e ){
} Finally {
For (;;);
}

-Xlint: fallthrough

A warning is given when fall-through is found in the switch statement block. Fall-through refers
In the switch statement block, except for the last
Other cases except case do not contain the break statement. As a result, the code is executed directly from one case to the next case. 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 details about obsolete APIs. This option is equivalent to a standard option that we are familiar with, that is, the-deprecation option. Compared with other lint
The compiler will remind you that an outdated API is used in a class even if you disable it. Only when this warning is enabled, the information displayed is more detailed.

The warning names in the preceding lint options (the part after the colon) can be combined to enable or disable a specific set of lint warning options. For example
-Xlint: deprecation,
Finally indicates that deprecation and finally warning are enabled. You can also add "-" before the warning name to disable the warning, for example
-Xlint: All,-unchecked indicates that all warnings except unchecked are enabled.

 

 

A simple makefile example:

# Nash635
# Robocup2009 dut_rescue

SRC: = $ (wildcard *. java */*. java */*/*. java */*/*/*. java */*/*/*/*. java)
SUCs: =-D.
Path: =-classpath./SWT. Jar

ALL:
Javac-xlint: All $ (PATH) $ (SUCs) $ (SRC)
 
. Phony: clean
 
Clean:
Rm-f *. Class */*. Class
Rm-f *~ */*~

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.