# Java Compile Errors/Warnings Preferences

Indicate your preferences for the Errors/Warnings settings on the Java > Compiler > Errors/Warnings preference page.

### Code style

Option | Description | Default
--- | --- | ---
Non-static access to a static member | 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. | Warning
Indirect access to a static member | When enabled, the compiler will issue an error or a warning whenever a static field or method is indirectly accessed. A static field of an interface should be qualified with the declaring type name. | Ignore
Unqualified access to instance field | When enabled, the compiler will issue an error or a warning whenever it encounters a field access which is not qualified (e.g. misses a 'this'). | Ignore
Access to a non-accessible member of an enclosing type | 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. | Ignore
Parameter assignment | Assigning a value to a parameter is generally considered poor style programming. When this option is enabled, the compiler will signal such scenario either as an error or a warning. | Ignore
Non-externalized strings | When enabled, the compiler will issue an error or a warning for non externalized String literal (i.e. non tagged with //$NON-NLS-<n>$) or for non externalized String tags which do not belong to a String. | Ignore
Undocumented empty block | When enabled, the compiler will issue an error or a warning whenever it encounters an empty block statement with no explaining comment. | Ignore
Resource not managed via try-with-resource (1.7 or higher) | When enabled, the compiler will issue an error or a warning if a local variable holds a value of type 'java.lang.AutoCloseable', and if the method 'close()' is explicitly invoked on that resource, but the resource is not managed by a try-with-resources block. | Ignore
Method with a constructor name | Naming a method with a constructor name is generally considered poor style programming. When this option is enabled, the compiler will signal such scenario either as an error or a warning. | Warning
Method can be static | When enabled, the compiler will issue an error or a warning for methods which are private or final and which refer only to static members. | Ignore
Method can potentially be static | When enabled, the compiler will issue an error or a warning for methods which are not private or final and which refer only to static members. Note that methods can be overridden in a subclass, so if you make a "potentially static" method static, this may break existing clients. | Ignore

### Potential programming problems

Comparing identical values ('x == x') | When enabled, the compiler will issue an error or a warning if a comparison is involving identical operands (e.g 'x == x'). | Warning
Assignment has no effect (e.g. 'x = x') | When enabled, the compiler will issue an error or a warning whenever an assignment has no effect (e.g. 'x = x'). | Warning
Possible accidental boolean assignment (e.g. 'if (a = b)') | When enabled, the compiler will issue an error or a warning whenever it encounters a possible accidental boolean assignment (e.g. 'if (a = b)'). | Ignore
Boxing and unboxing conversions | When enabled, the compiler will issue an error or a warning whenever it encounters a boxing or unboxing conversion. Autoboxing may affects performance negatively. | Ignore
Using a char array in string concatenation | When enabled, the compiler will issue an error or a warning whenever a char[] expression is used in String concatenations, `"hello" + new char[]{'w','o','r','l','d'}` | Warning
Inexact type match for vararg arguments | When enabled, the compiler will issue an error or a warning whenever it encounters an inexact type match for vararg arguments. | Warning
Empty statement | When enabled, the compiler will issue an error or a warning whenever it encounters an empty statement (e.g. a superfluous semicolon). | Ignore
Unused object allocation | When enabled, the compiler will issue an error or a warning when it encounters an allocated object which is not used, e.g. `if (name == null)` `new IllegalArgumentException();` | Ignore
Incomplete 'switch' cases on enum | When enabled, the compiler will issue an error or a warning whenever it encounters a switch statement which does not contain case statements for every enum constant of the referenced enum nor a default case. A default case is assumed to cover missing case statements for any enum constant, so the compiler is silent in the presence of default cases unless the option "Signal even if 'default' case exists" (see below) is enabled. | Warning
Signal even if 'default' case exists | When enabled, the compiler additionally will issue an error or a warning if an enum constant is not covered by a case, even if a default case exists. This options is helpful in catching missing case statements when a new enum constant is added. | Off
'switch' is missing 'default' case | When enabled, the compiler will issue an error or a warning if a 'switch' statement lacks a default case. Consequently, missing 'default' will be flagged even if all possible values are otherwise covered by 'case' statements. This warning is recommended by the Java Language Specification for the sake of binary compatibility. | Ignore
'switch' case fall-through | When enabled, the compiler will issue an error or a warning when a case may be entered by falling through a preceding, non empty case. | Ignore
Hidden catch block | Locally to a try statement, some catch blocks may hide others , e.g. `try { throw new java.io.CharConversionException();` `} catch (java.io.CharConversionException e) {` `} catch (java.io.IOException e) {}` When enabled, the compiler will issue an error or a warning for hidden catch blocks corresponding to checked exceptions. | Warning
'finally' does not complete normally | When enabled, the compiler will issue an error or a warning whenever a 'finally' statement does not complete normally (e.g. contains a return statement). | Warning
Dead code (e.g. 'if (false)') | When enabled, the compiler will issue an error or a warning when it encounters dead code (e.g 'if (false)' ). | Warning
Resource leak | When enabled, the compiler will issue an error or a warning if a local variable holds a value of type 'java.lang.AutoCloseable' (compliance >= 1.7) or a value of type 'java.io.Closeable' (compliance <= 1.6) and if flow analysis shows that the method 'close()' is not invoked locally on that value. | Warning
Potential resource leak | When enabled, the compiler will issue an error or a warning if a local variable holds a value of type 'java.lang.AutoCloseable' (compliance >= 1.7) or a value of type 'java.io.Closeable' (compliance <= 1.6) and if flow analysis shows that the method 'close()' is not invoked locally on that value for all execution paths. | Ignore
Serializable class without serialVersionUID | When enabled, the compiler will issue an error or a warning whenever a type implementing 'java.io.Serializable' does not contain a serialVersionUID field. | Warning
Missing synchronized modifier on inherited method | When enabled, the compiler will issue an error or a warning when it encounters an inherited method which is missing the synchronized modifier. | Ignore
Class overrides 'equals()' but not 'hashCode()' | When enabled, the compiler will issue an error or a warning when it encounters a class which overrides 'equals()' but not 'hashCode()'. | Ignore

### Name shadowing and conflicts

Field declaration hides another field or variable | When enabled, the compiler will issue an error or a warning if a field declaration hides another inherited field. | Ignore
Local variable declaration hides another field or variable | When enabled, the compiler will issue an error or a warning if a local variable declaration hides another field or variable. | Ignore
Include constructor or setter method parameters | When enabled, the compiler additionally will issue an error or a warning if a constructor or setter method parameter hides another field or variable. | Off
Type parameter hides another type | When enabled, the compiler will issue an error or a warning if i.e. a type parameter of an inner class hides an outer type. | Warning
Method does not override package visible method | A package default method is not visible in a different package, and thus cannot be overridden. When this option is enabled, the compiler will signal such scenario either as an error or a warning. | Warning
Interface method conflicts with protected 'Object' method | 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. `interface I {` `int clone();` `}` | Warning

### Deprecated and restricted API

Deprecated API | When enabled, the compiler will signal use of deprecated API either as an error or a warning. | Warning
Signal use of deprecated API inside deprecated code | When enabled, the compiler will signal use of deprecated API inside deprecated code. The severity of the problem is controlled with option "Deprecated API". | Off
Signal overriding or implementing deprecated method | When enabled, the compiler will signal overriding or implementing a deprecated method The severity of the problem is controlled with option "Deprecated API". | Off
Forbidden reference (access rules) | When enabled, the compiler will signal a forbidden reference specified in the access rules. | Error
Discouraged reference (access rules) | When enabled, the compiler will signal a discouraged reference specified in the access rules. | Warning

### Unnecessary code

Value of local variable is not used | When enabled, the compiler will issue an error or a warning whenever a local variable is declared but its value is never used within its scope. | Warning
Value of parameter is not used | When enabled, the compiler will issue an error or a warning whenever a parameter is declared but its value is never used within its scope. | Ignore
Ignore in overriding and implementing methods | When enabled, the compiler will not issue an error or a warning whenever a parameter is declared but never used within its scope in a method that overrides or implements another method. | On
Ignore parameters documented with '@param' tag | When enabled, the compiler will not issue an error or a warning whenever an unread parameter is documented with an '@param' tag. | On
Unused import | When enabled, the compiler will issue an error or a warning for unused import reference. | Warning
Unused private member | When enabled, the compiler will issue an error or a warning whenever a private member is declared but never used within the same unit. | Warning
Unnecessary 'else' statement | When enabled, the compiler will issue an error or a warning whenever it encounters an unnecessary else statement (e.g. if (condition) return; else doSomething();). | Ignore
Unnecessary cast or 'instanceof' operation | When enabled, the compiler will issue an error or a warning whenever it encounters an unnecessary cast or 'instanceof' operation (e.g. if (object instanceof Object) return;). | Ignore
Unnecessary declaration of thrown exception | When enabled, the compiler will issue an error or a warning whenever it encounters an unnecessary declaration of a thrown exception. | Ignore
Ignore in overriding and implementing methods | When enabled, the compiler will not issue an error or a warning whenever it encounters an unnecessary declaration of a thrown exception in a method that overrides or implements another method. | On
Ignore exceptions documented with '@throws' or '@exception' tags | When enabled, the compiler will not issue an error or a warning whenever an unnecessary declaration of a thrown exception is documented with an '@throws' or '@exception' tag. | On
Ignore 'Exception' and 'Throwable' | When enabled, the compiler will not issue an error or a warning whenever it encounters an unnecessary declaration of 'Exception' and 'Throwable' exception | On
Unused 'break' or 'continue' label | When enabled, the compiler will issue an error or a warning whenever it encounters an unused 'break' or 'continue' label. | Warning
Redundant super interface | When enabled, the compiler will issue an error or a warning whenever it encounters a type which explicitly implements an interface that is already implemented by any of its supertypes. | Ignore

### Generic types

Unchecked generic type operation | When enabled, the compiler will issue an error or a warning whenever it encounters an unchecked generic type operation. | Warning
Usage of a raw type | When enabled, the compiler will issue an error or a warning whenever it encounters a usage of a raw type (e.g. List instead of List<String>). | Warning
Generic type parameter declared with a final type bound | When enabled, the compiler will issue an error or a warning whenever it encounters a type bound involving a final type. | Warning
Ignore unavoidable generic type problems | When enabled, the compiler will issue an error or a warning even when it detects a generic type problem that could not have been avoided by the programmer. As an example, a type may be forced to use raw types in its method signatures and return types because the methods it overrides from a super type are declared to use raw types in the first place. Once the referenced raw APIs get generified, you either see no problem at all (if your generic types were right) or compile errors (if the API was generified in a different way). | Off

### Annotations

Missing '@Override' annotation | When enabled, the compiler will issue an error or a warning whenever it encounters a method overriding another implemented method, and the '@Override' annotation is missing. | Ignore
Include implementations of interface methods (1.6 or higher) | When enabled, the compiler will also issue an error or a warning whenever it encounters a method overriding or implementing a method declared in an interface, and the '@Override' annotation is missing. Note that '@Override' is only allowed on such methods if the compiler compliance level is 1.6 or higher, so this error or warning will never appear in 1.5 code. | On
Missing '@Deprecated' annotation | When enabled, the compiler will issue an error or a warning whenever it encounters a deprecated type without additional '@Deprecated' annotation. | Ignore
Annotation is used as super interface | When enabled, the compiler will issue an error or a warning whenever it encounters a type implementing an annotation. Although possible, this is considered bad practice. | Warning
Unhandled token in '@SuppressWarnings' | When enabled, the compiler will issue an error or a warning whenever it encounters an unknown token in a '@SuppressWarnings' annotation. | Warning
Enable '@SuppressWarnings' annotations | When enabled, the compiler will process '@SuppressWarnings' annotations. When disabled, it will act as if all '@SuppressWarnings' annotations were removed. | On
Unused '@SuppressWarnings' token | When enabled, the compiler will issue an error or a warning whenever it encounters an unused token in a '@SuppressWarnings' annotation. | Warning
Suppress optional errors with '@SuppressWarnings' | When enabled, the '@SuppressWarnings' annotation will also suppress optional compile errors, i.e. options set to "Error" here. Mandatory compile errors cannot be suppressed. | Off

### Null analysis

Null pointer access | When enabled, the compiler will issue an error or a warning when it encounters that a local variable which is certainly null is dereferenced. Note that the analysis can not find all null pointer accesses, see Potential null pointer access. | Warning
Potential null pointer access | When enabled, the compiler will issue an error or a warning when it encounters that a local variable which may be null is dereferenced. Note that the analysis is fairly conservative, it only considers cases where there is something suspicious. The quality of the analysis can be improved by using null-annotations, which can be enabled using the option Enable annotation-based null analysis | Ignore
Redundant null check | When enabled, the compiler will issue an error or a warning whenever a local variable which can not be null is tested for null. | Ignore
Include 'assert' in null analysis | When enabled, the compiler will honor 'assert' statement when doing the null analysis. | Off
Enable annotation-based null analysis | When enabled, the compiler will interpret annotations @Nullable, @NonNull, and @NonNullByDefault as specifying whether or not a given type includes the value 'null'. The effect of these analyses is further controlled by the following sub-options. See also Using null annotations. | Off
Violation of null specification | Depending on this option, the compiler will issue either an error or a warning whenever one of the following situations is detected: A method declared with a nonnull annotation returns a nullable expression. A nullable expression is passed as an argument in a method call where the corresponding parameter of the called method is declared with a nonnull annotation. A nullable expression is assigned to a local variable that is declared with a nonnull annotation. A method that overrides an inherited method declared with a nonnull annotation tries to relax that contract by specifying a nullable annotation (prohibition of contravariant return). A method that overrides an inherited method which has a nullable declaration for at least one of its parameters, tries to tighten that null contract by specifying a nonnull annotation for its corresponding parameter (prohibition of covariant parameters). In the above an expression is considered as nullable if either it is statically known to evaluate to the value `null`, or if it is declared with a nullable annotation. | Error
Conflict between null annotations and null inference | Depending on this option, the compiler will issue either an error or a warning whenever one of the following situations is detected: A method declared with a nonnull annotation returns an expression that is statically known to evaluate to a null value on some flow. An expression that is statically known to evaluate to a null value on some flow is passed as an argument in a method call where the corresponding parameter of the called method is declared with a nonnull annotation. An expression that is statically known to evaluate to a null value on some flow is assigned to a local variable that is declared with a nonnull annotation. | Error
Unchecked conversion from non-annotated type to @NonNull type | Depending on this option, the compiler will issue either an error or a warning whenever one of the following situations is detected: A method declared with a nonnull annotation returns an expression for which insufficient nullness information is available for statically proving that no flow will pass a null value at runtime. An expression for which insufficient nullness information is available for statically proving that it will never evaluate to a null value at runtime is passed as an argument in a method call where the corresponding parameter of the called method is declared with a nonnull annotation. An expression for which insufficient nullness information is available for statically proving that it will never evaluate to a null value at runtime is assigned to a local variable that is declared with a nonnull annotation. Unchecked conversion is usually a consequence of using other unannotated variables or methods. | Warning
Redundnant null annotation | When enabled, the compiler will issue an error or a warning when a non-null annotation is applied although the same effect is already achieved by a default applicable at the current location. Such a default may be set by using the @NonNullByDefault annotation. | Warning
Missing '@NonNullByDefault' annotation on package | When enabled, the compiler will issue an error or a warning in the following cases: When a package does not contain a default nullness annotation, as a result of missing package-info.java or missing default nullness annotation in package-info.java. When a type inside a default package does not contain a default nullness annotation. | Ignore
Use default annotations for null specifications | When enabled, the compiler will use the default set of annotations for null specifications. These annotations are included in the Eclipse SDK in the org.eclipse.jdt.annotation bundle. You can specify different annotation names to use in your projects, but be aware that the Eclipse compiler only supports the semantics specified in the default annotations: org.eclipse.jdt.annotation.Nullable: A fully qualified name of a Java annotation type, which when applied to a type in a method signature or variable declaration, will be interpreted as a specification that null is a legal value in that position. Currently supported positions are: method parameters, method return type and local variables. org.eclipse.jdt.annotation.NonNull: A fully qualified name of a Java annotation type, which when applied to a type in a method signature or variable declaration, will be interpreted as a specification that null is not a legal value in that position. Currently supported positions are: method parameters, method return type and local variables. org.eclipse.jdt.annotation.NonNullByDefault: A fully qualified name of a Java annotation type. When applied to an element without an annotation argument, all unannotated types in method signatures within the annotated element will be treated as if they were specified with the non-null annotation. On the contrary, when the annotation is applied with the constant 'false' as its argument, all corresponding defaults at outer scopes will be canceled for the annotated element. | On

When Treat above errors like fatal compile errors is enabled, all generated errors, fatal or configurable, lead to non-executable code. If disabled, then your code can be executed as long as it has no fatal error (syntax error, type error, or any error according to the Java Language Specification).

Problems View
Quick Fix
Java builder