开发者

Java, ASM org.objectweb.asm.util.CheckClassAdapter causes Unsupported major.minor version 0.0

I am getting following exception:

java.lang.UnsupportedClassVersionError: net/sourceforge/barbecue/BarcodeException : **Unsupported major.minor version 0.0**
    at java.lang.ClassLoader.defi开发者_Python百科neClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
    at pl.wroc.pwr.judy2.master.TestClassLoader.loadClass(TestClassLoader.java:51)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at junit.framework.TestSuite.getTestConstructor(TestSuite.java:83)
    at junit.framework.TestSuite.<init>(TestSuite.java:131)
    at org.junit.internal.runners.JUnit38ClassRunner.<init>(JUnit38ClassRunner.java:67)
    at org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:14)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at junit.framework.JUnit4TestAdapter.<init>(JUnit4TestAdapter.java:31)
    at junit.framework.JUnit4TestAdapter.<init>(JUnit4TestAdapter.java:24)
    at pl.wroc.pwr.judy2.util.JUnitTestRunner.runTest(JUnitTestRunner.java:26)

When trying to instrument some bytecode with below source code. (to be precise, I get this exception when I am trying to execute modified bytecode)

 public byte[] instrument(byte[] bytecode)
        {

        ClassReader cr = new ClassReader(bytecode);
        ClassWriter cw = new ClassWriter(cr, 0);

        // create new class adapter
        AbstractInstrumentClassAdapter ca = new InstrumentClassAdapterTracer(cw, tracer);
        // System.out.println("----------------------------------- Daikon start");
        cr.accept(ca, 0);

        ClassReader cr2 = new ClassReader(cw.toByteArray());
        ClassWriter cw2 = new ClassWriter(cr2, 0);
        ClassAdapter checker = new CheckClassAdapter(cw);
        AbstractInstrumentClassAdapter ca2 = new InstrumentClassAdapterInstrumenter(checker);

        cr2.accept(checker, 0);
        return cw2.toByteArray();
    }

I thought it could be my InstrumentClassAdapterInstrumenter implementation, so I left it out and I am using only CheckClassAdapter at the moment. Can anybody see what am I doing wrong?

Cheers,


LOL, finally as I've asked some question here, it seems to be simple typing error, should be

 ClassWriter cw2 = new ClassWriter(cr2, 0);
 ClassAdapter checker = new CheckClassAdapter(cw2);

not

 ClassWriter cw2 = new ClassWriter(cr2, 0);
 ClassAdapter checker = new CheckClassAdapter(cw);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜