Java

Java

By DeepSource

`equals` method defined for enumerationJAVA-E0096
Bug risk

This enum defines an overload for the equals method using the enum's own class type. The equals() method of an enum is not meant to be overloaded (or overridden), and doing so may cause weird bugs to crop up when values of this enum are compared.

Waiting with two locks held is likely to cause a deadlockJAVA-E0139
Bug risk

Waiting on a monitor while two locks are held may cause deadlock. This can also happen with Lock and Condition primitives from the java.util.concurrent package.

Bad short-circuiting null checkJAVA-E1003
Bug risk

This short-circuiting boolean expression using either of the && or || operators attempts to check if a variable is null in its left hand side, and then proceeds to call a method of that variable in its right hand side. However, because of the way it has been written, this expression will allow the right hand side to execute even if the variable is null. This will likely result in a NullPointerException at runtime.

`equals` method does not handle null valued operandsJAVA-E0110
Bug risk

This implementation of equals violates the contract defined by java.lang.Object.equals because it does not check for null being passed as the argument.

Constructor of non-final class starts a threadJAVA-E0208
Bug risk

The constructor starts a thread. This is likely to go wrong if the class is ever extended/subclassed, since the thread will be started before the subclass constructor is executed and will probably cause unexpected behavior.