{"action":"created","issue":{"url":"https://api.github.com/repos/jacoco/jacoco/issues/208","repository_url":"https://api.github.com/repos/jacoco/jacoco","labels_url":"https://api.github.com/repos/jacoco/jacoco/issues/208/labels{/name}","comments_url":"https://api.github.com/repos/jacoco/jacoco/issues/208/comments","events_url":"https://api.github.com/repos/jacoco/jacoco/issues/208/events","html_url":"https://github.com/jacoco/jacoco/issues/208","id":32238962,"number":208,"title":"java.lang.IllegalStateException: Class ... is already instrumented.","user":{"login":"remmin","id":4263171,"avatar_url":"https://avatars.githubusercontent.com/u/4263171?v=3","gravatar_id":"","url":"https://api.github.com/users/remmin","html_url":"https://github.com/remmin","followers_url":"https://api.github.com/users/remmin/followers","following_url":"https://api.github.com/users/remmin/following{/other_user}","gists_url":"https://api.github.com/users/remmin/gists{/gist_id}","starred_url":"https://api.github.com/users/remmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remmin/subscriptions","organizations_url":"https://api.github.com/users/remmin/orgs","repos_url":"https://api.github.com/users/remmin/repos","events_url":"https://api.github.com/users/remmin/events{/privacy}","received_events_url":"https://api.github.com/users/remmin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jacoco/jacoco/labels/bug","name":"bug","color":"ff3333"},{"url":"https://api.github.com/repos/jacoco/jacoco/labels/core","name":"core","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"marchof","id":1936262,"avatar_url":"https://avatars.githubusercontent.com/u/1936262?v=3","gravatar_id":"","url":"https://api.github.com/users/marchof","html_url":"https://github.com/marchof","followers_url":"https://api.github.com/users/marchof/followers","following_url":"https://api.github.com/users/marchof/following{/other_user}","gists_url":"https://api.github.com/users/marchof/gists{/gist_id}","starred_url":"https://api.github.com/users/marchof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marchof/subscriptions","organizations_url":"https://api.github.com/users/marchof/orgs","repos_url":"https://api.github.com/users/marchof/repos","events_url":"https://api.github.com/users/marchof/events{/privacy}","received_events_url":"https://api.github.com/users/marchof/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2014-04-25T14:55:42Z","updated_at":"2016-05-23T13:53:48Z","closed_at":null,"body":"Hi,\r\n\r\nI'm using the following jacoco  version\r\n\r\n[ivy:resolve] \tfound org.jacoco#org.jacoco.ant;0.7.0.201403182114 in public\r\n[ivy:resolve] \t[0.7.0.201403182114] org.jacoco#org.jacoco.ant;latest.integration\r\n[ivy:resolve] \tfound org.jacoco#org.jacoco.core;0.7.0.201403182114 in public\r\n[ivy:resolve] \tfound org.ow2.asm#asm-debug-all;5.0 in public\r\n[ivy:resolve] \tfound org.jacoco#org.jacoco.report;0.7.0.201403182114 in public\r\n[ivy:resolve] \tfound org.jacoco#org.jacoco.agent;0.7.0.201403182114 in public\r\n[ivy:resolve] \tfound com.googlecode.jmockit#jmockit;1.7 in public\r\n[ivy:resolve] \t[1.7] com.googlecode.jmockit#jmockit;latest.integration\r\n\r\ntogether with jmockit. In one Unit Test I get this error here when running from junit with jacoco\r\n\r\n\r\n\r\n    [junit] java.lang.instrument.IllegalClassFormatException: Error while instrumenting class com/mycompany/myproduct/DataPool.\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.CoverageTransformer.transform(CoverageTransformer.java:89)\r\n    [junit] \tat sun.instrument.TransformerManager.transform(TransformerManager.java:188)\r\n    [junit] \tat sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)\r\n    [junit] \tat sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)\r\n    [junit] \tat sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:170)\r\n    [junit] \tat mockit.internal.startup.Startup.redefineMethods(Startup.java:260)\r\n    [junit] \tat mockit.internal.startup.Startup.redefineMethods(Startup.java:252)\r\n    [junit] \tat mockit.internal.mockups.MockClassSetup.applyClassModifications(MockClassSetup.java:144)\r\n    [junit] \tat mockit.internal.mockups.MockClassSetup.redefineMethodsInClassHierarchy(MockClassSetup.java:101)\r\n    [junit] \tat mockit.internal.mockups.MockClassSetup.redefineMethods(MockClassSetup.java:87)\r\n    [junit] \tat mockit.MockUp.redefineMethods(MockUp.java:117)\r\n    [junit] \tat mockit.MockUp.redefineClassOrImplementInterface(MockUp.java:111)\r\n    [junit] \tat mockit.MockUp.<init>(MockUp.java:74)\r\n    [junit] \tat com.mycompany.testing.myproduct.TransitQueueTest$1.<init>(TransitQueueTest.java:92)\r\n    [junit] \tat com.mycompany.testing.myproduct.TransitQueueTest.testMessageNotInTransitQueueWrongCorrId(TransitQueueTest.java:92)\r\n    [junit] \tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n    [junit] \tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n    [junit] \tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n    [junit] \tat java.lang.reflect.Method.invoke(Method.java:606)\r\n    [junit] \tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)\r\n    [junit] \tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n    [junit] \tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)\r\n    [junit] \tat mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:134)\r\n    [junit] \tat mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:73)\r\n    [junit] \tat mockit.integration.junit4.internal.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:32)\r\n    [junit] \tat sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)\r\n    [junit] \tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n    [junit] \tat java.lang.reflect.Method.invoke(Method.java:606)\r\n    [junit] \tat mockit.internal.util.MethodReflection.invokeWithCheckedThrows(MethodReflection.java:106)\r\n    [junit] \tat mockit.internal.mockups.MockMethodBridge.callMock(MockMethodBridge.java:85)\r\n    [junit] \tat mockit.internal.mockups.MockMethodBridge.invoke(MockMethodBridge.java:44)\r\n    [junit] \tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)\r\n    [junit] \tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n    [junit] \tat org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)\r\n    [junit] \tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)\r\n    [junit] \tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)\r\n    [junit] \tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)\r\n    [junit] \tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)\r\n    [junit] \tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)\r\n    [junit] \tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)\r\n    [junit] \tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)\r\n    [junit] \tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)\r\n    [junit] \tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)\r\n    [junit] \tat org.junit.runners.ParentRunner.run(ParentRunner.java:309)\r\n    [junit] \tat junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38)\r\n    [junit] \tat org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532)\r\n    [junit] \tat org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1165)\r\n    [junit] \tat org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:988)\r\n    [junit] Caused by: java.io.IOException: Error while instrumenting class com/myproduct/mycompany/DataPool.\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.core.instr.Instrumenter.instrumentError(Instrumenter.java:164)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.core.instr.Instrumenter.instrument(Instrumenter.java:115)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.CoverageTransformer.transform(CoverageTransformer.java:87)\r\n    [junit] \t... 47 more\r\n    [junit] Caused by: java.lang.IllegalStateException: Class com/mycompany/myproduct/DataPool is already instrumented.\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.core.internal.instr.InstrSupport.assertNotInstrumented(InstrSupport.java:81)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:79)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.asm.ClassVisitor.visitField(ClassVisitor.java:272)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.asm.ClassReader.readField(ClassReader.java:768)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.asm.ClassReader.accept(ClassReader.java:689)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.asm.ClassReader.accept(ClassReader.java:506)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.core.instr.Instrumenter.instrument(Instrumenter.java:95)\r\n    [junit] \tat org.jacoco.agent.rt.internal_38bf6f6.core.instr.Instrumenter.instrument(Instrumenter.java:113)\r\n    [junit] \t... 48 more\r\n\r\n\r\n\r\nThe unit test class uses jmockit  like this:\r\n\r\n\r\n\r\n\t\t\t new MockUp<DataPool>() {\r\n\t\t\t        @Mock\r\n\t\t\t        public Message getMessageWithServiceSatzId(final Invocation inv, final String satzId) {\r\n\r\n\t\t\t        \tThrowable t = new Throwable();\r\n\t\t\t        \tfor (int i = 0; i < t.getStackTrace().length; i++) {\r\n\r\n\t\t\t        \t\tif (t.getStackTrace()[i].getMethodName().contains(\"sendAntwortMessageToMessageStore\")) {\r\n\t\t\t        \t\t\tLOGGER.warn(\"I'm faking\");\r\n\t\t\t        \t\t\treturn null;\r\n\t\t\t        \t\t}\r\n\t\t\t        \t}\r\n\t\t\t        \treturn inv.proceed(satzId);\r\n\t\t\t        }\r\n\t\t\t    };\r\n\r\nThe idea of the mocked method is to return null only if has been called from a certain method. Not sure if this is the best way do it. Also I don't know if this triggers my exception above. The unit test itself (without jacoco) works fine.\r\n\r\n\r\nWhat can I do to get rid of this exception ? \r\n\r\n\r\nThanks for your help"},"comment":{"url":"https://api.github.com/repos/jacoco/jacoco/issues/comments/220986671","html_url":"https://github.com/jacoco/jacoco/issues/208#issuecomment-220986671","issue_url":"https://api.github.com/repos/jacoco/jacoco/issues/208","id":220986671,"user":{"login":"andreicristianpetcu","id":922368,"avatar_url":"https://avatars.githubusercontent.com/u/922368?v=3","gravatar_id":"","url":"https://api.github.com/users/andreicristianpetcu","html_url":"https://github.com/andreicristianpetcu","followers_url":"https://api.github.com/users/andreicristianpetcu/followers","following_url":"https://api.github.com/users/andreicristianpetcu/following{/other_user}","gists_url":"https://api.github.com/users/andreicristianpetcu/gists{/gist_id}","starred_url":"https://api.github.com/users/andreicristianpetcu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreicristianpetcu/subscriptions","organizations_url":"https://api.github.com/users/andreicristianpetcu/orgs","repos_url":"https://api.github.com/users/andreicristianpetcu/repos","events_url":"https://api.github.com/users/andreicristianpetcu/events{/privacy}","received_events_url":"https://api.github.com/users/andreicristianpetcu/received_events","type":"User","site_admin":false},"created_at":"2016-05-23T13:53:48Z","updated_at":"2016-05-23T13:53:48Z","body":"@marchof Did you say you cannot reporduce? I have this issue on my server. I think it's the same issue. What info do you need in order to fix it?"}}
{"actor":{"display_login":"andreicristianpetcu"}}