Java

Java

By DeepSource

Object appears to have been created for no reason JAVA-S0235
Anti-pattern

Our analysis shows that this object is useless. It's created and modified, but its value never goes outside the method or produces any side effect. Either there is a mistake and the object was intended to be used or it can be removed.

Empty catch clauses may hide exceptions JAVA-E0052
Anti-pattern

When a catch clause is empty, it essentially ignores any occurrences of the particular exception it handles. This could allow critical bugs to go undiagnosed because any relevant exceptions indicative of a bug would be discarded within this catch block.

Synchronization performed on a util.concurrent Lock object JAVA-S0321
Anti-pattern

This method performs synchronization on an object that implements java.util.concurrent.locks.Lock. Such an object is locked/unlocked using acquire()/release() rather than using the synchronized (...) construct.

Class is not an Exception/Throwable, even though it is named as such JAVA-S0182
Anti-pattern

This class is not an exception, and does not extend Throwable or any other exception class, but ends with 'Exception'. This may be confusing to users of this class.

Iterator next method must throw NoSuchElementException JAVA-S0146
Anti-pattern

This class implements the java.util.Iterator interface. However, its next() method is not capable of throwing java.util.NoSuchElementException. This is a violation of the Iterator interface's contract, and will not work with code that expects next() to throw when the iterator is exhausted.