Quantcast
Channel: Coding, Rules and Best Practices » Dead/Useless code
Browsing all 20 articles
Browse latest View live

Finalizer does nothing but call superclass finalizer

The only thing this finalize() method does is call the superclass’s finalize() method, making it redundant.  Delete it. Bug category : Bad practice – Violations of recommended and essential coding...

View Article



Dead store due to switch statement fall through

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. Bug category :...

View Article

Dead store due to switch statement fall through to throw

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 …The...

View Article

Unused field

This field is never used.  Consider removing it from the class. Bug category : Performance – code that is not necessarily incorrect but may be inefficient Bug type : UuF / UUF_UNUSED_FIELD Long desc :...

View Article

Unread field

This field is never read.  Consider removing it from the class. Bug category : Performance – code that is not necessarily incorrect but may be inefficient Bug type : UrF / URF_UNREAD_FIELD Long desc :...

View Article


Unused public or protected field

This field is never used. The field is public or protected, so perhaps it is intended to be used with classes not seen as part of the analysis. If not, consider removing it from the class. Bug category...

View Article

Unread public/protected field

This field is never read.&nbsp The field is public or protected, so perhaps it is intended to be used with classes not seen as part of the analysis. If not, consider removing it from the class. Bug...

View Article

Useless control flow

This method contains a useless control flow statement, where control flow continues onto the same place regardless of whether or not the branch is taken. For example, this is caused by having an empty...

View Article


Useless control flow to next line

This method contains a useless control flow statement in which control flow follows to the same or following line regardless of whether or not the branch is taken. Often, this is caused by...

View Article


Self assignment of local rather than assignment to field

This method contains a self assignment of a local variable, and there is a field with an identical name. assignment appears to have been ; e.g.int foo; public void setFoo(int foo) { foo = foo; }The...

View Article

Self assignment of local variable

This method contains a self assignment of a local variable; e.g.public void foo() { int x = 3; x = x; }Such assignments are useless, and may indicate a logic error or typo. Bug category : Dodgy code...

View Article

Self assignment of field

This method contains a self assignment of a field; e.g.int x; public void foo() { x = x; }Such assignments are useless, and may indicate a logic error or typo. Bug category : Correctness – Probable bug...

View Article

Private method is never called

This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed. Bug category :...

View Article


Uncallable method defined in anonymous class

This anonymous class defined a method that is not directly invoked and does not override a method in a superclass. Since methods in other classes cannot directly invoke methods declared in an anonymous...

View Article

A parameter is dead upon entry to a method but overwritten

The initial value of this parameter is ignored, and the parameter is overwritten here. This often indicates a mistaken belief that the write to the parameter will be conveyed back to the caller. Bug...

View Article


Useless assignment in return statement

This statement assigns to a local variable in a return statement. This assignment has effect. Please verify that this statement does the right thing. Bug category : Dodgy code – code that is confusing,...

View Article

Dead store to local variable

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...

View Article


Dead store to local variable that shadows field

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...

View Article

Dead store of class literal

This instruction assigns a class literal to a variable and then never uses it. The behavior of this differs in Java 1.4 and in Java 5. In Java 1.4 and earlier, a reference to Foo.class would force the...

View Article

Dead store of null to local variable

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...

View Article
Browsing all 20 articles
Browse latest View live




Latest Images