Title: DataFetcherResult.newResult
Open Graph Title: DataFetcherResult.newResult
X Title: DataFetcherResult.newResult
Description: Describe the bug DataFetcherResult
Open Graph Description: Describe the bug DataFetcherResult
X Description: Describe the bug DataFetcherResult<T extends @Nullable Object> and Builder<T extends @Nullable Object> correctly allow nullable T. However, the no-arg factory method still declares <...
Opengraph URL: https://github.com/graphql-java/graphql-java/issues/4364
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DataFetcherResult.newResult\u003cT>() type parameter missing @Nullable bound for Kotlin JSpecify interop","articleBody":"**Describe the bug**\n\n`DataFetcherResult\u003cT extends @Nullable Object>` and `Builder\u003cT extends @Nullable Object>` correctly allow nullable T. However, the no-arg factory method still declares `\u003cT>` without the `@Nullable` bound:\n\n```java\npublic static \u003cT> Builder\u003cT> newResult() {\n return new Builder\u003c>();\n}\n```\n\nUnder `@NullMarked`, Kotlin 2.1+ infers `T : Any`, making `DataFetcherResult.newResult\u003cMyType?>()` a compile error.\n\nThis is the same class of issue as #4179 (`getDataLoader` type bounds, fixed in #4180), but for `DataFetcherResult`.\n\n**To Reproduce**\n\n```kotlin\n// graphql-java 25.0, Kotlin 2.3+\n// Compile error: Type argument is not within its bounds: must be subtype of 'Any'\nval result = DataFetcherResult.newResult\u003cString?>()\n .data(null)\n .build()\n```\n\n**Expected behavior**\n\nThe above should compile. Fix:\n\n```java\n- public static \u003cT> Builder\u003cT> newResult()\n+ public static \u003cT extends @Nullable Object> Builder\u003cT> newResult()\n```\n\n**Note**: A fix already exists on branch `claude/kotlin-jspecify-e2e-test-rdaLf` (commit `f8f06a25`, Mar 8 2026) but has no associated PR.\n\n**Versions**: graphql-java 25.0, Kotlin 2.3.20","author":{"url":"https://github.com/mrmegapolys","@type":"Person","name":"mrmegapolys"},"datePublished":"2026-04-02T14:12:47Z","url":"https://github.com/graphql-java/graphql-java/issues/4364"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:02aac573-ac6e-3086-2331-d3ce2f7ef8a6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D780:3B1A19:D5F609:11C6531:6AED4347 |
| html-safe-nonce | ac8ad0af93b73d16366d82741441fb86dff485fa3180b7c1dab7e4a67c499ba8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzgwOjNCMUExOTpENUY2MDk6MTFDNjUzMTo2QUVENDM0NyIsInZpc2l0b3JfaWQiOiI4NDQ4NzczNjE3MzY4MjUzMjU1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 39c3ecd082b0f4919aec90e424b8b41344373b4a8167a3f03f04398fe79a57a3 |
| hovercard-subject-tag | issue:4194888998 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-java/graphql-java/4364/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c6a7e44d60ee2420b7e9f192a93e28662de627c4429ffefbf1b71ca94887d851/graphql-java/graphql-java/issues/4364 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c6a7e44d60ee2420b7e9f192a93e28662de627c4429ffefbf1b71ca94887d851/graphql-java/graphql-java/issues/4364 |
| og:image:alt | Describe the bug DataFetcherResult |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mrmegapolys |
| hostname | github.com |
| expected-hostname | github.com |
| None | 56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11 |
| turbo-cache-control | no-preview |
| go-import | github.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git |
| octolytics-dimension-user_id | 14289921 |
| octolytics-dimension-user_login | graphql-java |
| octolytics-dimension-repository_id | 38602457 |
| octolytics-dimension-repository_nwo | graphql-java/graphql-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38602457 |
| octolytics-dimension-repository_network_root_nwo | graphql-java/graphql-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width