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;
@Service
@RequiredArgsConstructor
public class SampleService
{
private final String someField;
}
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).