diff --git a/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/Bootstrap.java b/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/Bootstrap.java index f2d675272..ec9823faf 100644 --- a/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/Bootstrap.java +++ b/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/Bootstrap.java @@ -291,7 +291,7 @@ private void createGraphQLInterfaceType(InterfaceType interfaceType) { GraphQLInterfaceType graphQLInterfaceType = interfaceTypeBuilder.build(); // To resolve the concrete class this.codeRegistryBuilder.typeResolver(graphQLInterfaceType, new InterfaceResolver(interfaceType)); - this.interfaceMap.put(interfaceType.getClassName(), graphQLInterfaceType); + this.interfaceMap.put(interfaceType.getName(), graphQLInterfaceType); } private void createGraphQLInputObjectTypes() { @@ -316,7 +316,7 @@ private void createGraphQLInputObjectType(InputType inputType) { } GraphQLInputObjectType graphQLInputObjectType = inputObjectTypeBuilder.build(); - inputMap.put(inputType.getClassName(), graphQLInputObjectType); + inputMap.put(inputType.getName(), graphQLInputObjectType); } private void createGraphQLObjectTypes() { @@ -369,15 +369,15 @@ private void createGraphQLObjectType(Type type) { if (type.hasInterfaces()) { Set interfaces = type.getInterfaces(); for (Reference i : interfaces) { - if (interfaceMap.containsKey(i.getClassName())) { - GraphQLInterfaceType graphQLInterfaceType = interfaceMap.get(i.getClassName()); + if (interfaceMap.containsKey(i.getName())) { + GraphQLInterfaceType graphQLInterfaceType = interfaceMap.get(i.getName()); objectTypeBuilder = objectTypeBuilder.withInterface(graphQLInterfaceType); } } } GraphQLObjectType graphQLObjectType = objectTypeBuilder.build(); - typeMap.put(type.getClassName(), graphQLObjectType); + typeMap.put(type.getName(), graphQLObjectType); // Register this output for interface type resolving InterfaceOutputRegistry.register(type, graphQLObjectType); diff --git a/server/implementation/src/test/java/io/smallrye/graphql/test/ClassWithOneGenericsParam.java b/server/implementation/src/test/java/io/smallrye/graphql/test/ClassWithOneGenericsParam.java new file mode 100644 index 000000000..e59d1f724 --- /dev/null +++ b/server/implementation/src/test/java/io/smallrye/graphql/test/ClassWithOneGenericsParam.java @@ -0,0 +1,12 @@ +package io.smallrye.graphql.test; + +public class ClassWithOneGenericsParam { + + public T getParam1() { + return null; + } + + public String getName() { + return null; + } +} diff --git a/server/implementation/src/test/java/io/smallrye/graphql/test/TestEndpoint.java b/server/implementation/src/test/java/io/smallrye/graphql/test/TestEndpoint.java index aa2eaea38..947ceaa90 100644 --- a/server/implementation/src/test/java/io/smallrye/graphql/test/TestEndpoint.java +++ b/server/implementation/src/test/java/io/smallrye/graphql/test/TestEndpoint.java @@ -45,6 +45,18 @@ public List listDefault(@DefaultValue("[\"electric\",\"blue\"]") List getGeneric1() { + return null; + } + + // issue #429 reproducer part 2 + @Query + public ClassWithOneGenericsParam getGeneric2() { + return null; + } + // This method will be ignored, with a WARN in the log, due to below duplicate @Name("timestamp") public TestSource getTestSource(@Source TestObject testObject, String indicator) {