Skip to content

ClassCastException with generic input class #333

Open
@fp31

Description

@fp31

When I write this code:

public class Ab implements GraphQLQueryResolver {
@Data
@NoArgsConstructor
public static class A<T> {
        private T e;
}

public ... find(A<B> c) {
        return ...
}

}

I have the exception below:

Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
at com.coxautodev.graphql.tools.UtilsKt.unwrap(Utils.kt:34)
at com.coxautodev.graphql.tools.GenericType$RelativeTo.parameterizedDeclaringTypeOrSuperType(GenericType.kt:116)
at com.coxautodev.graphql.tools.GenericType$RelativeTo.unwrapGenericType(GenericType.kt:98)
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:34)
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:28)
at com.coxautodev.graphql.tools.SchemaClassScanner.handleNewType(SchemaClassScanner.kt:348)
at com.coxautodev.graphql.tools.SchemaClassScanner.handleFoundType(SchemaClassScanner.kt:328)
at com.coxautodev.graphql.tools.SchemaClassScanner.handleFoundType(SchemaClassScanner.kt:293)
at com.coxautodev.graphql.tools.SchemaClassScanner.scanResolverInfoForPotentialMatches(SchemaClassScanner.kt:268)
at com.coxautodev.graphql.tools.SchemaClassScanner.handleRootType(SchemaClassScanner.kt:119)
at com.coxautodev.graphql.tools.SchemaClassScanner.scanForClasses(SchemaClassScanner.kt:77)
at com.coxautodev.graphql.tools.SchemaParserBuilder.scan(SchemaParserBuilder.kt:165)
at com.coxautodev.graphql.tools.SchemaParserBuilder.build(SchemaParserBuilder.kt:206)
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration.schemaParser(GraphQLJavaToolsAutoConfiguration.java:98)
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$3d1621d9.CGLIB$schemaParser$0()
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$3d1621d9$$FastClassBySpringCGLIB$$a377c22.invoke()

I don't understand why Could you help me ? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions