-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
The direction of the Java ecosystem seems to be to eliminate @NonNull and have modules or packages set as @NullMarked.
This supports a general direction for null to be the exception.
With there being separate requests for support for @NonNullApi and @NullMarked, perhaps there is a different or new (Lombok 2.0!) direction to take, which would be to treat fields as @NonNull by default with @Nullable being the opt-out.
This goes against the selectivity of @NonNull annotations (@lombok.NonNull more than others) generating null-checks on constructors and setters, but I think would support the general direction of travel in Java.
How do we do this nicely in Lombok though.
From what I understand of the codebase, perhaps trying to modify existing code could be a nightmare.
I therefore doubt that a lombok.config setting to globally flip the script would be maintainable.
What about instead having a lombok.config setting to allow an annotation at class level to trigger a handler.
This could be set to JSpecify's NullMarked if users wanted, but for Lombok the default could be something like @lombok.CheckNulls or @CheckUnlessNullable