jMockitのDynamic partial mockingとEclEMMAでIllegalClassFormatException

jMockitのDynamic partial mockingを使っているテストコードをEclEMMAで動かすと、IllegalClassFormatExceptionが発生する。

環境は、以下のとおり

| F/Wなど | ver |
|:-------:|:---:|
| jMockit | 1.0 |
| EclEMMA | 2.2.0.201210261515 |
| TestNG | 6.8 |
| Java | Oracle JDK SE 7u15(JDK6でも同様) |

```java:TestTarget.java
package tv.dyndns.poad;

/**
 * テスト対象
 */
public class TestTarget {
    
    public long targetMethod() {
        long val = Singleton.StaticMethod();
        System.out.println(val);
        return val;
    }
}
```
```java:Singleton.java
/**
 * 
 */
package tv.dyndns.poad;

/**
 * @author PoaD
 * 
 */
public class Singleton {
    
    public static long StaticMethod() {
        return System.currentTimeMillis();
    }
    
}
```

```java:Sample_test.java
package tv.dyndns.poad;

import junit.framework.Assert;
import mockit.NonStrictExpectations;

import org.testng.annotations.Test;

/**
 * Testクラス
 */
public class Sample_test {
    
    private final TestTarget target = new TestTarget();
    
    @Test
    public void err() {
        
        // IllegalClassFormatExceptionがthrowされる
        new NonStrictExpectations(Singleton.class) {
            {
                Singleton.StaticMethod();
                result = 0L;
            }
        };
        Assert.assertEquals(target.targetMethod(), 0L);
    }
}
```

ログ

```
java.lang.instrument.IllegalClassFormatException: Error while instrumenting class tv/dyndns/poad/Singleton.
	at org.jacoco.agent.rt_kqcpih.CoverageTransformer.transform(CoverageTransformer.java:91)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
	at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
	at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:170)
	at mockit.internal.startup.Startup.redefineMethods(Startup.java:184)
	at mockit.internal.RedefinitionEngine.redefineMethods(RedefinitionEngine.java:63)
	at mockit.internal.expectations.mocking.DynamicPartialMocking.redefineTypes(DynamicPartialMocking.java:34)
	at mockit.internal.expectations.RecordAndReplayExecution.applyDynamicPartialMocking(RecordAndReplayExecution.java:186)
	at mockit.internal.expectations.RecordAndReplayExecution.<init>(RecordAndReplayExecution.java:107)
	at mockit.Expectations.<init>(Expectations.java:190)
	at mockit.NonStrictExpectations.<init>(NonStrictExpectations.java:49)
	at tv.dyndns.poad.Sample_test$1.<init>(Sample_test.java:20)
	at tv.dyndns.poad.Sample_test.err(Sample_test.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
	at org.testng.TestRunner.privateRun(TestRunner.java:767)
	at org.testng.TestRunner.run(TestRunner.java:617)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
	at org.testng.TestNG.run(TestNG.java:1036)
	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.IllegalStateException: Class tv/dyndns/poad/Singleton is already instrumented.
	at org.jacoco.agent.rt_kqcpih.core.internal.instr.ClassInstrumenter.assertNotInstrumented(ClassInstrumenter.java:133)
	at org.jacoco.agent.rt_kqcpih.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:81)
	at org.jacoco.agent.rt_kqcpih.asm.ClassVisitor.visitField(Unknown Source)
	at org.jacoco.agent.rt_kqcpih.asm.ClassReader.accept(Unknown Source)
	at org.jacoco.agent.rt_kqcpih.asm.ClassReader.accept(Unknown Source)
	at org.jacoco.agent.rt_kqcpih.core.instr.Instrumenter.instrument(Instrumenter.java:69)
	at org.jacoco.agent.rt_kqcpih.core.instr.Instrumenter.instrument(Instrumenter.java:82)
	at org.jacoco.agent.rt_kqcpih.CoverageTransformer.transform(CoverageTransformer.java:89)
	... 37 more
java.lang.instrument.IllegalClassFormatException: Error while instrumenting class tv/dyndns/poad/Singleton.
	at org.jacoco.agent.rt_kqcpih.CoverageTransformer.transform(CoverageTransformer.java:91)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
	at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
	at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:170)
	at mockit.internal.startup.Startup.redefineMethods(Startup.java:184)
	at mockit.internal.startup.Startup.redefineMethods(Startup.java:176)
	at mockit.internal.RedefinitionEngine.redefineMethods(RedefinitionEngine.java:47)
	at mockit.internal.RedefinitionEngine.restoreOriginalDefinition(RedefinitionEngine.java:81)
	at mockit.internal.RedefinitionEngine.restoreDefinition(RedefinitionEngine.java:69)
	at mockit.internal.state.MockFixture.restoreRedefinedClasses(MockFixture.java:209)
	at mockit.internal.state.SavePoint.rollback(SavePoint.java:45)
	at mockit.integration.internal.TestRunnerDecorator.concludeTestMethodExecution(TestRunnerDecorator.java:177)
	at mockit.integration.testng.internal.TestNGRunnerDecorator.concludeTestExecutionWithNothingThrown(TestNGRunnerDecorator.java:212)
	at mockit.integration.testng.internal.TestNGRunnerDecorator.afterInvocation(TestNGRunnerDecorator.java:171)
	at org.testng.internal.invokers.InvokedMethodListenerInvoker$InvokeAfterInvocationWithoutContextStrategy.callMethod(InvokedMethodListenerInvoker.java:100)
	at org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:62)
	at org.testng.internal.Invoker.runInvokedMethodListeners(Invoker.java:619)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:777)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
	at org.testng.TestRunner.privateRun(TestRunner.java:767)
	at org.testng.TestRunner.run(TestRunner.java:617)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
	at org.testng.TestNG.run(TestNG.java:1036)
	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.IllegalStateException: Class tv/dyndns/poad/Singleton is already instrumented.
	at org.jacoco.agent.rt_kqcpih.core.internal.instr.ClassInstrumenter.assertNotInstrumented(ClassInstrumenter.java:133)
	at org.jacoco.agent.rt_kqcpih.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:81)
	at org.jacoco.agent.rt_kqcpih.asm.ClassVisitor.visitField(Unknown Source)
	at org.jacoco.agent.rt_kqcpih.asm.ClassReader.accept(Unknown Source)
	at org.jacoco.agent.rt_kqcpih.asm.ClassReader.accept(Unknown Source)
	at org.jacoco.agent.rt_kqcpih.core.instr.Instrumenter.instrument(Instrumenter.java:69)
	at org.jacoco.agent.rt_kqcpih.core.instr.Instrumenter.instrument(Instrumenter.java:82)
	at org.jacoco.agent.rt_kqcpih.CoverageTransformer.transform(CoverageTransformer.java:89)
	... 36 more
(以下略)
```