Hi Reinier,
I find the approach of Stephen Colebourne (a Java pro as you mention) very convenient:
So why not implement it in Lombok as something optional that users can decide to use or not? The default @Getter could be as always was, but why not a @Getter(optional = true) setting to alleviate users to write their own getters for nullable fields when necessary?
I'm sure there are several Lombok users desiring this feature:
The point is, Lombok is mainly used to reduce boilerplate and forcing users to write their own getters for the use cases they want to wrap a field into an Optional is tedious. From the usage standpoint, using Lombok and writing custom getters to just wrap into optional is a little cumbersome.
Thanks,
Gerard
P.S. I know the Optional usage is a very controversial matter, but really makes sense in many cases for a getter as Stephen Colebourne shows in his post.
El diumenge, 18 març de 2018 15:14:06 UTC+1, Reinier Zwitserloot va escriure: