|
The referenced methods have names that differ only by capitalization.
This is very confusing because if the capitalization were
identical then one of the methods would override the other.
Repository: findbugs
Key: NM_VERY_CONFUSING
Available since 07 Jan 2014
|
|
This partical method invocation doesn't make sense, for reasons that should be apparent from inspection.
Repository: findbugs
Key: DMI_DOH
Available since 07 Jan 2014
|
|
A value stored in the previous switch case is overwritten here due
to a switch fall through. It is likely that you forgot to put a
break or return at the end of the previous case.
Repository: findbugs
Key: SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH
Available since 07 Jan 2014
|
|
A value stored in the previous switch case is ignored here due to a switch fall through to a place where an exception is thrown.
It is likely that you forgot to put a break or return at the end of the previous case.
Repository: findbugs
Key: SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH_TO_THROW
Available since 07 Jan 2014
|
|
This instruction assigns a value to a local variable, but the value is not read or used in
any subsequent instruction. Often, this indicates an error, because the value computed is never
used. There is a field with the same name as the local variable. Did you mean to assign to that
variable instead?
Repository: findbugs
Key: DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD
Available since 07 Jan 2014
|
|
This rule is meant to be used as a way to track code which is marked as being deprecated.
Deprecated code should eventually be removed.
The following code illustrates this rule:
class Foo {
/**
* @deprecated
*/
public void foo() { // Non-Compliant
}
@Deprecated // Non-Compliant
public void bar() {
}
public void baz() { // Compliant
}
}
Repository: squid
Key: S1133
Available since 07 Jan 2014
|
|
Deprecation should be made using both the @Deprecated Java language annotation and @deprecated Javadoc tag.
The annotation enables tools such as IDEs to warn about referencing deprecated elements,
and the tag can be used to explain when it was deprecated, why, and how references should be refactored.
The following code illustrates this rule:
class MyClass {
@Deprecated // Non-Compliant
public void foo1() {
}
/**
* @deprecated
*/
public void foo2() { // Non-Compliant
}
/**
* @deprecated
*/
@Deprecated
public void foo3() { // Compliant
}
}
Repository: squid
Key: MissingDeprecatedCheck
Available since 07 Jan 2014
|
|
An inner class is invoking a method that could be resolved to either a inherited method or a method defined in an outer class. By the Java semantics,
it will be resolved to invoke the inherited method, but this may not be want
you intend. If you really intend to invoke the inherited method,
invoke it by invoking the method on super (e.g., invoke super.foo(17)), and
thus it will be clear to other readers of your code and to FindBugs
that you want to invoke the inherited method, not the method in the outer class.
Repository: findbugs
Key: IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD
Available since 07 Jan 2014
|
|
All targets of this method invocation throw an UnsupportedOperationException.
Repository: findbugs
Key: DMI_UNSUPPORTED_METHOD
Available since 07 Jan 2014
|
|
The code uses x % 2 == 1 to check to see if a value is odd, but this won't work
for negative numbers (e.g., (-5) % 2 == -1). If this code is intending to check
for oddness, consider using x & 1 == 1, or x % 2 != 0.
Repository: findbugs
Key: IM_BAD_CHECK_FOR_ODD
Available since 07 Jan 2014
|
|
This class extends a class that defines an equals method and adds fields, but doesn't
define an equals method itself. Thus, equality on instances of this class will
ignore the identity of the subclass and the added fields. Be sure this is what is intended,
and that you don't need to override the equals method. Even if you don't need to override
the equals method, consider overriding it anyway to document the fact
that the equals method for the subclass just return the result of
invoking super.equals(o).
Repository: findbugs
Key: EQ_DOESNT_OVERRIDE_EQUALS
Available since 07 Jan 2014
|
|
This class uses synchronization along with wait(), notify() or notifyAll() on itself (the this
reference). Client classes that use this class, may, in addition, use an instance of this class
as a synchronizing object. Because two classes are using the same object for synchronization,
Multithread correctness is suspect. You should not synchronize nor call semaphore methods on
a public reference. Consider using a internal private member variable to control synchronization.
Repository: findbugs
Key: PS_PUBLIC_SEMAPHORES
Available since 07 Jan 2014
|
|
This class extends from a Servlet class, and uses an instance member variable. Since only
one instance of a Servlet class is created by the J2EE framework, and used in a
multithreaded way, this paradigm is highly discouraged and most likely problematic. Consider
only using method local variables.
Repository: findbugs
Key: MTIA_SUSPECT_SERVLET_INSTANCE_FIELD
Available since 07 Jan 2014
|
|
This class extends from a Struts Action class, and uses an instance member variable. Since only
one instance of a struts Action class is created by the Struts framework, and used in a
multithreaded way, this paradigm is highly discouraged and most likely problematic. Consider
only using method local variables. Only instance fields that are written outside of a monitor
are reported.
Repository: findbugs
Key: MTIA_SUSPECT_STRUTS_INSTANCE_FIELD
Available since 07 Jan 2014
|
|
This class declares that it implements an interface that is also implemented by a superclass.
This is redundant because once a superclass implements an interface, all subclasses by default also
implement this interface. It may point out that the inheritance hierarchy has changed since
this class was created, and consideration should be given to the ownership of
the interface's implementation.
Repository: findbugs
Key: RI_REDUNDANT_INTERFACES
Available since 07 Jan 2014
|
|
This class is declared to be final, but declares fields to be protected. Since the class
is final, it can not be derived from, and the use of protected is confusing. The access
modifier for the field should be changed to private or public to represent the true
use for the field.
Repository: findbugs
Key: CI_CONFUSED_INHERITANCE
Available since 07 Jan 2014
|
|
This class is bigger than can be effectively handled, and was not fully analyzed for errors.
Repository: findbugs
Key: SKIPPED_CLASS_TOO_BIG
Available since 07 Jan 2014
|
|
This code constructs a File object using a hard coded to an absolute pathname
(e.g., new File("/home/dannyc/workspace/j2ee/src/share/com/sun/enterprise/deployment");
Repository: findbugs
Key: DMI_HARDCODED_ABSOLUTE_FILENAME
Available since 07 Jan 2014
|
|
Are you sure this for loop is incrementing the correct variable?
It appears that another variable is being initialized and checked
by the for loop.
Repository: findbugs
Key: QF_QUESTIONABLE_FOR_LOOP
Available since 07 Jan 2014
|
|
The code computes the average of two integers using either division or signed right shift,
and then uses the result as the index of an array.
If the values being averaged are very large, this can overflow (resulting in the computation
of a negative average). Assuming that the result is intended to be nonnegative, you
can use an unsigned right shift instead. In other words, rather that using (low+high)/2 ,
use (low+high) >>> 1
This bug exists in many earlier implementations of binary search and merge sort.
Martin Buchholz found and fixed it
in the JDK libraries, and Joshua Bloch
widely
publicized the bug pattern.
Repository: findbugs
Key: IM_AVERAGE_COMPUTATION_COULD_OVERFLOW
Available since 07 Jan 2014
|
|
The code stores null into a local variable, and the stored value is not
read. This store may have been introduced to assist the garbage collector, but
as of Java SE 6.0, this is no longer needed or useful.
Repository: findbugs
Key: DLS_DEAD_LOCAL_STORE_OF_NULL
Available since 07 Jan 2014
|
|
This instruction assigns a value to a local variable,
but the value is not read or used in any subsequent instruction.
Often, this indicates an error, because the value computed is never
used.
Note that Sun's javac compiler often generates dead stores for
final local variables. Because FindBugs is a bytecode-based tool,
there is no easy way to eliminate these false positives.
Repository: findbugs
Key: DLS_DEAD_LOCAL_STORE
Available since 07 Jan 2014
|
|
The result of invoking readLine() is dereferenced without checking to see if the result is null. If there are no more lines of text
to read, readLine() will return null and dereferencing that will generate a null pointer exception.
Repository: findbugs
Key: NP_DEREFERENCE_OF_READLINE_VALUE
Available since 07 Jan 2014
|
|
This method contains a double assignment of a local variable; e.g.
public void foo() {
int x,y;
x = x = 17;
}
Assigning the same value to a variable twice is useless, and may indicate a logic error or typo.
Repository: findbugs
Key: SA_LOCAL_DOUBLE_ASSIGNMENT
Available since 07 Jan 2014
|
|
This method uses a try-catch block that catches Exception objects, but Exception is not
thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to
say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception
each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well,
masking potential bugs.
Repository: findbugs
Key: REC_CATCH_EXCEPTION
Available since 07 Jan 2014
|