File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed
main/java/graphql/annotations
test/java/graphql/annotations Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 33* .iml
44* .ipr
55* .iws
6+ /.nb-gradle /
Original file line number Diff line number Diff line change @@ -200,8 +200,9 @@ public boolean equals(Object obj) {
200200
201201 Class <?> declaringClass = getDeclaringClass (method );
202202
203- boolean valid = (method .getAnnotation (GraphQLField .class ) != null ||
204- declaringClass .getMethod (method .getName (), method .getParameterTypes ()).getAnnotation (GraphQLField .class ) != null );
203+ boolean valid = (method .getAnnotation (GraphQLField .class ) != null ||
204+ declaringClass .getMethod (method .getName (), method .getParameterTypes ()).getAnnotation (GraphQLField .class ) != null )
205+ && !method .isBridge ();
205206
206207 if (valid ) {
207208 builder .field (getField (method ));
Original file line number Diff line number Diff line change @@ -188,6 +188,38 @@ public void methodInheritance() {
188188 assertEquals (((Map <String , Object >)result .getData ()).get ("field1" ), "inherited" );
189189 }
190190
191+ private static class TestObjectBridgMethodParent <Type > {
192+ private final Type id ;
193+ public TestObjectBridgMethodParent (Type id ) {
194+ this .id = id ;
195+ }
196+ public Type id () {
197+ return id ;
198+ }
199+ }
200+
201+ private static class TestObjectBridgMethod extends TestObjectBridgMethodParent <Long > {
202+
203+ public TestObjectBridgMethod () {
204+ super (1l );
205+ }
206+
207+ @ Override @ GraphQLField
208+ public Long id () {
209+ return super .id ();
210+ }
211+ }
212+
213+ @ Test @ SneakyThrows
214+ public void methodInheritanceWithGenerics () {
215+ GraphQLObjectType object = GraphQLAnnotations .object (TestObjectBridgMethod .class );
216+
217+ GraphQLSchema schema = newSchema ().query (object ).build ();
218+
219+ ExecutionResult result = new GraphQL (schema ).execute ("{id}" , new TestObjectBridgMethod ());
220+ assertEquals (((Map <String , Object >)result .getData ()).get ("id" ), 1l );
221+ }
222+
191223 public interface Iface {
192224 @ GraphQLField
193225 default String field () {
You can’t perform that action at this time.
0 commit comments