Example #1
0
 /** Returns the line number for a given position. */
 public int getLineNumber(Instruction pc) {
   if (lineNumbers == null) {
     if (pc == null) return -1;
     else return pc.getPosition();
   }
   int idx = pc.getOffset();
   if (idx < 0) idx = 0;
   return lineNumbers[idx];
 }
  public void instructionExecuted(JVM vm) {
    Instruction insn = vm.getLastInstruction();
    MethodCoverage mc = getMethodCoverage(vm);

    if (mc != null) {
      mc.setExecuted(vm.getLastThreadInfo(), insn);

      if (showRequirements) {
        if (insn.getPosition() == 0) { // first insn in method, check for Requirements
          AnnotationInfo ai = getRequirementsAnnotation(mc.getMethodInfo());
          if (ai != null) {
            String[] ids = ai.getValueAsStringArray();
            updateRequirementsCoverage(ids, mc);
          }
        }
      }
    }
  }