{"action":"created","issue":{"url":"https://api.github.com/repos/raphw/byte-buddy/issues/144","repository_url":"https://api.github.com/repos/raphw/byte-buddy","labels_url":"https://api.github.com/repos/raphw/byte-buddy/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/raphw/byte-buddy/issues/144/comments","events_url":"https://api.github.com/repos/raphw/byte-buddy/issues/144/events","html_url":"https://github.com/raphw/byte-buddy/issues/144","id":161495637,"number":144,"title":"Exception from ByteBuddy when running Mockito tests in Eclipse","user":{"login":"olivergierke","id":128577,"avatar_url":"https://avatars.githubusercontent.com/u/128577?v=3","gravatar_id":"","url":"https://api.github.com/users/olivergierke","html_url":"https://github.com/olivergierke","followers_url":"https://api.github.com/users/olivergierke/followers","following_url":"https://api.github.com/users/olivergierke/following{/other_user}","gists_url":"https://api.github.com/users/olivergierke/gists{/gist_id}","starred_url":"https://api.github.com/users/olivergierke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivergierke/subscriptions","organizations_url":"https://api.github.com/users/olivergierke/orgs","repos_url":"https://api.github.com/users/olivergierke/repos","events_url":"https://api.github.com/users/olivergierke/events{/privacy}","received_events_url":"https://api.github.com/users/olivergierke/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/raphw/byte-buddy/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"raphw","id":4489328,"avatar_url":"https://avatars.githubusercontent.com/u/4489328?v=3","gravatar_id":"","url":"https://api.github.com/users/raphw","html_url":"https://github.com/raphw","followers_url":"https://api.github.com/users/raphw/followers","following_url":"https://api.github.com/users/raphw/following{/other_user}","gists_url":"https://api.github.com/users/raphw/gists{/gist_id}","starred_url":"https://api.github.com/users/raphw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphw/subscriptions","organizations_url":"https://api.github.com/users/raphw/orgs","repos_url":"https://api.github.com/users/raphw/repos","events_url":"https://api.github.com/users/raphw/events{/privacy}","received_events_url":"https://api.github.com/users/raphw/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/raphw/byte-buddy/milestones/51","html_url":"https://github.com/raphw/byte-buddy/milestones/1.4.4","labels_url":"https://api.github.com/repos/raphw/byte-buddy/milestones/51/labels","id":1842534,"number":51,"title":"1.4.4","description":null,"creator":{"login":"raphw","id":4489328,"avatar_url":"https://avatars.githubusercontent.com/u/4489328?v=3","gravatar_id":"","url":"https://api.github.com/users/raphw","html_url":"https://github.com/raphw","followers_url":"https://api.github.com/users/raphw/followers","following_url":"https://api.github.com/users/raphw/following{/other_user}","gists_url":"https://api.github.com/users/raphw/gists{/gist_id}","starred_url":"https://api.github.com/users/raphw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphw/subscriptions","organizations_url":"https://api.github.com/users/raphw/orgs","repos_url":"https://api.github.com/users/raphw/repos","events_url":"https://api.github.com/users/raphw/events{/privacy}","received_events_url":"https://api.github.com/users/raphw/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2016-06-22T08:36:53Z","updated_at":"2016-06-22T08:36:53Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-06-21T17:30:16Z","updated_at":"2016-06-23T12:03:34Z","closed_at":null,"body":"I've attached a sample project that produces the following stack trace when run inside Eclipse:\r\n\r\n```\r\norg.mockito.exceptions.base.MockitoException: \r\nMockito cannot mock this class: interface example.SampleTest$MyRepository\r\n\r\nMockito can only mock visible & non-final classes.\r\nIf you're not sure why you're getting this error, please report to the mailing list.\r\n\r\nUnderlying exception : java.lang.IllegalArgumentException: object is not an instance of declaring class\r\n\tat org.mockito.internal.runners.JUnit45AndHigherRunnerImpl$1.withBefores(JUnit45AndHigherRunnerImpl.java:27)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:276)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)\r\n\tat org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)\r\n\tat org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)\r\n\tat org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)\r\nCaused by: java.lang.IllegalArgumentException: object is not an instance of declaring class\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:483)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$ForTypeArgument.resolve(TypeDescription.java:3875)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$Delegator$Chained.resolve(TypeDescription.java:3501)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$ForTypeArgument.resolve(TypeDescription.java:3834)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$AnnotationReader$Delegator.asList(TypeDescription.java:3477)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$OfWildcardType$ForLoadedType.getDeclaredAnnotations(TypeDescription.java:4771)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor.onWildcard(TypeDescription.java:1876)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor$ForTypeVariableBinding.onWildcard(TypeDescription.java:2125)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$OfWildcardType.accept(TypeDescription.java:4679)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor.onParameterizedType(TypeDescription.java:1859)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor$ForTypeVariableBinding.onParameterizedType(TypeDescription.java:2125)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$OfParameterizedType.accept(TypeDescription.java:5021)\r\n\tat net.bytebuddy.description.type.TypeDescription$Generic$LazyProjection.accept(TypeDescription.java:5794)\r\n\tat net.bytebuddy.description.method.ParameterDescription$TypeSubstituting.getType(ParameterDescription.java:859)\r\n\tat net.bytebuddy.description.method.ParameterList$AbstractBase.asTypeList(ParameterList.java:85)\r\n\tat net.bytebuddy.description.method.MethodDescription$AbstractBase.asTypeToken(MethodDescription.java:641)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default$Key$Harmonized.of(MethodGraph.java:862)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default$Key$Store.registerTopLevel(MethodGraph.java:1059)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.doAnalyze(MethodGraph.java:569)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.analyze(MethodGraph.java:529)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.doAnalyze(MethodGraph.java:565)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.analyze(MethodGraph.java:529)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.doAnalyze(MethodGraph.java:565)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$Default.compile(MethodGraph.java:502)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodGraph$Compiler$AbstractBase.compile(MethodGraph.java:423)\r\n\tat net.bytebuddy.dynamic.scaffold.MethodRegistry$Default.prepare(MethodRegistry.java:489)\r\n\tat net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:153)\r\n\tat net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:2570)\r\n\tat org.mockito.internal.creation.bytebuddy.MockBytecodeGenerator.generateMockClass(MockBytecodeGenerator.java:60)\r\n\tat org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator$CachedBytecodeGenerator.generate(CachingMockBytecodeGenerator.java:73)\r\n\tat org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator$CachedBytecodeGenerator.getOrGenerateMockClass(CachingMockBytecodeGenerator.java:65)\r\n\tat org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator.get(CachingMockBytecodeGenerator.java:28)\r\n\tat org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createProxyClass(ByteBuddyMockMaker.java:54)\r\n\tat org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createMock(ByteBuddyMockMaker.java:27)\r\n\tat org.mockito.internal.util.MockUtil.createMock(MockUtil.java:33)\r\n\tat org.mockito.internal.MockitoCore.mock(MockitoCore.java:64)\r\n\tat org.mockito.Mockito.mock(Mockito.java:1559)\r\n\tat org.mockito.internal.configuration.MockAnnotationProcessor.process(MockAnnotationProcessor.java:33)\r\n\tat org.mockito.internal.configuration.MockAnnotationProcessor.process(MockAnnotationProcessor.java:16)\r\n\tat org.mockito.internal.configuration.DefaultAnnotationEngine.createMockFor(DefaultAnnotationEngine.java:41)\r\n\tat org.mockito.internal.configuration.DefaultAnnotationEngine.process(DefaultAnnotationEngine.java:65)\r\n\tat org.mockito.internal.configuration.InjectingAnnotationEngine.processIndependentAnnotations(InjectingAnnotationEngine.java:59)\r\n\tat org.mockito.internal.configuration.InjectingAnnotationEngine.process(InjectingAnnotationEngine.java:43)\r\n\tat org.mockito.MockitoAnnotations.initMocks(MockitoAnnotations.java:80)\r\n\t... 18 more\r\n```\r\n\r\nThe tests run fine one the command line. In my real project that started to appear when I tried upgrading from Mockito 1.x to 2.x (I guess that pulls in an upgrade of ByteBuddy). Looks `ClassLoader` related to me but I didn't dig into the details.\r\n\r\n[byte-buddy-test.zip](https://github.com/raphw/byte-buddy/files/326200/byte-buddy-test.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/raphw/byte-buddy/issues/comments/228029566","html_url":"https://github.com/raphw/byte-buddy/issues/144#issuecomment-228029566","issue_url":"https://api.github.com/repos/raphw/byte-buddy/issues/144","id":228029566,"user":{"login":"raphw","id":4489328,"avatar_url":"https://avatars.githubusercontent.com/u/4489328?v=3","gravatar_id":"","url":"https://api.github.com/users/raphw","html_url":"https://github.com/raphw","followers_url":"https://api.github.com/users/raphw/followers","following_url":"https://api.github.com/users/raphw/following{/other_user}","gists_url":"https://api.github.com/users/raphw/gists{/gist_id}","starred_url":"https://api.github.com/users/raphw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphw/subscriptions","organizations_url":"https://api.github.com/users/raphw/orgs","repos_url":"https://api.github.com/users/raphw/repos","events_url":"https://api.github.com/users/raphw/events{/privacy}","received_events_url":"https://api.github.com/users/raphw/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T12:03:34Z","updated_at":"2016-06-23T12:03:34Z","body":"No problem, thanks for reporting. \r\n\r\nUnfortunately, the type annotations API was very unstable up to update 40+. I reported more than 30 bugs with the API when I implemented support within Byte Buddy. I considered to add work-arounds into Byte Buddy to deal with all the small bugs that are still in the early versions but that would just require too much work. Sorry for the hick-up."}}
{"actor":{"display_login":"raphw"}}