Remove incorrect @Nullable from GraphQLSchema.getCodeRegistry() by andimarek · Pull Request #4247 · graphql-java/graphql-java
Summary
- Remove
@Nullableannotation fromGraphQLSchema.codeRegistryfield andgetCodeRegistry()return type - Fix first-pass constructor to use
builder.codeRegistryinstead of discarding it and setting the field tonull
Why
The field was annotated @Nullable and the first-pass constructor (private GraphQLSchema(Builder)) set this.codeRegistry = null — despite asserting builder.codeRegistry was non-null on the line above. All three constructors require a non-null codeRegistry, and no fully-constructed schema ever exposes a null value.
The @Nullable annotation was misleading and caused downstream code to add unnecessary null checks (e.g. schema.getCodeRegistry() != null guards in validation).
Test plan
- Full test suite passes
🤖 Generated with Claude Code