private void injectCode(MethodInfo methodInfo) throws IOException {
    if (methodInfo.getCode() == null) {
      return;
    }

    InterceptorConstants interceptorConstants =
        getOrInsertInterceptorConstants(methodInfo.getInterceptorClass());

    fixupSignature(methodInfo.getSignature());

    Map<String, Integer> wrapperMethods =
        getOrInsertPrimitiveWrapperMethods(methodInfo.getSignature());

    ByteArrayOutputStream codeToInject = new ByteArrayOutputStream();
    InstructionsFacility instructionsFacility =
        new InstructionsFacility(
            new DataOutputStream(codeToInject),
            methodInfo.getSignature(),
            interceptorConstants,
            wrapperMethods);

    instructionsFacility.generateInterceptorInstantiationCode();

    instructionsFacility.generateInterceptorMethodParametersCode(getObjectClassIndex());

    instructionsFacility.generateObjectArrayFillingCode();

    instructionsFacility.generateInterceptorInvocationCode(
        interceptorConstants.getInterceptorMethod());

    Code code = methodInfo.getCode();

    int originalStackSize = code.getMaxStack();
    code.setMaxStack(Math.max(originalStackSize, instructionsFacility.getStackSizeNeeded()));

    code.setInjected(codeToInject.toByteArray());
    code.refresh();
  }