@Override
  public void visitTypeInsn(int opcode, String typeName) {
    if (opcode == Opcodes.NEW) {
      // We can't actually tag this object right after allocation because it
      // must be initialized with a ctor before we can touch it (Verifier
      // enforces this).  Instead, we just note it and tag following
      // initialization.
      super.visitTypeInsn(opcode, typeName);
      ++outstandingAllocs;
    } else if (opcode == Opcodes.ANEWARRAY) {
      super.visitInsn(Opcodes.DUP);
      super.visitTypeInsn(opcode, typeName);
      invokeRecordAllocation(typeName);
    } else {
      super.visitTypeInsn(opcode, typeName);
    }
  }
new and anewarray bytecodes take a String operand for the type of the object or array element
so we hook them here. Note that new doesn't actually result in any instrumentation here; we
just do a bit of book-keeping and do the instrumentation following the constructor call
(because we're not allowed to touch the object until it is initialized).
src/main/java/com/google/monitoring/runtime/instrumentation/AllocationMethodAdapter.java