docs: static void write_value(GeneratorAdapter mg,
                              String className,
                              Set<String> classConstantFieldNames,
                              Method method,
                              Class<?> valueClass,
                              int rmicCompatible)
                      throws EJBConfigurationException
      {
          // NOTE: This logic must be kept in sync with getRequiredOutputStreamType.
  
          if (valueClass.isPrimitive())
          {
              if (valueClass == Boolean.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_boolean", "(Z)V");
              }
              else if (valueClass == Character.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_wchar", "(C)V");
              }
              else if (valueClass == Byte.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_octet", "(B)V");
              }
              else if (valueClass == Short.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_short", "(S)V");
              }
              else if (valueClass == Integer.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_long", "(I)V");
              }
              else if (valueClass == Long.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_longlong", "(J)V");
              }
              else if (valueClass == Float.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_float", "(F)V");
              }
              else if (valueClass == Double.TYPE)
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_double", "(D)V");
              }
          }
          else if (valueClass.isInterface())
          {
              if (valueClass == Serializable.class ||
                  valueClass == Externalizable.class)
              {
                  mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "writeAny",
                                     "(Lorg/omg/CORBA/portable/OutputStream;Ljava/lang/Object;)V");
              }
              else if (isCORBAObject(valueClass, rmicCompatible)) // PM46698
              {
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/OutputStream",
                                     "write_Object", "(Lorg/omg/CORBA/Object;)V");
              }
              else if ((Remote.class).isAssignableFrom(valueClass))
              {
                  mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "writeRemoteObject",
                                     "(Lorg/omg/CORBA/portable/OutputStream;Ljava/lang/Object;)V");
              }
              else if (isAbstractInterface(valueClass, rmicCompatible)) // PM46698
              {
                  mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "writeAbstractObject",
                                     "(Lorg/omg/CORBA/portable/OutputStream;Ljava/lang/Object;)V");
              }
              else
              {
                  if (!Serializable.class.isAssignableFrom(valueClass)) // PM46698
                  {
                      mg.visitTypeInsn(CHECKCAST, "java/io/Serializable");
                  }
  
                  JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522
                  mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/OutputStream",
                                     "write_value", "(Ljava/io/Serializable;Ljava/lang/Class;)V");
              }
          }
          else if (valueClass == Object.class)
          {
              mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "writeAny",
                                 "(Lorg/omg/CORBA/portable/OutputStream;Ljava/lang/Object;)V");
          }
          else if ((Remote.class).isAssignableFrom(valueClass))
          {
              // Not a valid RMI/IIOP type - log message and throw exception. d450525
              Tr.error(tc, "JIT_INVALID_ARG_RETURN_TYPE_CNTR5100E",
                       new Object[] { valueClass.getName(),
                                     method.getName(),
                                     method.getDeclaringClass().getName() });
              throw new EJBConfigurationException("Argument or return type " + valueClass.getName() + " of method " +
                                                  method.getName() + " on class " + method.getDeclaringClass().getName() +
                                                  " is not a valid type for RMI/IIOP.");
          }
          else
          {
              mg.checkCast(TYPE_Serializable);
  
              JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522
              mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/OutputStream",
                                 "write_value", "(Ljava/io/Serializable;Ljava/lang/Class;)V");
          }
      }