[squid:S3749] False positive when Lombok @RequiredArgsConstructor

  • SonarQube 7.9 Java Scanner

This sample code is generating a squid:S3749 for someField even though there’s a constructor generated by Lombok that guarantees injection. Also note that replacing @Service with @Component makes the issue go away. That shouldn’t matter as these are functionally equivalent.

import lombok.RequiredArgsConstructor;

public class SampleService 
    private final String someField;
1 Like

Hello thanks for the feedback!

I recently worked on a ticket related to Lombok and stumble into this topic.
The update performed didn’t improve the problem reported here though.
I therefore created a ticket (SONARJAVA-3330) to avoid reporting an issue when fields are injected by Lombok.

Also note that replacing @Service with @Component makes the issue go away

In fact, @Component is not supported in the rule, I created another ticket to improve it(SONARJAVA-3331).


1 Like

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