Java Compiler Errors/Warnings Preferences

Indicate your preferences for the Errors/Warnings settings on the Opens the Errors/Warnings preference page 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

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

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

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

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

Potential programming problems

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

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

'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

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

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

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

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

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

Enum type constant not covered on 'switch'

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.

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

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.

Ignore

Comparing identical

When enabled, the compiler will issue an error or a warning if a comparison is involving identical operands (e.g 'x == x').

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

Dead code

When enabled, the compiler will issue an error or a warning when it encounters dead code (e.g 'if (false)' ).

Warning

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

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

Local variable is never read

When enabled, the compiler will issue an error or a warning whenever a local variable is declared but never used within its scope.

Warning

Parameter is never read

When enabled, the compiler will issue an error or a warning whenever a parameter is declared but 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 local or private members

When enabled, the compiler will issue an error or a warning whenever a local or private member is declared but never used within the same unit.

Warning

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

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 (i.e. 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

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 unhandled token in a '@SuppressWarnings' annotation.

Warning

Enable '@SuppressWarnings' annotations

When enabled, the compiler will process '@SuppressWarnings' annotations.

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 the optional compiler errors.

Off

When Treat 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 (i.e. syntax error).

Related concepts

Problems View
Quick Fix
Java builder