I think we have false positive in our Sonar's installation (5.6 and java plugin 4.0). An Unused "private" method should be removed issue is raised for the following code :
public boolean orderLineHasDetails(OrderLine orderLine) {
boolean result = orderLine.getContractDevices() != null && orderLine.getContractDevices().size() > 0;
if (result) {
result = asLeastOneUniqueId(orderLine.getContractDevices());
}
return result;
}
private boolean asLeastOneUniqueId(List<ContractDevice> contractDeviceList) {
Iterator<ContractDevice> contractDeviceIterator = contractDeviceList.iterator();
boolean result = false;
while (!result && contractDeviceIterator.hasNext()) {
result = StringUtils.isNotBlank(contractDeviceIterator.next().getDeviceUniqueId());
}
return result;
}
Is this a known bug ?
Thanks for your help.
Edit:
A new false positive inner a method :
Regards,
Stephane
This was a bug in the previous sonar installations. But recently it is fixed and working fine. Try using sonar Lint
from eclipse market place (I hope you are using eclipse) which is the latest release of sonar in eclipse.
I tried this code in my code base and the message is not displayed. So try updating sonar
or sonarqube
to sonar Lint
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With