mloayzagahona / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 0 forks source link

java.lang.IllegalStateException: Failed to transform class Reason: PowerMock internal error when modifying method. #372

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I am using the following code:
1) Class Debugger for which I would like to mock static void methods

package uk.ac.open.util;

public class Debugger {

   public static void debug(){System.err.println();}

}

2) My Test class
package uk.ac.open.util;

import junit.framework.Assert;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
//import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
//import static org.powermock.api.easymock.PowerMock.*;

import static org.powermock.api.mockito.PowerMockito.*;
import org.powermock.api.mockito.PowerMockito;

@RunWith( PowerMockRunner.class )
@PrepareForTest( Debugger.class )
public class DebuggerTest {

    public DebuggerTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    @Test
    public void testDebug() {
        mockStatic( Debugger.class );        
        spy(Debugger.class);

        doNothing().when(Debugger.class);
        //PowerMockito.suppress(Debugger.class.getMethods());
        Debugger.debug();

        boolean what = false;
        Assert.assertEquals(true, true);

    }
}

3) I am using the following jar files powermock-mockito-junit-1.4.11.zip 
downloaded today from here: 
http://code.google.com/p/powermock/downloads/detail?name=powermock-mockito-junit
-1.4.11.zip&can=2&q=

What is the expected output? What do you see instead?

I woud expect the test to be successful. Instead the test ends with: 

Testsuite: uk.ac.open.util.DebuggerTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.18 sec

Testcase: initializationError(uk.ac.open.util.DebuggerTest):    Caused an ERROR
Failed to transform class with name uk.ac.open.util.DebuggerTest. Reason: 
PowerMock internal error when modifying method.
java.lang.IllegalStateException: Failed to transform class with name 
uk.ac.open.util.DebuggerTest. Reason: PowerMock internal error when modifying 
method.
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:207)
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:207)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:145)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:65)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:133)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39)
    at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:217)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:59)
    at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
    at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:31)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
Caused by: java.lang.RuntimeException: PowerMock internal error when modifying 
method.
    at org.powermock.core.transformers.impl.MainMockTransformer$PowerMockExpressionEditor.edit(MainMockTransformer.java:304)
    at javassist.expr.ExprEditor.loopBody(ExprEditor.java:191)
    at javassist.expr.ExprEditor.doit(ExprEditor.java:90)
    at javassist.CtClassType.instrument(CtClassType.java:1289)
    at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:75)
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:203)
Caused by: javassist.NotFoundException: debug(..) is not found in 
uk.ac.open.util.Debugger
    at javassist.CtClassType.getMethod(CtClassType.java:1042)
    at javassist.expr.MethodCall.getMethod(MethodCall.java:114)
    at org.powermock.core.transformers.impl.MainMockTransformer$PowerMockExpressionEditor.edit(MainMockTransformer.java:283)

Test uk.ac.open.util.DebuggerTest FAILED

What version of the product are you using? On what operating system?

I am testing on Mac, JDK 1.6.0 . Probably not important, but in Netbeans.

Please provide any additional information below.

I am a newbie to Powermock (so perhaps I am doing something stupid), but I was 
not able to find any solution to this problem anywhere. Seems to me the problem 
might be javaassist. I tried with different versions, but no result.

Many thanks,

Peter

Original issue reported on code.google.com by petrkn...@gmail.com on 21 Feb 2012 at 8:31

GoogleCodeExporter commented 9 years ago
Can you provide an example test and code under test?

Original comment by johan.ha...@gmail.com on 22 Feb 2012 at 9:36

GoogleCodeExporter commented 9 years ago
I will, give me a couple of minutes to create a minimal project.

Original comment by petrkn...@gmail.com on 22 Feb 2012 at 10:00

GoogleCodeExporter commented 9 years ago
I did get the same issue. But after digging further we got figured it out. It 
is actually one of the interface change which caused the issue. Possibly you 
can look into sterotyped collection objects

Original comment by anandara...@gmail.com on 27 Feb 2012 at 9:41

GoogleCodeExporter commented 9 years ago
So what is the solution to this problem.  Is this an issue with PowerMock or is 
their something wrong with the code.  I'm facing this same issue and wondering 
what the solution is.  Thanks.

Original comment by bog...@gmail.com on 23 May 2012 at 5:18

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 24 May 2012 at 5:04

GoogleCodeExporter commented 9 years ago
Did anybody find a solution to this? I'm experiencing the same issue when I try 
to run my tests from within Intellij IDEA 11.

Original comment by oghe...@gmail.com on 28 Jun 2012 at 1:49

GoogleCodeExporter commented 9 years ago
Hmm if you remove @beforeclass and @afterclass does it make any difference?

Original comment by johan.ha...@gmail.com on 29 Jun 2012 at 6:34

GoogleCodeExporter commented 9 years ago
I'm not using @BeforeClass or @AfterClass. I am however using inheritance in 
both the tests and the classes under test (the inheritance is mirrored across 
the source trees) with two @Override'd methods.

Do you think that may be causing the problem?

Original comment by oghe...@gmail.com on 29 Jun 2012 at 3:33

GoogleCodeExporter commented 9 years ago
I am using Intellij 10.5.4 and i dont get this issue. However, when i run it at 
the command line using Ant, this problem occurs.

Original comment by srohith85 on 27 Jul 2012 at 4:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Maybe this helps. I had the same problem and I managed to solve it by not using 
static imports. In my case the issue was with PowerMockito static imports for 
'mockStatic' and 'when' which I replace with direct calls as 
'PowerMockito.mockStatic' and 'PowerMockito.when'.

Original comment by santmatt...@gmail.com on 1 Aug 2012 at 9:58

GoogleCodeExporter commented 9 years ago
For what it's worth, I have what appears that it may be the same problem. I 
encounter the problem when running at the command line using Maven, but only 
when running the WHOLE test suite, not when running a single test. I am not 
using @beforeClass or @afterClass. Others building it (like our build server) 
do not encounter the same problem. I tried removing static imports and that 
didn't fix it. I'd love to follow up by saying what DID fix it, but I haven't 
been able to solve the problem.

Original comment by mcherm on 26 Sep 2012 at 1:55

GoogleCodeExporter commented 9 years ago
Was a solution found for this problem?

Original comment by vivek.na...@gmail.com on 28 Nov 2012 at 12:44

GoogleCodeExporter commented 9 years ago
I found the solution to my issue. I was using a different version of a jar in 
my build path. After cleaning the Maven repository, this error just 
disappeared. Hope this helps.

Original comment by vivek.na...@gmail.com on 6 Dec 2012 at 5:14

GoogleCodeExporter commented 9 years ago
Thanks for sharing.

Original comment by johan.ha...@gmail.com on 6 Dec 2012 at 7:22

GoogleCodeExporter commented 9 years ago
I am getting this error when a colleague of mine using the same code is not.  
I've looked through this list and 4 or 5 other proposed fixes.  It seems that a 
different thing fixes it for someone else, none of which worked for me.  I am 
starting to conclude that Powermock with javassist is not stable enough to be 
used.

Original comment by mpeters...@gmail.com on 14 Dec 2012 at 6:55

GoogleCodeExporter commented 9 years ago
Usually this turn out to be a classpath issue and PowerMock can do nothing 
about this. Are you using Maven? Even if you are you can run into nasty 
classpath issues that are not always easy to resolve if you're using frameworks 
that depend on different versions of the same jar files.

Original comment by johan.ha...@gmail.com on 15 Dec 2012 at 9:06

GoogleCodeExporter commented 9 years ago
mvn clean install solved the problem for me

Original comment by kareemel...@v-cumulus.com on 21 Nov 2013 at 2:08

GoogleCodeExporter commented 9 years ago
Thanks for sharing.

Original comment by johan.ha...@gmail.com on 21 Nov 2013 at 2:12

GoogleCodeExporter commented 9 years ago
Is there any solution for this problem. I am also getting same problem?
initializationError (pakcage name): Failed to transform class with name XXXXX. 
Reason: javassist.bytecode.StringInfo cannot be cast to 
javassist.bytecode.MethodrefInfo

Original comment by umasanka...@gmail.com on 17 Jul 2014 at 10:30

GoogleCodeExporter commented 9 years ago
What's the stacktrace?

Original comment by johan.ha...@gmail.com on 17 Jul 2014 at 4:58

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
<testcase time="0.001" classname=XXXTest" name="initializationError">
    <error message="Failed to transform class with name YY. Reason: javassist.bytecode.StringInfo cannot be cast to javassist.bytecode.MethodrefInfo" type="java.lang.IllegalStateException">java.lang.IllegalStateException: Failed to transform class with name YY. Reason: javassist.bytecode.StringInfo cannot be cast to javassist.bytecode.MethodrefInfo
                at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:219)
                at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:147)
                at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:67)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
                at java.lang.Class.getDeclaredMethods0(Native Method)
                at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
                at java.lang.Class.privateGetPublicMethods(Class.java:2641)
                at java.lang.Class.getMethods(Class.java:1457)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.getTestMethods(PowerMockJUnit44RunnerDelegateImpl.java:95)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.<init>(PowerMockJUnit44RunnerDelegateImpl.java:71)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit49RunnerDelegateImpl.<init>(PowerMockJUnit49RunnerDelegateImpl.java:29)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:143)
                at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39)
                at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:217)
                at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:59)
                at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
                at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:33)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
                at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
                at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
                at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51)
                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:119)
                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:101)
                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:606)
                at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
                at com.sun.proxy.$Proxy0.invoke(Unknown Source)
                at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
                at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.ClassCastException: javassist.bytecode.StringInfo cannot 
be cast to javassist.bytecode.MethodrefInfo
                at javassist.bytecode.ConstPool.getMethodrefType(ConstPool.java:383)
                at javassist.bytecode.stackmap.Tracer.doInvokeMethod(Tracer.java:812)
                at javassist.bytecode.stackmap.Tracer.doOpcode148_201(Tracer.java:617)
                at javassist.bytecode.stackmap.Tracer.doOpcode(Tracer.java:101)
                at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:161)
                at javassist.bytecode.stackmap.MapMaker.traceException(MapMaker.java:192)
                at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:154)
                at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:171)
                at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:171)
                at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:171)
                at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:120)
                at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:96)
                at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:404)
                at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:389)
                at javassist.expr.ExprEditor.doit(ExprEditor.java:112)
                at javassist.CtClassType.instrument(CtClassType.java:1289)
                at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:75)
                at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:215)
                ... 42 more

Original comment by umasanka...@gmail.com on 18 Jul 2014 at 10:55

GoogleCodeExporter commented 9 years ago
Hm are you using the latest version of PowerMock? When I check at line 75 in 
MainMockTransfomer all I see is a "}"

Original comment by johan.ha...@gmail.com on 18 Jul 2014 at 11:48

GoogleCodeExporter commented 9 years ago
I am using 1.5, below are the entries in pom.xml
<dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-module-junit4</artifactId>
                <version>1.5</version>
            </dependency>
            <dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-module-junit4-rule</artifactId>
                <version>1.5</version>
            </dependency>
            <dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-classloading-xstream</artifactId>
                <version>1.5</version>
            </dependency>

Original comment by umasanka...@gmail.com on 19 Jul 2014 at 3:24

GoogleCodeExporter commented 9 years ago
Try upgrading to version 1.5.5 and see if the problem still exist. If it does 
show me the stacktrace.

Original comment by johan.ha...@gmail.com on 19 Jul 2014 at 6:12

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
No Luck..errors again upgrading to 1.5.5

java.lang.IllegalStateException: Failed to transform class with name XXX. 
Reason: bad LDC: 10
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:247)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:177)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:68)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
    at java.lang.Class.privateGetPublicMethods(Class.java:2641)
    at java.lang.Class.getMethods(Class.java:1457)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.getTestMethods(PowerMockJUnit44RunnerDelegateImpl.java:93)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.<init>(PowerMockJUnit44RunnerDelegateImpl.java:69)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl.<init>(PowerMockJUnit47RunnerDelegateImpl.java:42)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit49RunnerDelegateImpl.<init>(PowerMockJUnit49RunnerDelegateImpl.java:25)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:149)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39)
    at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:218)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:59)
    at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
    at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:119)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:101)
    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:606)
    at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
    at com.sun.proxy.$Proxy0.invoke(Unknown Source)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.RuntimeException: bad LDC: 10
    at javassist.bytecode.stackmap.Tracer.doLDC(Tracer.java:289)
    at javassist.bytecode.stackmap.Tracer.doOpcode0_53(Tracer.java:189)
    at javassist.bytecode.stackmap.Tracer.doOpcode(Tracer.java:94)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:161)
    at javassist.bytecode.stackmap.MapMaker.traceException(MapMaker.java:192)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:154)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:171)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:171)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:171)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:120)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:96)
    at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:404)
    at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:389)
    at javassist.expr.ExprEditor.doit(ExprEditor.java:112)
    at javassist.CtClassType.instrument(CtClassType.java:1289)
    at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:74)
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:243)
    ... 43 more

Original comment by umasanka...@gmail.com on 21 Jul 2014 at 5:28

GoogleCodeExporter commented 9 years ago
Unfortunately I suspect that this is an issue with Javassist (the byte-code 
manipulation framework that PowerMock uses). It would be great if you could 
file an issue at Javassist with as much information as possible. 

Original comment by johan.ha...@gmail.com on 23 Jul 2014 at 6:53