graphql-java-annotations
graphql-java-annotations copied to clipboard
Detect and fail on overloaded methods
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)
);
}
}
Note that we discovered this by porting an application from JDK8 to JDK11.
Thanks. I will get into it at some point. If you can PR this it would be helpfull.
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,