src/main/java/org/plumelib/bcelutil/StackMapUtils.java
@EnsuresNonNull({"stack_map_table"})
  protected final void set_current_stack_map_table(MethodGen mgen, int java_class_version) {

    smta = (StackMap) get_stack_map_table_attribute(mgen);
    if (smta != null) {
      // get a deep copy of the original StackMapTable.
      stack_map_table = ((StackMap) (smta.copy(smta.getConstantPool()))).getStackMap();
      needStackMap = true;

      debug_instrument.log(
          "Attribute tag: %s length: %d nameIndex: %d%n",
          smta.getTag(), smta.getLength(), smta.getNameIndex());
      // Delete existing stack map - we'll add a new one later.
      mgen.removeCodeAttribute(smta);
    } else {
      stack_map_table = empty_stack_map_table;
      if (java_class_version > Const.MAJOR_1_6) {
        needStackMap = true;
      }
    }
    print_stack_map_table("Original");
  }
@EnsuresNonNull({"stack_map_table"})
  protected final void set_current_stack_map_table(MethodGen mgen, int java_class_version) {

    smta = (StackMap) get_stack_map_table_attribute(mgen);
    if (smta != null) {
      // get a deep copy of the original StackMapTable.
      stack_map_table = ((StackMap) (smta.copy(smta.getConstantPool()))).getStackMap();
      needStackMap = true;

      debug_instrument.log(
          "Attribute tag: %s length: %d nameIndex: %d%n",
          smta.getTag(), smta.getLength(), smta.getNameIndex());
      // Delete existing stack map - we'll add a new one later.
      mgen.removeCodeAttribute(smta);
    } else {
      stack_map_table = empty_stack_map_table;
      if (java_class_version > Const.MAJOR_1_6) {
        needStackMap = true;
      }
    }
    print_stack_map_table("Original");
  }
Get existing StackMapTable from the MethodGen argument. If there is none, create a new empty
one. Sets both smta and stack_map_table. Must be called prior to any other methods that
manipulate the stack_map_table!

@param mgen MethodGen to search
@param java_class_version Java version for the classfile; stack_map_table is optional before
Java 1.7 (= classfile version 51)