I have a code analysis tool that puts a line LinkedHashSet<String> widgetsToCreate = new LinkedHashSet<String>();in the method below, any ideas on how to fix the logic that will satisfy the analysis tool?
Dead store for local variable:
This command assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often this indicates an error, since the calculated value is never used. Note that the Sun javac compiler often generates dead repositories for final local variables. Since FindBugs is a bytecode tool, there is no easy way to eliminate these false positives.
public void add(Map<String, String> input) {
TreeSet<String> widgetsToAdd = new TreeSet<String>();
TreeSet<String> widgetsToUpdate = new TreeSet<String>();
LinkedHashSet<String> widgetsToCreate = new LinkedHashSet<String>();
for (Map.Entry<String, String> entry : input.entrySet()) {
}
widgetsToCreate = processInput(widgetsToAdd);
for (Iterator<String> wIterator = widgetsToCreate.iterator(); wIterator.hasNext();) {
}
}
source
share