Title: DataFetchingEnvironment getDataLoader doesn't match DataLoader signature · Issue #4179 · graphql-java/graphql-java · GitHub
Open Graph Title: DataFetchingEnvironment getDataLoader doesn't match DataLoader signature · Issue #4179 · graphql-java/graphql-java
X Title: DataFetchingEnvironment getDataLoader doesn't match DataLoader signature · Issue #4179 · graphql-java/graphql-java
Description: Describe the bug DataFetchingEnvironment.getDataLoader
Open Graph Description: Describe the bug DataFetchingEnvironment.getDataLoader
X Description: Describe the bug DataFetchingEnvironment.getDataLoader<K, V>() has type parameters that are implicitly non-null due to @NullMarked but DataLoader<K, V extends @Nullable Object> explicit...
Opengraph URL: https://github.com/graphql-java/graphql-java/issues/4179
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DataFetchingEnvironment getDataLoader doesn't match DataLoader signature","articleBody":"**Describe the bug**\n\n[`DataFetchingEnvironment.getDataLoader\u003cK, V\u003e()`](https://github.com/graphql-java/graphql-java/blob/ed0791c75c681aa4cc750ca7a359bdb32225c1bd/src/main/java/graphql/schema/DataFetchingEnvironment.java#L241) has type parameters that are implicitly non-null due to [`@NullMarked`](https://github.com/graphql-java/graphql-java/blob/ed0791c75c681aa4cc750ca7a359bdb32225c1bd/src/main/java/graphql/schema/DataFetchingEnvironment.java#L31) but [`DataLoader\u003cK, V extends @Nullable Object\u003e`](https://github.com/graphql-java/java-dataloader/blob/918203c03acb041426171ae8dc672d88174747dd/src/main/java/org/dataloader/DataLoader.java#L72) explicitly allows nullable V. This creates a type mismatch when calling from Kotlin. As of Kotlin 2.1.0, Kotlin compiler treats JSpecify types as null-safe types. \n\n**To Reproduce**\n\nFrom Kotlin, attempt to get a DataLoader with a nullable value type:\n\n```kotlin\n// Kotlin sees getDataLoader as requiring V : Any\nval loader: DataLoader\u003cString, Player?\u003e? = env.getDataLoader(\"PlayerLoader\")\n// Error: Type argument is not within its bounds: must be subtype of 'Any'\n```\n\n","author":{"url":"https://github.com/ctbarbour","@type":"Person","name":"ctbarbour"},"datePublished":"2025-11-25T21:33:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/4179/graphql-java/issues/4179"}
| 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:1671d6b4-94f9-5e85-5328-03ac0cccb5db |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE28:2D650D:B93EE9:106C63D:696FB9E9 |
| html-safe-nonce | bcb5d8b04cf1ed495291cc9c74f41afa33e0c8255dcd639d962b196b52cb622d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTI4OjJENjUwRDpCOTNFRTk6MTA2QzYzRDo2OTZGQjlFOSIsInZpc2l0b3JfaWQiOiIyMzU5MTE4OTc5MzIzMTE2MDA5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 55ebc323a9243e7c6c8cad926fa65c7e67c52706f1dd62d526d5f84906fc914d |
| hovercard-subject-tag | issue:3664667861 |
| 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/4179/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ed7e33bf1681f7b40743a9793c25dedc93457c61da5692f7d330a39d9da7fe38/graphql-java/graphql-java/issues/4179 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ed7e33bf1681f7b40743a9793c25dedc93457c61da5692f7d330a39d9da7fe38/graphql-java/graphql-java/issues/4179 |
| og:image:alt | Describe the bug DataFetchingEnvironment.getDataLoader |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ctbarbour |
| hostname | github.com |
| expected-hostname | github.com |
| None | 40ce4030a7db32193be29054756ed7f7eceec3a82973f060300035bdff8cf777 |
| 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 | 1cdcabe0d7ddc4be91a713d57280849e4c89f5cd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width