code: private ObjectStreamClass writeEnumDesc(ObjectStreamClass classDesc, boolean unshared)
              throws IOException {
          // write classDesc, classDesc for enum is different
  
          // set flag for enum, the flag is (SC_SERIALIZABLE | SC_ENUM)
          classDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
          int previousHandle = -1;
          if (unshared) {
              previousHandle = objectsWritten.get(classDesc);
          }
          int handle = -1;
          if (!unshared) {
              handle = dumpCycle(classDesc);
          }
          if (handle == -1) {
              Class<?> classToWrite = classDesc.forClass();
              // If we got here, it is a new (non-null) classDesc that will have
              // to be registered as well
              registerObjectWritten(classDesc);
  
              output.writeByte(TC_CLASSDESC);
              if (protocolVersion == PROTOCOL_VERSION_1) {
                  writeNewClassDesc(classDesc);
              } else {
                  // So write...() methods can be used by
                  // subclasses during writeClassDescriptor()
                  primitiveTypes = output;
                  writeClassDescriptor(classDesc);
                  primitiveTypes = null;
              }
              // Extra class info (optional)
              annotateClass(classToWrite);
              drain(); // flush primitive types in the annotation
              output.writeByte(TC_ENDBLOCKDATA);
              // write super class
              ObjectStreamClass superClassDesc = classDesc.getSuperclass();
              if (superClassDesc != null) {
                  // super class is also enum
                  superClassDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
                  writeEnumDesc(superClassDesc, unshared);
              } else {
                  output.writeByte(TC_NULL);
              }
              if (unshared) {
                  // remove reference to unshared object
                  removeUnsharedReference(classDesc, previousHandle);
              }
          }
          return classDesc;
      }
docs: write for Enum Class Desc only, which is different from other classes