|
This class defines an equals method that always returns true. This is imaginative, but not very smart.
Plus, it means that the equals method is not symmetric.
Repository: findbugs
Key: EQ_ALWAYS_TRUE
Available since 07 Jan 2014
|
|
This method checks to see if two objects are the same class by checking to see if the names
of their classes are equal. You can have different classes with the same name if they are loaded by
different class loaders. Just check to see if the class objects are the same.
Repository: findbugs
Key: EQ_COMPARING_CLASS_NAMES
Available since 07 Jan 2014
|
|
This class defines an equals method that overrides an equals method in a superclass. Both equals methods
methods use instanceof in the determination of whether two objects are equal. This is fraught with peril,
since it is important that the equals method is symmetrical (in other words, a.equals(b) == b.equals(a) ).
If B is a subtype of A, and A's equals method checks that the argument is an instanceof A, and B's equals method
checks that the argument is an instanceof B, it is quite likely that the equivalence relation defined by these
methods is not symmetric.
Repository: findbugs
Key: EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC
Available since 07 Jan 2014
|
|
This class defines an equals()
method, that doesn't override the normal equals(Object) method
defined in the base java.lang.Object class.
The class should probably define a boolean equals(Object) method.
Repository: findbugs
Key: EQ_OTHER_USE_OBJECT
Available since 07 Jan 2014
|
|
This method invokes the .equals(Object o) to compare an array and a reference that doesn't seem
to be an array. If things being compared are of different types, they are guaranteed to be unequal
and the comparison is almost certainly an error. Even if they are both arrays, the equals method
on arrays only determines of the two arrays are the same object.
To compare the
contents of the arrays, use java.util.Arrays.equals(Object[], Object[]).
Repository: findbugs
Key: EC_ARRAY_AND_NONARRAY
Available since 07 Jan 2014
|
|
This method invokes the .equals(Object o) to compare two arrays, but the arrays of of incompatible types (e.g., String[] and StringBuffer[], or String[] and int[]). They will never be equal. In addition, when equals(...) is used to compare arrays it only checks to see if they are the same array, and ignores the contents of the arrays.
Repository: findbugs
Key: EC_INCOMPATIBLE_ARRAY_COMPARE
Available since 07 Jan 2014
|
|
This code creates an exception (or error) object, but doesn't do anything with it. For example,
something like
if (x < 0)
new IllegalArgumentException("x must be nonnegative");
It was probably the intent of the programmer to throw the created exception:
if (x < 0)
throw new IllegalArgumentException("x must be nonnegative");
Repository: findbugs
Key: RV_EXCEPTION_NOT_THROWN
Available since 07 Jan 2014
|
|
This field is never initialized within any constructor, and is therefore could be null after the object is constructed. This could be a either an error or a questionable design, since it means a null pointer exception will be generated if that field is dereferenced before being initialized.
Repository: findbugs
Key: UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR
Available since 07 Jan 2014
|
|
All writes to this field are of the constant value null, and thus
all reads of the field will return null.
Check for errors, or remove it if it is useless.
Repository: findbugs
Key: UWF_NULL_FIELD
Available since 07 Jan 2014
|
|
The code here uses File.separator
where a regular expression is required. This will fail on Windows
platforms, where the File.separator is a backslash, which is interpreted in a
regular expression as an escape character. Amoung other options, you can just use
File.separatorChar=='\\' & "\\\\" : File.separator instead of
File.separator
Repository: findbugs
Key: RE_CANT_USE_FILE_SEPARATOR_AS_REGULAR_EXPRESSION
Available since 07 Jan 2014
|
|
The format string placeholder is incompatible with the corresponding
argument. For example,
System.out.println("%d\n", "hello");
The %d placeholder requires a numeric argument, but a string value is
passed instead.
A runtime exception will occur when
this statement is executed.
Repository: findbugs
Key: VA_FORMAT_STRING_BAD_ARGUMENT
Available since 07 Jan 2014
|
|
Not enough arguments are passed to satisfy a placeholder in the format string.
A runtime exception will occur when
this statement is executed.
Repository: findbugs
Key: VA_FORMAT_STRING_MISSING_ARGUMENT
Available since 07 Jan 2014
|
|
(Javadoc)
While ScheduledThreadPoolExecutor inherits from ThreadPoolExecutor, a few of the inherited tuning methods are not useful for it. In particular, because it acts as a fixed-sized pool using corePoolSize threads and an unbounded queue, adjustments to maximumPoolSize have no useful effect.
Repository: findbugs
Key: DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR
Available since 07 Jan 2014
|
|
The hasNext() method invokes the next() method. This is almost certainly wrong,
since the hasNext() method is not supposed to change the state of the iterator,
and the next method is supposed to change the state of the iterator.
Repository: findbugs
Key: DMI_CALLING_NEXT_FROM_HASNEXT
Available since 07 Jan 2014
|
|
The format string is syntactically invalid,
and a runtime exception will occur when
this statement is executed.
Repository: findbugs
Key: VA_FORMAT_STRING_ILLEGAL
Available since 07 Jan 2014
|
|
This cast will always throw a ClassCastException.
Repository: findbugs
Key: BC_IMPOSSIBLE_CAST
Available since 07 Jan 2014
|
|
This cast will always throw a ClassCastException. The analysis believes it knows the precise type of the value being cast, and the attempt to downcast it to a subtype will always fail by throwing a ClassCastException.
Repository: findbugs
Key: BC_IMPOSSIBLE_DOWNCAST
Available since 07 Jan 2014
|
|
This code is casting the result of calling toArray() on a collection to a type more specific than Object[], as in:
String[] getAsArray(Collection c) {
return (String[]) c.toArray();
}
This will usually fail by throwing a ClassCastException. The toArray() of almost all collections return an Object[] . They can't really do anything else, since the Collection object has no reference to the declared generic type of the collection.
The correct way to do get an array of a specific type from a collection is to use c.toArray(new String[]); or c.toArray(new String[c.size()]); (the latter is slightly more efficient).
There is one common/known exception exception to this. The toArray() method of lists returned by Arrays.asList(...) will return a covariantly typed array. For example, Arrays.asArray(new String[] { "a" }).toArray() will return a String []. FindBugs attempts to detect and suppress such cases, but may miss some.
Repository: findbugs
Key: BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY
Available since 07 Jan 2014
|
|
This method compares an expression of the form (e & C) to D,
which will always compare unequal
due to the specific values of constants C and D.
This may indicate a logic error or typo.
Repository: findbugs
Key: BIT_AND
Available since 07 Jan 2014
|
|
This method compares an expression of the form (e | C) to D.
which will always compare unequal
due to the specific values of constants C and D.
This may indicate a logic error or typo.
Typically, this bug occurs because the code wants to perform
a membership test in a bit set, but uses the bitwise OR
operator ("|") instead of bitwise AND ("&").
Repository: findbugs
Key: BIT_IOR
Available since 07 Jan 2014
|
|
This instanceof test will always return false. Although this is safe, make sure it isn't
an indication of some misunderstanding or some other logic error.
Repository: findbugs
Key: BC_IMPOSSIBLE_INSTANCEOF
Available since 07 Jan 2014
|
|
This code converts an int value to a double precision
floating point number and then
passing the result to the Math.ceil() function, which rounds a double to
the next higher integer value. This operation should always be a no-op,
since the converting an integer to a double should give a number with no fractional part.
It is likely that the operation that generated the value to be passed
to Math.ceil was intended to be performed using double precision
floating point arithmetic.
Repository: findbugs
Key: ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL
Available since 07 Jan 2014
|
|
This code converts an int value to a float precision
floating point number and then
passing the result to the Math.round() function, which returns the int/long closest
to the argument. This operation should always be a no-op,
since the converting an integer to a float should give a number with no fractional part.
It is likely that the operation that generated the value to be passed
to Math.round was intended to be performed using
floating point arithmetic.
Repository: findbugs
Key: ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND
Available since 07 Jan 2014
|
|
The code multiplies the result of an integer remaining by an integer constant.
Be sure you don't have your operator precedence confused. For example
i % 60 * 1000 is (i % 60) * 1000, not i % (60 * 1000).
Repository: findbugs
Key: IM_MULTIPLYING_RESULT_OF_IREM
Available since 07 Jan 2014
|
|
Any expression (exp % 1) is guaranteed to always return zero.
Did you mean (exp & 1) or (exp % 2) instead?
Repository: findbugs
Key: INT_BAD_REM_BY_1
Available since 07 Jan 2014
|