val vs final far

78 views
Skip to first unread message

Mati Urban

unread,
May 14, 2024, 7:01:39 AMMay 14
to Project Lombok
Quick question: val Lombok feature has a note on it:

NEW in Lombok 1.18.22: val gets replaced with final var.


From how I read it, it means that if I use Lombok >= 1.18.22 I should use  final var   now, am I wrong?

Thanks in advance!

Rawi

unread,
May 14, 2024, 11:54:29 AMMay 14
to Project Lombok
No, you can still use val, but if you delombok your code it will be replaced with final var instead of the inferred type. We changed this to fix a bunch of bugs and simplify our code. If you are still using an old java version, lombok will use the inferred types as shown on the example page.

Mati Urban

unread,
May 15, 2024, 11:27:37 AMMay 15
to Project Lombok
Thank you very much, Rawi, that solves my issue!

However, I'd like to suggest change in documentation to include that detail: otherwise there may be more confused people like me :)

Have a wonderful day!
Reply all
Reply to author
Forward
0 new messages