Skip to content

Backport 26.1: Mark InstrumentationState callback params as @Nullable - #4457

Merged
andimarek merged 2 commits into
26.xfrom
codex/backport-4435-to-26.x
Aug 23, 2026
Merged

Backport 26.1: Mark InstrumentationState callback params as @Nullable#4457
andimarek merged 2 commits into
26.xfrom
codex/backport-4435-to-26.x

Conversation

@andimarek

Copy link
Copy Markdown
Member

Backport of #4435 to the 26.x maintenance branch.

Summary

  • mark instrumentation callback InstrumentationState parameters as @Nullable, matching the existing optional-state runtime contract
  • propagate nullable child states through ChainedInstrumentation and NoContextChainedInstrumentation
  • cover the Kotlin-facing signatures with compile fixtures exercised by Spock
  • retain the existing 26.x field-fetching implementation while applying the nullability fix

This backports the fix for #4433. Kotlin implementations overriding these callbacks must declare the state parameter as InstrumentationState?.

Verification

  • ./gradlew test --tests graphql.execution.instrumentation.InstrumentationStateNullabilityTest --tests graphql.execution.instrumentation.InstrumentationTest --tests graphql.execution.instrumentation.ChainedInstrumentationStateTest --tests graphql.execution.instrumentation.NoContextChainedInstrumentationTest --tests graphql.execution.instrumentation.TracingInstrumentationTest
  • 28 focused tests passed
  • Kotlin compilation and NullAway/ErrorProne checks passed as part of the build

arimu1 and others added 2 commits August 23, 2026 20:12
createState()/createStateAsync() may return null, and the default
SimplePerformantInstrumentation.createState() does. After @NullMarked
on instrumentation classes (#4272), unannotated state parameters were
treated as non-null in Kotlin, causing NPEs for stateless subclasses.

Annotate callback state parameters as @nullable to match the optional-
state runtime contract. ChainedInstrumentation asserts non-null when
casting its own materialized ChainedInstrumentationState.

Fixes #4433
@github-actions

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 - - - - -
Java 17 - - - - -
Java 21 - - - - -
Java 25 - - - - -
jcstress - - - - -

Updated: 2026-08-23 10:25:03 UTC

@andimarek
andimarek merged commit 7a7774d into 26.x Aug 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants