重複の可能性:
これらの PMD ルールの理由は何ですか?
DD/DU 警告が表示されるのはなぜですか?
これが私のコードです:
// DD warning from PMD
public Object foo() {
Object result = null;
if (condition) {
// code block, no accec to result
result = newResult;
}
return result;
}
// DU warning from PMD
List<Object> data = new ArrayList<Object>(anotherList);
anotherList.remove(1);
// some other modification of anotherList
if (condition) {
// some code. no access to data
for (Object o : data) {
// loop for original content of the list
}
}
ここで何か問題がありますか?それともPMDのバグですか?これらの警告を無視できますか?