Skip to content

Fix nullable bound on DataFetcherResult.newResult - #4418

Open
hej090224 wants to merge 1 commit into
graphql-java:masterfrom
hej090224:fix/4364-data-fetcher-result-nullability
Open

Fix nullable bound on DataFetcherResult.newResult#4418
hej090224 wants to merge 1 commit into
graphql-java:masterfrom
hej090224:fix/4364-data-fetcher-result-nullability

Conversation

@hej090224

Copy link
Copy Markdown

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

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

1 participant