When using @Data annotation, checkstyle treats the class as utility class.

1,423 views
Skip to first unread message

sz

unread,
Mar 21, 2014, 12:58:44 PM3/21/14
to project...@googlegroups.com
I am getting a bizarre error when running checkstyle. I have a simple Java class that has a number of private variables. I annotated the class with @Data annotation to create all necessary getters, setters etc. When I run the checkstyle I get this error: Utility classes should not have a public or default constructor. Does anyone know why is the checkstyle treats this class as utility class, and is this a known Lombok or Checkstyle bug?

Thanks!

Reinier Zwitserloot

unread,
Mar 22, 2014, 9:40:09 AM3/22/14
to project-lombok

Does check style run on source files or class files? If the former, perhaps check style considers any class with zero instance methods a utility class. Maybe check style sees no methods, which technically fits the "no instance methods" rule, and complains?

On 21 Mar 2014 18:36, "sz" <serge...@gmail.com> wrote:
I am getting a bizarre error when running checkstyle. I have a simple Java class that has a number of private variables. I annotated the class with @Data annotation to create all necessary getters, setters etc. When I run the checkstyle I get this error: Utility classes should not have a public or default constructor. Does anyone know why is the checkstyle treats this class as utility class, and is this a known Lombok or Checkstyle bug?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages