Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Throw at build for resolvers that can't be called on their JDK dynamic proxy in 15.0.0

Open
#868 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
graphql, kotlin, spring

Research direction

Read SchemaClassScanner#warnIfNotCallableOnResolver and the existing FieldResolverError implementation to see how resolver errors are reported. Update SchemaParserTest's “parser handles spring AOP proxied resolvers by default” test to verify the error, including when the resolver fallback options are enabled. Add the change to the 15.0.0 release notes; done means the warning becomes an error with the same message and the tests pass.

Written by the indexing model from the issue text.

Description

Since #853, tools warns at build when a resolver is a JDK dynamic proxy (e.g. Spring AOP with proxyTargetClass = false) and a field resolves to a method or public field the proxy can't call. Spring4AopProxyHandler makes the scanner match fields against the target class, but the proxy only implements the target's interfaces, so every query of those fields fails:

class ProxiedQuery : GraphQLQueryResolver {
    fun test() = "ok"
}

val resolver = ProxyFactory(ProxiedQuery()).proxy as GraphQLQueryResolver

object of type jdk.proxy2.$Proxy2 is not an instance of ProxiedQuery

For a public field it's Can not get final int field ProxiedQuery.count on jdk.proxy2.$Proxy2. For a field, the message says to add a getter as well, since class-based proxies don't pass field reads to the target either. The build logs this once per field:

Field 'Query.test' resolves to scenarios.ProxiedQuery.test, but the resolver is a jdk.proxy2.$Proxy2, which isn't a scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring.

A field that can never work should fail the build. But a schema whose broken field is never queried builds and runs fine today, so throwing has to wait for a major release.

What to change
  • replace the warning in SchemaClassScanner#warnIfNotCallableOnResolver with a FieldResolverError that keeps the same message
  • throw it even with allowUnimplementedResolvers or missingResolverDataFetcher set, since the resolver exists but can't be called
  • turn SchemaParserTest."parser handles spring AOP proxied resolvers by default", which only builds today, into a test for the error
  • mention it in the 15.0.0 release notes
Dominant language
Kotlin
Stars
824
Forks
175
Avg merge
2d 5h
Merged PRs (30d)
52

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from graphql-java-kickstart/graphql-java-tools

All issues in graphql-java-kickstart/graphql-java-tools

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.