13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

120Chapter 5The Sun Microsystems Java Software <str<strong>on</strong>g>Development</str<strong>on</strong>g> Kit-deprecati<strong>on</strong>This causes every use or reference to a deprecated class or method to bedisplayed <strong>on</strong> compilati<strong>on</strong>. 2-gPut full debugging informati<strong>on</strong> in the compiled class files. See also -g:(the next entry in this list).-g:keyword_listThis switch gives you fine-grained c<strong>on</strong>trol over the amount of debug informati<strong>on</strong>included in compiled class files. The argument after the col<strong>on</strong> maybe either n<strong>on</strong>e, in which case no debug informati<strong>on</strong> is included, or acomma-separated list with any combinati<strong>on</strong> of source, to include sourcefile debugging informati<strong>on</strong>, lines, to include line number informati<strong>on</strong>,or vars, to include informati<strong>on</strong> about local variable names. The default,if no -g flag of any kind is specified, is to include source file and linenumber informati<strong>on</strong> <strong>on</strong>ly.-nowarnDisables warning messages.-verboseCauses the compiler to output informati<strong>on</strong> about each class encounteredduring compilati<strong>on</strong>. This can be helpful when trying to resolve problemswith missing class definiti<strong>on</strong>s.There are also a number of switches that relate to cross-compiling as wellas UNIX-specific opti<strong>on</strong>s, but these are not comm<strong>on</strong>ly used. Refer to the SunJava SDK Tools documentati<strong>on</strong> if you need details <strong>on</strong> these opti<strong>on</strong>s.2. In Java, it is rare for APIs to break support for existing code. Rather than remove old methods,it is more comm<strong>on</strong> to deprecate them. This is d<strong>on</strong>e by putting a @deprecated tag in aJavadoc comment <strong>on</strong> the class or method. The Java compiler will issue a warning (if the-deprecated switch is <strong>on</strong>) whenever a deprecated class or method is used. In general, deprecati<strong>on</strong>is a warning that the class or method will be removed in a future versi<strong>on</strong> of the codeor library. It is interesting to note that the javac compiler records that a method or class isdeprecated in the binary. Thus the compiler produces different output based <strong>on</strong> the c<strong>on</strong>tentsof a comment. As we have written simple compilers and interpreters, this creeps us out. Wehave always w<strong>on</strong>dered why deprecated has not become a Java language keyword.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!