private void transformMethods(Dex in, IndexMap indexMap, ClassData.Method[] methods) {
    int lastOutMethodIndex = 0;
    for (ClassData.Method method : methods) {
      int outMethodIndex = indexMap.adjustMethod(method.getMethodIndex());
      classDataOut.writeUleb128(outMethodIndex - lastOutMethodIndex);
      lastOutMethodIndex = outMethodIndex;

      classDataOut.writeUleb128(method.getAccessFlags());

      if (method.getCodeOffset() == 0) {
        classDataOut.writeUleb128(0);
      } else {
        codeOut.alignToFourBytesWithZeroFill();
        classDataOut.writeUleb128(codeOut.getPosition());
        transformCode(in, in.readCode(method), indexMap);
      }
    }
  }
Transform all annotation set ref lists.
android/android_framework/dex-maker/src/main/java/com/android/dx/merge/DexMerger.java