2626import graphql .language .Document ;
2727import graphql .schema .GraphQLSchema ;
2828import graphql .validation .ValidationError ;
29+ import org .jspecify .annotations .NullMarked ;
30+ import org .jspecify .annotations .NullUnmarked ;
2931
3032import java .util .List ;
3133import java .util .Locale ;
32- import java .util .Optional ;
3334import java .util .concurrent .CompletableFuture ;
3435import java .util .concurrent .CompletionException ;
3536import java .util .concurrent .atomic .AtomicReference ;
8283 */
8384@ SuppressWarnings ("Duplicates" )
8485@ PublicApi
86+ @ NullMarked
8587public class GraphQL {
8688
8789 /**
@@ -258,16 +260,17 @@ public GraphQL transform(Consumer<GraphQL.Builder> builderConsumer) {
258260 .queryExecutionStrategy (this .queryStrategy )
259261 .mutationExecutionStrategy (this .mutationStrategy )
260262 .subscriptionExecutionStrategy (this .subscriptionStrategy )
261- .executionIdProvider (Optional . ofNullable ( this .idProvider ). orElse ( builder . idProvider ) )
262- .instrumentation (Optional . ofNullable ( this .instrumentation ). orElse ( builder . instrumentation ) )
263- .preparsedDocumentProvider (Optional . ofNullable ( this .preparsedDocumentProvider ). orElse ( builder . preparsedDocumentProvider ) );
263+ .executionIdProvider (this .idProvider )
264+ .instrumentation (this .instrumentation )
265+ .preparsedDocumentProvider (this .preparsedDocumentProvider );
264266
265267 builderConsumer .accept (builder );
266268
267269 return builder .build ();
268270 }
269271
270272 @ PublicApi
273+ @ NullUnmarked
271274 public static class Builder {
272275 private GraphQLSchema graphQLSchema ;
273276 private ExecutionStrategy queryExecutionStrategy ;
@@ -481,7 +484,7 @@ public CompletableFuture<ExecutionResult> executeAsync(ExecutionInput executionI
481484 EngineRunningState engineRunningState = new EngineRunningState (executionInput , profiler );
482485 return engineRunningState .engineRun (() -> {
483486 ExecutionInput executionInputWithId = ensureInputHasId (executionInput );
484- profiler .setExecutionInput (executionInputWithId );
487+ profiler .setExecutionInputAndInstrumentation (executionInputWithId , instrumentation );
485488 engineRunningState .updateExecutionInput (executionInputWithId );
486489
487490 CompletableFuture <InstrumentationState > instrumentationStateCF = instrumentation .createStateAsync (new InstrumentationCreateStateParameters (this .graphQLSchema , executionInputWithId ));
@@ -543,7 +546,7 @@ private CompletableFuture<ExecutionResult> parseValidateAndExecute(ExecutionInpu
543546 return CompletableFuture .completedFuture (new ExecutionResultImpl (preparsedDocumentEntry .getErrors ()));
544547 }
545548 try {
546- return execute (executionInputRef .get (), preparsedDocumentEntry .getDocument (), graphQLSchema , instrumentationState , engineRunningState , profiler );
549+ return execute (Assert . assertNotNull ( executionInputRef .get () ), preparsedDocumentEntry .getDocument (), graphQLSchema , instrumentationState , engineRunningState , profiler );
547550 } catch (AbortExecutionException e ) {
548551 return CompletableFuture .completedFuture (e .toExecutionResult ());
549552 }
@@ -552,7 +555,7 @@ private CompletableFuture<ExecutionResult> parseValidateAndExecute(ExecutionInpu
552555
553556 private PreparsedDocumentEntry parseAndValidate (AtomicReference <ExecutionInput > executionInputRef , GraphQLSchema graphQLSchema , InstrumentationState instrumentationState ) {
554557
555- ExecutionInput executionInput = executionInputRef .get ();
558+ ExecutionInput executionInput = assertNotNull ( executionInputRef .get () );
556559
557560 ParseAndValidateResult parseResult = parse (executionInput , graphQLSchema , instrumentationState );
558561 if (parseResult .isFailure ()) {
0 commit comments