code: private int writeNewClass(Class<?> object, boolean unshared) throws IOException {
          output.writeByte(TC_CLASS);
  
          // Instances of java.lang.Class are always Serializable, even if their
          // instances aren't (e.g. java.lang.Object.class).
          // We cannot call lookup because it returns null if the parameter
          // represents instances that cannot be serialized, and that is not what
          // we want.
          ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(object);
  
          // The handle for the classDesc is NOT the handle for the class object
          // being dumped. We must allocate a new handle and return it.
          if (clDesc.isEnum()) {
              writeEnumDesc(clDesc, unshared);
          } else {
              writeClassDesc(clDesc, unshared);
          }
  
          int handle = nextHandle();
          if (!unshared) {
              objectsWritten.put(object, handle);
          }
  
          return handle;
      }
docs: Write class {@code object} into the receiver. It is assumed the
  class has not been dumped yet. Classes are not really dumped, but a class
  descriptor ({@code ObjectStreamClass}) that corresponds to them.
  Returns the handle for this object (class) which is dumped here.
  
  @param object
  The {@code java.lang.Class} object to dump
  @return the handle assigned to the class being dumped
  
  @throws IOException
  If an IO exception happened when writing the class.