java.lang.UnsupportedOperationException: Cannot create a generic array for Array. Use createArrayInstance() or anyArray() instead.

GitHub | xiphirx | 6 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Attempting to verify mocked calls with a class that has a string array parameter in its constructor throws UnsupportedOperationException

    GitHub | 6 months ago | xiphirx
    java.lang.UnsupportedOperationException: Cannot create a generic array for Array. Use createArrayInstance() or anyArray() instead.

    Root Cause Analysis

    1. java.lang.UnsupportedOperationException

      Cannot create a generic array for Array. Use createArrayInstance() or anyArray() instead.

      at com.nhaarman.mockito_kotlin.CreateInstanceKt.toArrayInstance()
    2. com.nhaarman.mockito_kotlin
      CreateInstanceKt.createInstance
      1. com.nhaarman.mockito_kotlin.CreateInstanceKt.toArrayInstance(CreateInstance.kt:124)
      2. com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:61)
      3. com.nhaarman.mockito_kotlin.CreateInstanceKt.createNullableInstance(CreateInstance.kt:162)
      4. com.nhaarman.mockito_kotlin.CreateInstanceKt.newInstance(CreateInstance.kt:137)
      5. com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:63)
      5 frames