Remove incorrect @Nullable from GraphQLSchema.getCodeRegistry() by andimarek · Pull Request #4247 · graphql-java/graphql-java

Summary

  • Remove @Nullable annotation from GraphQLSchema.codeRegistry field and getCodeRegistry() return type
  • Fix first-pass constructor to use builder.codeRegistry instead of discarding it and setting the field to null

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