squid:S1165 Exception classes should be immutable when annotating an exception with lobok's @Value

SonarQube: 7.9.2.30863, SonarJava: 6.1 (build 20866)

Hi. I get a false positive when I use SonarQube together with lombok.

@EqualsAndHashCode(callSuper = false)
@Value
public class CustomException extends RuntimeException {
   String customValue;
}

SonarQube finds an issue “java:S1165 Exception classes should be immutable”.

Since Lombok will make fields on classes annotated with @Value private and final i would argue that this is a false positive.

I have created a pull request that fixes this issue.

Hello @goober

Thanks for clearly reporting this issue and for providing a fix, it is always appreciated.
I created a ticket (SONARJAVA-3320).

I will have a look at the pull request.

Best,
Quentin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.