From 3359e8d22eccbb6fd6a2644d3669cefe103dce78 Mon Sep 17 00:00:00 2001 From: Andreas Marek Date: Sun, 15 Feb 2026 21:29:48 +1000 Subject: [PATCH] Remove incorrect @Nullable from GraphQLSchema.getCodeRegistry() The codeRegistry field was annotated @Nullable and the first-pass constructor set it to null, even though it asserted the builder value was non-null. All three constructors require a non-null codeRegistry, and no fully-constructed schema ever has a null codeRegistry. Fix the first-pass constructor to use the builder's codeRegistry instead of discarding it, and remove @Nullable from the field and getter. Co-Authored-By: Claude Opus 4.6 --- src/main/java/graphql/schema/GraphQLSchema.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/graphql/schema/GraphQLSchema.java b/src/main/java/graphql/schema/GraphQLSchema.java index bf4f5098ec..8ddc2065ec 100644 --- a/src/main/java/graphql/schema/GraphQLSchema.java +++ b/src/main/java/graphql/schema/GraphQLSchema.java @@ -69,7 +69,7 @@ public class GraphQLSchema { private final @Nullable SchemaDefinition definition; private final ImmutableList extensionDefinitions; private final @Nullable String description; - private final @Nullable GraphQLCodeRegistry codeRegistry; + private final GraphQLCodeRegistry codeRegistry; private final ImmutableMap typeMap; private final ImmutableMap> interfaceNameToObjectTypes; @@ -77,7 +77,7 @@ public class GraphQLSchema { /* * This constructs partial GraphQL schema object which has the schema (query / mutation / subscription) trees - * in it but it does not have the collected types, code registry nor the type references replaced + * in it but it does not have the collected types, the correct code registry nor the type references replaced * * But it can be traversed to discover all that and filled out later via another constructor. * @@ -102,7 +102,7 @@ private GraphQLSchema(Builder builder) { this.extensionDefinitions = nonNullCopyOf(builder.extensionDefinitions); this.description = builder.description; - this.codeRegistry = null; + this.codeRegistry = builder.codeRegistry; this.typeMap = ImmutableKit.emptyMap(); this.interfaceNameToObjectTypes = ImmutableKit.emptyMap(); this.interfaceNameToObjectTypeNames = ImmutableKit.emptyMap(); @@ -254,7 +254,7 @@ private static ImmutableMap> buildInterfacesToObje return map.build(); } - public @Nullable GraphQLCodeRegistry getCodeRegistry() { + public GraphQLCodeRegistry getCodeRegistry() { return codeRegistry; }