@RequiredArgsConstructor and primitive fields

435 views
Skip to first unread message

fed

unread,
Jul 2, 2014, 12:06:18 PM7/2/14
to project...@googlegroups.com
Hi,

what is the right way to include a primitive field in costructor created by @RequiredArgsConstructor?

Now I am using @NonNull but on it, it works but I know it's not right and I get a warning.

Thanks.

Roel Spilker

unread,
Jul 2, 2014, 12:07:50 PM7/2/14
to project...@googlegroups.com

Make it final

--
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.

fed

unread,
Jul 2, 2014, 12:09:54 PM7/2/14
to project...@googlegroups.com
I was not clear, it is a mutable field so I can't use final.

Martin Grajcar

unread,
Jul 2, 2014, 1:35:59 PM7/2/14
to project...@googlegroups.com
I'm afraid, @NonNull primitive is about as good as you can get. There was a discussion about flexible constructors, but later the three were established and they seem to cover 99% cases.
Reply all
Reply to author
Forward
0 new messages