| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]"> |
| <title> |
| Compiler |
| </title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| </head> |
| <body> |
| <h1> |
| Compiler |
| </h1> |
| <p> |
| The compiler preferences are separated in the following sections: |
| </p> |
| <ul> |
| <li> |
| Problems |
| </li> |
| <li> |
| Style |
| </li> |
| <li> |
| Compliance and Class files |
| </li> |
| <li> |
| Build Path |
| </li> |
| </ul> |
| |
| <h2 class="Head"> |
| Problems |
| </h2> |
| <table border="1" cellspacing="0" cellpadding="5" width="100%"> |
| <tr> |
| <th> |
| <p> |
| Option |
| </p> |
| </th> |
| <th> |
| <p> |
| Description |
| </p> |
| </th> |
| <th> |
| <p> |
| Default |
| </p> |
| </th> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Unreachable code</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Unreachable code can optionally be reported as an error, warning or simply ignored. The byte code generation will always optimized it out. |
| Note that according to the Java language specification, unreachable code should be an error. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Error |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Unresolvable import statements</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| An import statement that cannot be resolved might optionally be reported as an error, as a warning or ignored. |
| Note that according to the Java language specification, unresolved import statements should be an error. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Error |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Unused local variables (i.e. never read)</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning for unused local variables (i.e. variables never read from). |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Ignore |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Unused parameters (i.e. never read)</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning for unused method parameters (i.e. parameters never read from). |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Ignore |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Unused imports</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning for unused import reference. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Unused private types, methods or fields</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning whenever a private |
| method or field is declared but never used within the same unit. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Ignore |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Usage of non-externalized strings</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning for non externalized String literal (i.e. non tagged with //$NON-NLS-<n>$). |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Ignore |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Usage of deprecated API</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will signal use of deprecated API either as an error or a warning. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Signal use of deprecated API inside deprecated code</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will signal use of deprecated API inside deprecated code. |
| The severity of the problem is controlled with option "Usage of deprecated API". |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Off |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Maximum number of problems reported per compilation unit</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Specifies the maximum number of problems reported per compilation unit. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| 100 |
| </p> |
| </td> |
| </tr> |
| </table> |
| |
| <h2 class="Head"> |
| Style |
| </h2> |
| <table border="1" cellspacing="0" cellpadding="5" width="100%"> |
| <tr> |
| <th> |
| <p> |
| Option |
| </p> |
| </th> |
| <th> |
| <p> |
| Description |
| </p> |
| </th> |
| <th> |
| <p> |
| Default |
| </p> |
| </th> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Methods overridden but not package visible</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| A package default method is not visible in a different package, and thus cannot be overridden. When enabling this option, the compiler will signal such scenario either |
| as an error or a warning. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Methods with a constructor name</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Naming a method with a constructor name is generally considered poor style programming. When enabling this option, the compiler will signal such scenario either as an |
| error or a warning. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Conflict of interface method with protected 'Object' method</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning whenever an interface defines a method incompatible with a |
| non-inherited Object method. Until this conflict is resolved, such an interface cannot be implemented, e.g. |
| </p> |
| <code>interface I {</code><br> |
| <code> int clone();</code><br> |
| <code>}</code><br> |
| <br> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Hidden catch blocks</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Locally to a try statement, some catch blocks may hide others , e.g. |
| </p> |
| <code>try { throw new java.io.CharConversionException();</code><br> |
| <code>} catch (java.io.CharConversionException e) {</code><br> |
| <code>} catch (java.io.IOException e) {}.</code><br> |
| <br> |
| |
| <p> |
| When enabling this option, the compiler will issue an error or a warning for hidden catch blocks corresponding to checked exceptions. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Non-static access to a static member</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning whenever a static field or method is accessed with an expression receiver. |
| A reference to a static member should be qualified with a type name. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Access to a non-accessible member of an enclosing type</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning whenever it emulates access to a non-accessible member of an enclosing type. Such accesses can have |
| performance implications. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Ignore |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Assignment has no effect (e.g. 'x = x')</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning whenever an assignment has no effect (e.g. 'x = x'). |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Using a char array in string concatenation</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning whenever a char[] expression is used in String concatenations, |
| </p> |
| <code>"hello" + new char[]{'w','o','r','l','d'}</code> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| </table> |
| |
| <h2 class="Head"> |
| Compliance and Class files |
| </h2> |
| |
| <table border="1" cellspacing="0" cellpadding="5" width="100%"> |
| <tr> |
| <th> |
| <p> |
| Option |
| </p> |
| </th> |
| <th> |
| <p> |
| Description |
| </p> |
| </th> |
| <th> |
| <p> |
| Default |
| </p> |
| </th> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Compiler compliance level</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Specifies the JDK compiler compliance level. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| 1.3 |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Use default compliance settings</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| If enabled, the default compliance settings for the compiler compliance level are applied. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Generated class files compatibility</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Specifies the generated class file compatibility. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| 1.1 |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Source compatibility</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword reserved for assertion support. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| 1.3 |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Report 'assert' as identifier</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When enabled, the compiler will issue an error or a warning whenever 'assert' is used as an identifier (reserved keyword in JDK 1.4). |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Ignore |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Add variable attributes to generated class files</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| If enabled, variable attributes are added to the class file. This will enable local variable names to be displayed in the debugger (in places where variables are |
| definitely assigned) The resulting .class file is then bigger. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Add line number attributes to generated class files</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| If enabled, line number information is added to the class file. This will enable source code highlighting in the debugger. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Add source file name to generated class file</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| If enabled, the source file name is added to the class file. This will enable the debugger to present the corresponding source code. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Preserve unused local variables</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| If enabled, unused local variables (i.e. never read) are not stripped from the class file. If stripped this potentially alters debugging. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| </table> |
| |
| <h2 class="Head"> |
| Build Path |
| </h2> |
| |
| <table border="1" cellspacing="0" cellpadding="5" width="100%"> |
| <tr> |
| <th> |
| <p> |
| Option |
| </p> |
| </th> |
| <th> |
| <p> |
| Description |
| </p> |
| </th> |
| <th> |
| <p> |
| Default |
| </p> |
| </th> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Incomplete build path</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Indicate the severity of the problem reported when an entry on the classpath does not exist, |
| is not legitimate or is not visible (e.g. a reference project is closed). |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Error |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Circular dependencies</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Indicate the severity of the problem reported when a project is involved in a cycle. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Error |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Duplicated resources</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Indicate the severity of the problem reported when more than one occurrence of a resource |
| is to be copied into the output location. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Warning |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Abort building on build path errors</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Allow to toggle the builder to abort if the classpath is invalid. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Scrub output folders on full build</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| Indicate whether the Java Builder is allowed to clean the output folders |
| when performing full build operations. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Enable using exclusion patterns in source folders</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When disabled, no entry on a project classpath can be associated with |
| an exclusion pattern. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Enable using multiple output locations for source folders</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| When disabled, no entry on a project classpath can be associated with |
| a specific output location, preventing thus usage of multiple output locations. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| On |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td valign="top"> |
| <p> |
| <strong>Filtered resources</strong> |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| A comma separated list of file patterns which are not copied to the output folder. |
| </p> |
| </td> |
| <td valign="top"> |
| <p> |
| '' |
| </p> |
| </td> |
| </tr> |
| </table> |
| <p> |
| <img src="../images/ngrelc.gif" alt="Related concepts" border="0" height="27" width="159"><br> |
| <a href="../concepts/concepts-4.htm">Java builder</a> |
| </p> |
| <p> |
| <img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159"><br> |
| <a href="../tasks/tasks-106.htm">Building a Java program</a><br> |
| <a href="../tasks/tasks-110.htm">Working with build paths</a><br> |
| <a href="../tasks/tasks-119.htm">Working with JREs</a> |
| </p> |
| <p> |
| <img border="0" width="159" height="27" src="../images/ngrelr.gif" alt="Related reference"><br> |
| <a href="../reference/ref-15.htm">Classpath Variables preferences</a><br> |
| <a href="../reference/ref-123.htm">Java Build Path properties</a> |
| </p> |
| <p> |
| <a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0" width="324" height="14"></a> |
| </p> |
| </body> |
| </html> |
| |