|
A possibly-null value is passed to a nonnull method parameter.
Either the parameter is annotated as a parameter that should
always be nonnull, or analysis has shown that it will always be
dereferenced.
Repository: findbugs
Key: NP_NULL_PARAM_DEREF_NONVIRTUAL
Available since 07 Jan 2014
|
|
This method performs a nonsensical computation of a field with another
reference to the same field (e.g., x&x or x-x). Because of the nature
of the computation, this operation doesn't seem to make sense,
and may indicate a typo or
a logic error. Double check the computation.
Repository: findbugs
Key: SA_FIELD_SELF_COMPUTATION
Available since 07 Jan 2014
|
|
This method performs a nonsensical computation of a local variable with another
reference to the same variable (e.g., x&x or x-x). Because of the nature
of the computation, this operation doesn't seem to make sense,
and may indicate a typo or
a logic error. Double check the computation.
Repository: findbugs
Key: SA_LOCAL_SELF_COMPUTATION
Available since 07 Jan 2014
|
|
A null pointer is dereferenced here. This will lead to a
NullPointerException when the code is executed.
Repository: findbugs
Key: NP_ALWAYS_NULL
Available since 07 Jan 2014
|
|
A pointer which is null on an exception path is dereferenced here.
This will lead to a NullPointerException when the code is executed.
Note that because FindBugs currently does not prune infeasible exception paths,
this may be a false warning.
Also note that FindBugs considers the default case of a switch statement to
be an exception path, since the default case is often infeasible.
Repository: findbugs
Key: NP_ALWAYS_NULL_EXCEPTION
Available since 07 Jan 2014
|
|
There is a statement or branch that if executed guarantees that
a value is null at this point, and that
value that is guaranteed to be dereferenced
(except on forward paths involving runtime exceptions).
Repository: findbugs
Key: NP_GUARANTEED_DEREF
Available since 07 Jan 2014
|
|
A value is checked here to see whether it is null, but this value can't
be null because it was previously dereferenced and if it were null a null pointer
exception would have occurred at the earlier dereference.
Essentially, this code and the previous dereference
disagree as to whether this value is allowed to be null. Either the check is redundant
or the previous dereference is erroneous.
Repository: findbugs
Key: RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
Available since 07 Jan 2014
|
|
A format-string method with a variable number of arguments is called,
but the number of arguments passed does not match with the number of
% placeholders in the format string. This is probably not what the
author intended.
Repository: findbugs
Key: VA_FORMAT_STRING_ARG_MISMATCH
Available since 07 Jan 2014
|
|
The code performs an increment operation (e.g., i++ ) and then
immediately overwrites it. For example, i = i++ immediately
overwrites the incremented value with the original value.
Repository: findbugs
Key: DLS_OVERWRITTEN_INCREMENT
Available since 07 Jan 2014
|
|
There is a branch of statement that, if executed, guarantees that
a null value will be dereferenced, which
would generate a NullPointerException when the code is executed.
Of course, the problem might be that the branch or statement is infeasible and that
the null pointer exception can't ever be executed; deciding that is beyond the ability of FindBugs.
Repository: findbugs
Key: NP_NULL_ON_SOME_PATH
Available since 07 Jan 2014
|
|
A reference value which is null on some exception control path is
dereferenced here. This may lead to a NullPointerException
when the code is executed.
Note that because FindBugs currently does not prune infeasible exception paths,
this may be a false warning.
Also note that FindBugs considers the default case of a switch statement to
be an exception path, since the default case is often infeasible.
Repository: findbugs
Key: NP_NULL_ON_SOME_PATH_EXCEPTION
Available since 07 Jan 2014
|
|
This code passes a primitive array to a function that takes a variable number of object arguments.
This creates an array of length one to hold the primitive array and passes it to the function.
Repository: findbugs
Key: VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG
Available since 07 Jan 2014
|
|
A wrapped primitive value is unboxed and converted to another primitive type as part of the
evaluation of a conditional ternary operator (the b ? e1 : e2 operator). The
semantics of Java mandate that if e1 and e2 are wrapped
numeric values, the values are unboxed and converted/coerced to their common type (e.g,
if e1 is of type Integer
and e2 is of type Float , then e1 is unboxed,
converted to a floating point value, and boxed. See JLS Section 15.25.
Repository: findbugs
Key: BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR
Available since 07 Jan 2014
|
|
A random value from 0 to 1 is being coerced to the integer value 0. You probably
want to multiple the random value by something else before coercing it to an integer, or use the Random.nextInt(n) method.
Repository: findbugs
Key: RV_01_TO_INT
Available since 07 Jan 2014
|
|
The program is dereferencing a field that does not seem to ever have a non-null value written to it. Dereferencing this value will generate a null pointer exception.
Repository: findbugs
Key: NP_UNWRITTEN_FIELD
Available since 07 Jan 2014
|
|
The code contains a conditional test is performed twice, one right after the other
(e.g., x == 0 || x == 0 ). Perhaps the second occurrence is intended to be something else
(e.g., x == 0 || y == 0 ).
Repository: findbugs
Key: RpC_REPEATED_CONDITIONAL_TEST
Available since 07 Jan 2014
|
|
The putIfAbsent method is typically used to ensure that a single value is associated with a given key (the first value for which put if absent succeeds). If you ignore the return value and retain a reference to the value passed in, you run the risk of retaining a value that is not the one that is associated with the key in the map. If it matters which one you use and you use the one that isn't stored in the map, your program will behave incorrectly.
Repository: findbugs
Key: RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED
Available since 07 Jan 2014
|
|
This method contains a self assignment of a field; e.g.
int x;
public void foo() {
x = x;
}
Such assignments are useless, and may indicate a logic error or typo.
Repository: findbugs
Key: SA_FIELD_SELF_ASSIGNMENT
Available since 07 Jan 2014
|
|
This method compares a field with itself, and may indicate a typo or
a logic error. Make sure that you are comparing the right things.
Repository: findbugs
Key: SA_FIELD_SELF_COMPARISON
Available since 07 Jan 2014
|
|
This method compares a local variable with itself, and may indicate a typo or
a logic error. Make sure that you are comparing the right things.
Repository: findbugs
Key: SA_LOCAL_SELF_COMPARISON
Available since 07 Jan 2014
|
|
A method, field or class declares a generic signature where a non-hashable class
is used in context where a hashable class is required.
A class that declares an equals method but inherits a hashCode() method
from Object is unhashable, since it doesn't fulfill the requirement that
equal objects have equal hashCodes.
Repository: findbugs
Key: HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_CLASS
Available since 07 Jan 2014
|
|
This method invokes the Thread.interrupted() method on a Thread object that appears to be a Thread object that is
not the current thread. As the interrupted() method is static, the interrupted method will be called on a different
object than the one the author intended.
Repository: findbugs
Key: STI_INTERRUPTED_ON_UNKNOWNTHREAD
Available since 07 Jan 2014
|
|
A value that could be null is stored into a field that has been annotated as NonNull.
Repository: findbugs
Key: NP_STORE_INTO_NONNULL_FIELD
Available since 07 Jan 2014
|
|
This method compares two Boolean values using the == or != operator. Normally, there are only two Boolean values (Boolean.TRUE and Boolean.FALSE), but it is possible to create other Boolean objects using the new Boolean(b) constructor. It is best to avoid such objects, but if they do exist, then checking Boolean objects for equality using == or != will give results than are different than you would get using .equals(...)
Repository: findbugs
Key: RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN
Available since 07 Jan 2014
|
|
This method compares a reference value to a constant using the == or != operator, where the correct way to compare instances of this type is generally with the equals() method. It is possible to create distinct instances that are equal but do not compare as == since they are different objects. Examples of classes which should generally not be compared by reference are java.lang.Integer, java.lang.Float, etc.
Repository: findbugs
Key: RC_REF_COMPARISON_BAD_PRACTICE
Available since 07 Jan 2014
|