Incorrect/Inconsistent Sonar Squid Rule regarding Lambdas and Curly Braces - squid:S1602

Version - Version 6.7.6 (build 38781) - LGPL v3

Problem:

This Squid is slightly “Counterproductive” and doesn’t cause issues as it claims

Example:

Consider the following block of java statement:

        Callable<List<String>> loader = () -> {
            return computeForCache(key);
        };

The above is one of the usual cases for using a Callable objects for cache/data loading. It uses the squid:S1604 incorrectly here. There is no way around it. It hinders simplicity by using “Readability” as a metric.

We would request that this squid is revisited and if possible, removed to avoid such issues cropping up.

There is also a similar discussion around Stack Overflow:


Thanks,