Specify nullness for nodes in the `graphql.language` package by mk868 · Pull Request #3899 · graphql-java/graphql-java
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, nullable fields in the builder are expected.
By default, when a builder instance is created, all values are set to their defaults (null for reference fields) - thus, it's necessary to mark these fields @Nullable.
This initial Builder state represents an incomplete configuration, and the EnumValue should not be constructible in this state - calling the build() method should result in an IllegalStateException.
I planned to add something like this later:
public EnumValue build() { if (name == null) { throw new IllegalStateException("name must be set"); } return new EnumValue(name, sourceLocation, comments, ignoredChars, additionalData); }