Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903035

AssertionError from BranchCodeMethodAdapter.computeEndBCIsAndFoldInExits

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • tools
    • None

      I have two class files compiled differently from the same source code: one with an IDE and another one with a javac call from ant.

      I am able to instrument one file (from an IDE) but not the other one (from ant).

      This is the exception I am getting:
      Exception in thread "main" java.lang.AssertionError
      at com.sun.tdk.jcov.instrument.BranchCodeMethodAdapter.computeEndBCIsAndFoldInExits(BranchCodeMethodAdapter.java:422)
      at com.sun.tdk.jcov.instrument.BranchCodeMethodAdapter.visitEnd(BranchCodeMethodAdapter.java:497)
      at org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:783)
      at org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:783)
      at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1485)
      at org.objectweb.asm.ClassReader.accept(ClassReader.java:711)
      at com.sun.tdk.jcov.instrument.ClassMorph.morph(ClassMorph.java:257)
      at com.sun.tdk.jcov.Instr$1.instrument(Instr.java:274)
      at com.sun.tdk.jcov.insert.AbstractUniversalInstrumenter.processClassFile(AbstractUniversalInstrumenter.java:182)
      at com.sun.tdk.jcov.insert.AbstractUniversalInstrumenter.instrument(AbstractUniversalInstrumenter.java:616)
      at com.sun.tdk.jcov.insert.AbstractUniversalInstrumenter.instrument(AbstractUniversalInstrumenter.java:542)
      at com.sun.tdk.jcov.Instr.instrumentFiles(Instr.java:212)
      at com.sun.tdk.jcov.Instr.run(Instr.java:548)
      at com.sun.tdk.jcov.tools.JCovCMDTool.run(JCovCMDTool.java:167)
      at com.sun.tdk.jcov.Helper.main(Helper.java:54)

      Attached please find both class files. This is the script I have used:
      -------------------------------------------------------------------------------------
      #!/bin/sh
      instrument ()
      {
        postfix=$1
        cp UserCode.class.$postfix UserCode.class
        $JAVA_HOME/bin/javap -v UserCode.class 1>${postfix}.javap 2>&1
        $JAVA_HOME/bin/java -ea -jar $JCOV_JAR Instr -t template.xml UserCode.class 1>${postfix}.log 2>&1
        echo $postfix status $?
      }
      instrument good
      instrument bad
      -------------------------------------------------------------------------------------
      The output I am getting is:
      -------------------------------------------------------------------------------------
      good status 0
      bad status 1
      -------------------------------------------------------------------------------------

            lkuskov Leonid Kuskov
            shurailine Aleksandre Iline
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: