public void placeItems() {
    throwIfNotPrepared();

    switch (sort) {
      case INSTANCE:
        {
          Collections.sort(items);
          break;
        }
      case TYPE:
        {
          Collections.sort(items, TYPE_SORTER);
          break;
        }
    }

    int sz = items.size();
    int outAt = 0;
    for (int i = 0; i < sz; i++) {
      OffsettedItem one = items.get(i);
      try {
        int placedAt = one.place(this, outAt);

        if (placedAt < outAt) {
          throw new RuntimeException("bogus place() result for " + one);
        }

        outAt = placedAt + one.writeSize();
      } catch (RuntimeException ex) {
        throw ExceptionWithContext.withContext(ex, "...while placing " + one);
      }
    }

    writeSize = outAt;
  }
Places all the items in this instance at particular offsets. This will call {@link
OffsettedItem#place} on each item. If an item does not know its write size before the call to
{@code place}, it is that call which is responsible for setting the write size. This method may
only be called once per instance; subsequent calls will throw an exception.
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/MixedItemSection.java