The rule raises an issue for the following code:
Predicate<Object> predicate = (condition != null) ? condition : x -> true;
^^^^^^^^^
The rule is satisfied if parentheses are added around x -> true
, but this sholdn’t be necessary. There is another report for false-positives when using method references: https://community.sonarsource.com/t/false-positive-on-squid-s864/3182
We are using SonarJava in version 5.14