Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2339

OpenJPA Ant enhancer task generates .class files with missing stackmap frame

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 2.2.1
    • Fix Version/s: 2.2.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      OpenJPA 2.2.0 & 2.2.1, JaCoCo latest from git, Java 6

      Description

      I have a project which uses JaCoCo for code-coverage testing. Some of the tests load JPA Entities.

      Any JPA entities cause error messages "Missing or invalid stackmap frames." in JaCoCo code, which the developers of JaCoco indicate is a problem in the code enhancing the .class file before, i.e. here Open JPA Enhancer.

      OPENJPA-2085 seems related, but it is fixed in 2.2.0, which I am using. Was this only fixed for Java 7?

      I also upgraded to serp-1.14.1, which seems to have some related fixes, but the problem persists.

      See https://github.com/jacoco/eclemma/issues/35 for a related discussion.

      See the attached sample project/ant-file which reproduces the problem. Simply run "ant test" to trigger the error.

      A full stacktrace is

      [junit] Running MandantTest
      [junit] java.lang.instrument.IllegalClassFormatException: Error while instrumenting class Mandant.
      [junit] at org.jacoco.agent.rt.internal_f6710df.CoverageTransformer.transform(CoverageTransformer.java:91)
      [junit] at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
      [junit] at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:385)
      [junit] at java.lang.ClassLoader.defineClass1(Native Method)
      [junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
      [junit] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      [junit] at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
      [junit] at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
      [junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
      [junit] at java.security.AccessController.doPrivileged(Native Method)
      [junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
      [junit] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
      [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
      [junit] at MandantTest.test(MandantTest.java:10)
      [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [junit] at java.lang.reflect.Method.invoke(Method.java:616)
      [junit] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      [junit] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      [junit] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      [junit] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      [junit] at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
      [junit] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
      [junit] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
      [junit] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      [junit] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      [junit] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      [junit] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      [junit] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      [junit] at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:541)
      [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1064)
      [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:923)
      [junit] Caused by: java.lang.IllegalStateException: Missing or invalid stackmap frames.
      [junit] at org.jacoco.agent.rt.internal_f6710df.core.internal.instr.FrameTracker.assertValidFrames(FrameTracker.java:613)
      [junit] at org.jacoco.agent.rt.internal_f6710df.core.internal.instr.FrameTracker.pop(FrameTracker.java:602)
      [junit] at org.jacoco.agent.rt.internal_f6710df.core.internal.instr.FrameTracker.visitVarInsn(FrameTracker.java:386)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.MethodVisitor.visitVarInsn(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.MethodVisitor.visitVarInsn(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.tree.VarInsnNode.accept(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.tree.InsnList.accept(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.tree.MethodNode.accept(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.core.internal.flow.ClassProbesAdapter$1.visitEnd(ClassProbesAdapter.java:124)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.ClassReader.b(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.ClassReader.accept(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.asm.ClassReader.accept(Unknown Source)
      [junit] at org.jacoco.agent.rt.internal_f6710df.core.instr.Instrumenter.instrument(Instrumenter.java:74)
      [junit] at org.jacoco.agent.rt.internal_f6710df.core.instr.Instrumenter.instrument(Instrumenter.java:87)
      [junit] at org.jacoco.agent.rt.internal_f6710df.CoverageTransformer.transform(CoverageTransformer.java:89)
      [junit] ... 34 more

        Attachments

        1. TestJaCoCoProblem.zip
          6.07 MB
          Dominik Stadler

          Issue Links

            Activity

              People

              • Assignee:
                kwsutter Kevin W. Sutter
                Reporter:
                dominik.stadler@gmx.at Dominik Stadler
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: