Search:     Advanced search
server monitoring

Dead Code: Unused Field

Article ID: 110
Last updated: 06 May, 2008
Views: 248
Posted: 06 May, 2008
by: Tech Pubs S.
Updated: 06 May, 2008
by: Tech Pubs S.

Dead Code: Unused Field

Abstract

This field is never used.

Description

This field is never accessed, except perhaps by dead code. It is likely that the field is simply vestigial, but it is also possible that the unused field points out a bug.

Examples

Example 1:

The field named glue is not used in the following class. The author of the class has accidentally put quotes around the field name, transforming it into a string constant.

	public class Dead {

String glue;

public String getGlue() {
return "glue";
}

}

Example 2:

The field named glue is used in the following class, but only from a method that is never called.

	public class Dead {

String glue;

private String getGlue() {
return glue;
}

}
This article was:   Helpful | Not Helpful
Prev   Next
Dead Code: Unused Method     Dead Code: Expression is Always True