Skip to content

Fix nullable bound on DataFetcherResult.newResult - #4418

Merged
bbakerman merged 2 commits into
graphql-java:masterfrom
hej090224:fix/4364-data-fetcher-result-nullability
Aug 14, 2026
Merged

Fix nullable bound on DataFetcherResult.newResult#4418
bbakerman merged 2 commits into
graphql-java:masterfrom
hej090224:fix/4364-data-fetcher-result-nullability

Conversation

@hej090224

Copy link
Copy Markdown
Contributor

Summary:

  • Adds the missing nullable generic bound to the zero-argument DataFetcherResult.newResult() factory method.
  • Allows Kotlin callers under JSpecify null-marked semantics to use nullable result types.
  • Adds a regression source for Kotlin nullable type interoperability.

Problem:

  • DataFetcherResult and its Builder allow nullable type parameters.
  • The zero-argument newResult() method declared an unbounded T.
  • Kotlin therefore interpreted the factory method type parameter as non-null and rejected nullable types.

Testing:

  • ./gradlew compileTestKotlin failed before the Java change with Type argument is not within its bounds for DataFetcherResult.newResult<String?>().
  • ./gradlew compileTestKotlin passed after the change.
  • ./gradlew test --tests graphql.execution.DataFetcherResultTest passed: 26 tests.
  • ./gradlew check -x test -x testng passed.
  • ./gradlew javadoc passed.
  • ./gradlew testng passed: 190 tests.
  • ./gradlew test was run locally on Windows and failed in unrelated graphql.parser.MultiSourceReaderTest.can combine files; the failure reproduces when that test is run alone and appears tied to local checkout line endings for src/test/resources/multisource/a.txt (w/crlf).

Issue:
Fixes #4364

@github-actions

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5927 (±0) 5871 (±0) 0 (±0) 0 (±0) 56 (±0)
Java 17 5927 (±0) 5870 (±0) 0 (±0) 0 (±0) 57 (±0)
Java 21 5927 (±0) 5870 (±0) 0 (±0) 0 (±0) 57 (±0)
Java 25 5927 (±0) 5870 (±0) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 23740 (±0) 23513 (±0) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 30047 3121 90.6% ±0.0%
Branches 8785 1519 85.3% ±0.0%
Methods 8026 1206 86.9% ±0.0%

No per-class coverage changes detected.

Full HTML report: build artifact jacoco-html-report

Updated: 2026-08-13 23:48:57 UTC

@bbakerman
bbakerman merged commit caf4d79 into graphql-java:master Aug 14, 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.

DataFetcherResult.newResult<T>() type parameter missing @Nullable bound for Kotlin JSpecify interop

2 participants