|
Deprecated
This class defines a hashCode() method but not an
equals() method. Therefore, the class may
violate the invariant that equal objects must have equal hashcodes.
This rule is deprecated, use squid:S1206 instead.
Repository: findbugs
Key: HE_HASHCODE_NO_EQUALS
Available since 07 Jan 2014
|
|
Class implements Cloneable but does not define or
use the clone method.
Repository: findbugs
Key: CN_IDIOM
Available since 07 Jan 2014
|
|
This class inherits equals(Object) from an abstract
superclass, and hashCode() from
java.lang.Object (which returns
the identity hash code, an arbitrary value assigned to the object
by the VM). Therefore, the class is very likely to violate the
invariant that equal objects must have equal hashcodes.
If you don't want to define a hashCode method, and/or don't
believe the object will ever be put into a HashMap/Hashtable,
define the hashCode() method
to throw UnsupportedOperationException .
Repository: findbugs
Key: HE_INHERITS_EQUALS_USE_HASHCODE
Available since 07 Jan 2014
|
|
This class implements the Externalizable interface, but does
not define a void constructor. When Externalizable objects are deserialized,
they first need to be constructed by invoking the void
constructor. Since this class does not have one,
serialization and deserialization will fail at runtime.
Repository: findbugs
Key: SE_NO_SUITABLE_CONSTRUCTOR_FOR_EXTERNALIZATION
Available since 07 Jan 2014
|
|
This class is not derived from another exception, but ends with 'Exception'. This will
be confusing to users of this class.
Repository: findbugs
Key: NM_CLASS_NOT_EXCEPTION
Available since 07 Jan 2014
|
|
This class implements the Serializable interface
and its superclass does not. When such an object is deserialized,
the fields of the superclass need to be initialized by
invoking the void constructor of the superclass.
Since the superclass does not have one,
serialization and deserialization will fail at runtime.
Repository: findbugs
Key: SE_NO_SUITABLE_CONSTRUCTOR
Available since 07 Jan 2014
|
|
This class implements the Serializable interface, but does
not define a serialVersionUID field.
A change as simple as adding a reference to a .class object
will add synthetic fields to the class,
which will unfortunately change the implicit
serialVersionUID (e.g., adding a reference to String.class
will generate a static field class$java$lang$String ).
Also, different source code to bytecode compilers may use different
naming conventions for synthetic variables generated for
references to class objects or inner classes.
To ensure interoperability of Serializable across versions,
consider adding an explicit serialVersionUID.
Repository: findbugs
Key: SE_NO_SERIALVERSIONID
Available since 07 Jan 2014
|
|
This class/interface has a simple name that is identical to that of an implemented/extended interface, except
that the interface is in a different package (e.g., alpha.Foo extends beta.Foo ).
This can be exceptionally confusing, create lots of situations in which you have to look at import statements
to resolve references and creates many
opportunities to accidently define methods that do not override methods in their superclasses.
Repository: findbugs
Key: NM_SAME_SIMPLE_NAME_AS_INTERFACE
Available since 07 Jan 2014
|
|
This class has a simple name that is identical to that of its superclass, except
that its superclass is in a different package (e.g., alpha.Foo extends beta.Foo ).
This can be exceptionally confusing, create lots of situations in which you have to look at import statements
to resolve references and creates many
opportunities to accidently define methods that do not override methods in their superclasses.
Repository: findbugs
Key: NM_SAME_SIMPLE_NAME_AS_SUPERCLASS
Available since 07 Jan 2014
|
|
This code creates a classloader, which requires a security manager.
If this code will be granted security permissions, but might be invoked by code that does not
have security permissions, then the classloader creation needs to occur inside a doPrivileged block.
Repository: findbugs
Key: DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED
Available since 07 Jan 2014
|
|
This clone method seems to return null in some circumstances, but clone is never
allowed to return a null value. If you are convinced this path is unreachable, throw an AssertionError
instead.
Repository: findbugs
Key: NP_CLONE_COULD_RETURN_NULL
Available since 07 Jan 2014
|
|
This class implements the Comparator interface. You
should consider whether or not it should also implement the Serializable
interface. If a comparator is used to construct an ordered collection
such as a TreeMap , then the TreeMap
will be serializable only if the comparator is also serializable.
As most comparators have little or no state, making them serializable
is generally easy and good defensive programming.
Repository: findbugs
Key: SE_COMPARATOR_SHOULD_BE_SERIALIZABLE
Available since 07 Jan 2014
|
|
This code compares java.lang.String objects for reference
equality using the == or != operators.
Unless both strings are either constants in a source file, or have been
interned using the String.intern() method, the same string
value may be represented by two different String objects. Consider
using the equals(Object) method instead.
Repository: findbugs
Key: ES_COMPARING_STRINGS_WITH_EQ
Available since 07 Jan 2014
|
|
This code compares a java.lang.String parameter for reference
equality using the == or != operators. Requiring callers to
pass only String constants or interned strings to a method is unnecessarily
fragile, and rarely leads to measurable performance gains. Consider
using the equals(Object) method instead.
Repository: findbugs
Key: ES_COMPARING_PARAMETER_STRING_WITH_EQ
Available since 07 Jan 2014
|
|
The referenced methods have names that differ only by capitalization.
Repository: findbugs
Key: NM_CONFUSING
Available since 07 Jan 2014
|
|
This class defines a covariant version of compareTo() .
To correctly override the compareTo() method in the
Comparable interface, the parameter of compareTo()
must have type java.lang.Object .
Repository: findbugs
Key: CO_SELF_NO_OBJECT
Available since 07 Jan 2014
|
|
The code calls putNextEntry() , immediately
followed by a call to closeEntry() . This results
in an empty JarFile entry. The contents of the entry
should be written to the JarFile between the calls to
putNextEntry() and
closeEntry() .
Repository: findbugs
Key: AM_CREATES_EMPTY_JAR_FILE_ENTRY
Available since 07 Jan 2014
|
|
The code calls putNextEntry() , immediately
followed by a call to closeEntry() . This results
in an empty ZipFile entry. The contents of the entry
should be written to the ZipFile between the calls to
putNextEntry() and
closeEntry() .
Repository: findbugs
Key: AM_CREATES_EMPTY_ZIP_FILE_ENTRY
Available since 07 Jan 2014
|
|
IllegalMonitorStateException is generally only
thrown in case of a design flaw in your code (calling wait or
notify on an object you do not hold a lock on).
Repository: findbugs
Key: IMSE_DONT_CATCH_IMSE
Available since 07 Jan 2014
|
|
Empty finalize() methods are useless, so they should
be deleted.
Repository: findbugs
Key: FI_EMPTY
Available since 07 Jan 2014
|
|
This equals method is checking to see if the argument is some incompatible type
(i.e., a class that is neither a supertype nor subtype of the class that defines
the equals method). For example, the Foo class might have an equals method
that looks like:
public boolean equals(Object o) {
if (o instanceof Foo)
return name.equals(((Foo)o).name);
else if (o instanceof String)
return name.equals(o);
else return false;
This is considered bad practice, as it makes it very hard to implement an equals method that
is symmetric and transitive. Without those properties, very unexpected behavoirs are possible.
Repository: findbugs
Key: EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS
Available since 07 Jan 2014
|
|
This class has an equals method that will be broken if it is inherited by subclasses.
It compares a class literal with the class of the argument (e.g., in class Foo
it might check if Foo.class == o.getClass() ).
It is better to check if this.getClass() == o.getClass() .
Repository: findbugs
Key: EQ_GETCLASS_AND_CLASS_CONSTANT
Available since 07 Jan 2014
|
|
The equals(Object o) method shouldn't make any assumptions
about the type of o . It should simply return
false if o is not the same type as this .
Repository: findbugs
Key: BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS
Available since 07 Jan 2014
|
|
This implementation of equals(Object) violates the contract defined
by java.lang.Object.equals() because it does not check for null
being passed as the argument. All equals() methods should return
false if passed a null value.
Repository: findbugs
Key: NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT
Available since 07 Jan 2014
|
|
The class is annotated with net.jcip.annotations.Immutable, and the rules for that annotation require
that all fields are final.
.
Repository: findbugs
Key: JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS
Available since 07 Jan 2014
|