[Java] Lombok usage can be simplified

Hello,

I have a suggestion for a new rule.
Lombok provides a convenience annotation @Data which is a shortcut for
@ToString , @EqualsAndHashCode , @Getter, @Setter, and @RequiredArgsConstructor.

Noncompliant Code

@Getter
@Setter
@EqualsAndHashCode
@ToString
@RequiredArgsConstructor // Non-compliant, can be simplified
class Foo {
  // ...
}

Compliant

@Data // Compliant
class Foo {
  // ...
}
  • type : Code Smell
  • Tags: java, lombok, clumsy

References

It might also make sense to suggest @Data even when only @Getter, @Setter and @RequiredArgsConstructor are used, however, this is not exactly equivalent since @EqualsAndHashCode and @ToString would be added.