Skip to content

primitive type array will be throw ClassCastException  #163

Closed

Description

@rjbhewei

when i use primitive type array will be throw ClassCastException

test code like this

def "completes value for an primitive type array"() {
        given:
        ExecutionContext executionContext = new ExecutionContext();
        Field field = new Field()
        def fieldType = new GraphQLList(Scalars.GraphQLLong)
        long[] result = [1L]
        when:
        def executionResult = executionStrategy.completeValue(executionContext, fieldType, [field], result)

        then:
        executionResult.data == [1L]
    }

and the exception like this

Exception in thread "main" java.lang.ClassCastException: [J cannot be cast to [Ljava.lang.Object;

possible reasons here , see this,

i think maybe check the ``result` is a primitive type

if(componentType.isPrimitive()) {
   result = // do samething 
}

Activity

  1. added this to the 5.0 milestone on Sep 11, 2017
  2. bbakerman commented on Sep 11, 2017

    @bbakerman
    Member

    Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions