public static PositionList make(DalvInsnList insns, int howMuch) {
    switch (howMuch) {
      case NONE:
        {
          return EMPTY;
        }
      case LINES:
      case IMPORTANT:
        {
          // Valid.
          break;
        }
      default:
        {
          throw new IllegalArgumentException("bogus howMuch");
        }
    }

    SourcePosition noInfo = SourcePosition.NO_INFO;
    SourcePosition cur = noInfo;
    int sz = insns.size();
    Entry[] arr = new Entry[sz];
    boolean lastWasTarget = false;
    int at = 0;

    for (int i = 0; i < sz; i++) {
      DalvInsn insn = insns.get(i);

      if (insn instanceof CodeAddress) {
        lastWasTarget = true;
        continue;
      }

      SourcePosition pos = insn.getPosition();

      if (pos.equals(noInfo) || pos.sameLine(cur)) {
        continue;
      }

      if ((howMuch == IMPORTANT) && !lastWasTarget) {
        continue;
      }

      cur = pos;
      arr[at] = new Entry(insn.getAddress(), pos);
      at++;

      lastWasTarget = false;
    }

    PositionList result = new PositionList(at);
    for (int i = 0; i < at; i++) {
      result.set(i, arr[i]);
    }

    result.setImmutable();
    return result;
  }
Extracts and returns the source position information out of an instruction list.

@param insns {@code non-null;} instructions to convert
@param howMuch how much information should be included; one of the static constants defined by
    this class
@return {@code non-null;} the positions list
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/PositionList.java