graphql-java-annotations icon indicating copy to clipboard operation
graphql-java-annotations copied to clipboard

Detect and fail on overloaded methods

Open shevek opened this issue 4 years ago • 2 comments

The following code is illegal. However, OutputObjectBuilder does not use the definedFields list (could be a set) to detect and fail on the situation. As a result, the schema builds, apparently successfully, but will fail nondeterministically at runtime, depending on which method was returned second by the JDK introspection methods.

public static class Parent {

    @GraphQLNonNull
    @GraphQLField
    public List<Child> getChildren() {
        return Arrays.asList(
                new Child(0),
                new Child(1),
                new Child(2)
        );
    }

    @GraphQLNonNull
    @GraphQLField
    public List<Child> getChildren(@GraphQLName("id") int id) {
        return Arrays.asList(
                new Child(id)
        );
    }
}

shevek avatar May 29 '20 05:05 shevek

Note that we discovered this by porting an application from JDK8 to JDK11.

shevek avatar May 29 '20 05:05 shevek

Thanks. I will get into it at some point. If you can PR this it would be helpfull.

yarinvak avatar Jun 06 '20 21:06 yarinvak

Hi @shevek ,

We're helping with project maintenance and reviewing the list of opened PRs and Issues.

This issue was created quite a while ago, we were wondering if you were still interested in the outcome, please let us know if this is the case.

Without an answer by July 1st, 2023, this issue will be closed as "inactive" (and can always be re-opened later on if needed).

Thanks,

Fgerthoffert avatar Jun 02 '23 08:06 Fgerthoffert