lombok-intellij-plugin
lombok-intellij-plugin copied to clipboard
Plugin should warn about missing @NonNull fields when object is created by builder
Short description
As a developer I want to lombok-intellij-plugin warns me about missing fields annotated with @NonNull
we object is created with builder. Without it it is only possible to find missing fields during runtime.
Expected behavior
Consider code:
@Builder
class User{
@NonNull
private final String firstName;
@NonNull
private final String lastName;
public static void main(String[] args) {
User user = User.builder()
.firstName("Marcin")
.build(); // Plugin should warn about missing @NonNull fields when object is created by builder
}
}
Plug-in is warning developer somewhere between line User user = User.builder()
and .build();
about missing non null fields. When the field has default value plug-in should not warn.
Why is it useful
I think this features can help to find a bugs and save a lot of developer's time. Especially it is important for not tested or hard to test occasionally run part of code.
This was mentioned as the preferred solution to https://github.com/projectlombok/lombok/wiki/FEATURE-IDEA:-%22Mandatory%22-fields-with-@Builder