java.lang.IllegalArgumentException: object is not an instance of declaring class

GitHub | craigeebach | 4 months ago
  1. 0

    Mockito cannot mock this class

    Stack Overflow | 19 hours ago | Jacob Clark
    java.lang.IllegalArgumentException: object is not an instance of declaring class
  2. 0

    Mockito 2.2.28 fails to mock an interface when running on IBM JDK

    Google Groups | 4 days ago | Unknown author
    java.lang.IllegalArgumentException: object is not an instance of declaring class
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Mockito object is not an instance of declaring class

    Stack Overflow | 6 months ago | Garret Wilson
    java.lang.IllegalArgumentException: object is not an instance of declaring class
  5. 0

    Exception from ByteBuddy when running Mockito tests in Eclipse

    GitHub | 6 months ago | olivergierke
    java.lang.IllegalArgumentException: object is not an instance of declaring class
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    object is not an instance of declaring class

    at sun.reflect.NativeMethodAccessorImpl.invoke0()
  2. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    4. java.lang.reflect.Method.invoke(Method.java:507)
    4 frames
  3. net.bytebuddy.description
    MethodDescription$AbstractBase.asTypeToken
    1. net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$ForTypeArgument.resolve(TypeDescription.java:3875)
    2. net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$Delegator$Chained.resolve(TypeDescription.java:3501)
    3. net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$ForTypeArgument.resolve(TypeDescription.java:3834)
    4. net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$Delegator.asList(TypeDescription.java:3477)
    5. net.bytebuddy.description.type.TypeDescription$Generic$OfWildcardType$ForLoadedType.getDeclaredAnnotations(TypeDescription.java:4771)
    6. net.bytebuddy.description.type.TypeDescription$Generic$Visitor$TypeVariableErasing.onWildcard(TypeDescription.java:676)
    7. net.bytebuddy.description.type.TypeDescription$Generic$Visitor$TypeVariableErasing.onWildcard(TypeDescription.java:659)
    8. net.bytebuddy.description.type.TypeDescription$Generic$OfWildcardType.accept(TypeDescription.java:4679)
    9. net.bytebuddy.description.type.TypeDescription$Generic$Visitor$TypeVariableErasing.onParameterizedType(TypeDescription.java:687)
    10. net.bytebuddy.description.type.TypeDescription$Generic$Visitor$TypeVariableErasing.onParameterizedType(TypeDescription.java:659)
    11. net.bytebuddy.description.type.TypeDescription$Generic$OfParameterizedType.accept(TypeDescription.java:5021)
    12. net.bytebuddy.description.type.TypeDescription$Generic$LazyProjection.accept(TypeDescription.java:5794)
    13. net.bytebuddy.description.method.ParameterDescription$TypeSubstituting.getType(ParameterDescription.java:859)
    14. net.bytebuddy.description.method.ParameterList$AbstractBase.asTypeList(ParameterList.java:85)
    15. net.bytebuddy.description.method.MethodDescription$AbstractBase.asTypeToken(MethodDescription.java:685)
    15 frames
  4. Byte Buddy (with dependencies)
    DynamicType$Builder$AbstractBase$Delegator.make
    1. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default$Key$Harmonized.of(MethodGraph.java:861)
    2. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default$Key$Store.registerTopLevel(MethodGraph.java:1058)
    3. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.doAnalyze(MethodGraph.java:568)
    4. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.analyze(MethodGraph.java:528)
    5. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.analyzeNullable(MethodGraph.java:547)
    6. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.doAnalyze(MethodGraph.java:561)
    7. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.compile(MethodGraph.java:501)
    8. net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$AbstractBase.compile(MethodGraph.java:422)
    9. net.bytebuddy.dynamic.scaffold.MethodRegistry$Default.prepare(MethodRegistry.java:489)
    10. net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:160)
    11. net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:153)
    12. net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:2564)
    13. net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:2666)
    13 frames
  5. org.mockito.internal
    ByteBuddyMockMaker.createMock
    1. org.mockito.internal.creation.bytebuddy.MockBytecodeGenerator.generateMockClass(MockBytecodeGenerator.java:60)
    2. org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator$CachedBytecodeGenerator.generate(CachingMockBytecodeGenerator.java:99)
    3. org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator$CachedBytecodeGenerator.getOrGenerateMockClass(CachingMockBytecodeGenerator.java:89)
    4. org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator.get(CachingMockBytecodeGenerator.java:37)
    5. org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createProxyClass(ByteBuddyMockMaker.java:54)
    6. org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createMock(ByteBuddyMockMaker.java:27)
    6 frames
  6. Mockito
    SilentJUnitRunner$1.withBefores
    1. org.mockito.internal.util.MockUtil.createMock(MockUtil.java:33)
    2. org.mockito.internal.MockitoCore.mock(MockitoCore.java:60)
    3. org.mockito.Mockito.mock(Mockito.java:1560)
    4. org.mockito.internal.configuration.MockAnnotationProcessor.process(MockAnnotationProcessor.java:33)
    5. org.mockito.internal.configuration.MockAnnotationProcessor.process(MockAnnotationProcessor.java:16)
    6. org.mockito.internal.configuration.DefaultAnnotationEngine.createMockFor(DefaultAnnotationEngine.java:39)
    7. org.mockito.internal.configuration.DefaultAnnotationEngine.process(DefaultAnnotationEngine.java:63)
    8. org.mockito.internal.configuration.InjectingAnnotationEngine.processIndependentAnnotations(InjectingAnnotationEngine.java:59)
    9. org.mockito.internal.configuration.InjectingAnnotationEngine.process(InjectingAnnotationEngine.java:43)
    10. org.mockito.MockitoAnnotations.initMocks(MockitoAnnotations.java:67)
    11. org.mockito.internal.runners.SilentJUnitRunner$1.withBefores(SilentJUnitRunner.java:29)
    11 frames
  7. JUnit
    ParentRunner.run
    1. org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:276)
    2. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    3. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    4. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    5. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    6. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    7. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    8. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    9. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    9 frames
  8. Mockito
    MockitoJUnitRunner.run
    1. org.mockito.internal.runners.SilentJUnitRunner.run(SilentJUnitRunner.java:39)
    2. org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:39)
    3. org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:104)
    3 frames
  9. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    1 frame
  10. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    5 frames