I came across a special case where I cannot solve the DD anomaly in PMD. Assume the code is:
BigDecimal amount = BigDecimal.ZERO;
for(int i=0;i<5;i++)
{
amount = amount.add(i);
}
return amount;
When you run this code through PMD, it will show the DD anomaly when declaring the amount. However, if I remove the initialization, I will get an exception. How can this situation go through PMD. Is anyone
source
share