The example I have failing:
public List<AncestorNodeReference> getAncestors()
{
...
List<AncestorNodeReference> ancestorNodes =
ancestorNodeDTO.getAncestors().stream()
.map(this::createAncestorNodeReference)
.collect(Collectors.toList());
...
}
private AncestorNodeReference createAncestorNodeReference(
final AncesterNodeReferenceDTO ancestorNodeRefDTO)
{
return createAncestorNodeReference(
ancestorNodeRefDTO.getNodeId(),
ancestorNodeRefDTO.getNodeName(),
ancestorNodeRefDTO.getAspectId(),
ancestorNodeRefDTO.getAspectName());
}
private AncestorNodeReference createAncestorNodeReference(
final UUID nodeId,
final String nodeName,
final UUID aspectId,
final String aspectName)
{
...
}
Details
UPM_UNCALLED_PRIVATE_METHOD: Private method is never called
This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed.
It claims that the method createAncestorNodeReference that takes the AncestorNodeReferenceDTO is never called, when in fact it is called by: this::createAncestorNodeReference.
The findbugs version I am using is 3.0.0.
I am using Java version 1.8.0_11 on Ubuntu 12.04.
Thanks for the example. I've added it here: https://code.google.com/p/findbugs/source/detail?r=a6af35d19afa859661aad6aa82f510739605d095
Unfortunately there is no easy way to fix it - FB has to learn method handles first.
Regards,
Andrey
Full support of invokedynamic is far from being complete in FindBugs, but this particular problem can be easily fixed simply by scanning the class constant pool for MethodHandle_info entries. If there's a MethodHandle entry pointing to the method, then the method is used. We don't know where it's used exactly, but we don't need this information for this bug.
Committed:
https://code.google.com/p/findbugs/source/detail?r=28682e92d2890731e4478128dd035a8aeb6d582c