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

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to java.lang.Class

Open shevek opened this issue 6 years ago • 0 comments

    java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to java.lang.Class
        at graphql.annotations.processor.typeFunctions.IterableFunction.buildType(IterableFunction.java:52)
        at graphql.annotations.processor.typeFunctions.DefaultTypeFunction.buildType(DefaultTypeFunction.java:104)
        at graphql.annotations.processor.retrievers.fieldBuilders.method.MethodTypeBuilder.build(MethodTypeBuilder.java:52)
        at graphql.annotations.processor.retrievers.GraphQLFieldRetriever.getField(GraphQLFieldRetriever.java:77)
        at graphql.annotations.processor.typeBuilders.OutputObjectBuilder.getOutputObjectBuilder(OutputObjectBuilder.java:81)
        at graphql.annotations.processor.retrievers.GraphQLTypeRetriever.getGraphQLType(GraphQLTypeRetriever.java:86)
        at graphql.annotations.processor.graphQLProcessors.GraphQLOutputProcessor.getOutputTypeOrRef(GraphQLOutputProcessor.java:44)
        at graphql.annotations.processor.typeFunctions.ObjectFunction.buildType(ObjectFunction.java:55)
        at graphql.annotations.processor.typeFunctions.DefaultTypeFunction.buildType(DefaultTypeFunction.java:104)
        at graphql.annotations.processor.retrievers.fieldBuilders.method.MethodTypeBuilder.build(MethodTypeBuilder.java:52)
        at graphql.annotations.processor.retrievers.GraphQLFieldRetriever.getField(GraphQLFieldRetriever.java:77)
        at graphql.annotations.processor.typeBuilders.OutputObjectBuilder.getOutputObjectBuilder(OutputObjectBuilder.java:81)
        at graphql.annotations.processor.retrievers.GraphQLTypeRetriever.getGraphQLType(GraphQLTypeRetriever.java:86)
        at graphql.annotations.processor.retrievers.GraphQLObjectHandler.getGraphQLType(GraphQLObjectHandler.java:32)
        at graphql.annotations.processor.GraphQLAnnotations.object(GraphQLAnnotations.java:124)

Triggered by a method returning List<? extends String> - in this case, IterableFunction should just use the type-bound of the wildcard. Otherwise, I have to either allocate a potentially very large collection, or break type-safety.

shevek avatar Oct 25 '19 00:10 shevek