if (!isSerializable() || isExternalizable())
if (!isSerializable() || isExternalizable() || isEnum())
  private void setFields(Class cl)  {    SetAccessibleAction setAccessible = new SetAccessibleAction();    if (!isSerializable() || isExternalizable())      {	fields = NO_FIELDS;	return;      }    try      {	final Field f =	  cl.getDeclaredField("serialPersistentFields");	setAccessible.setMember(f);	AccessController.doPrivileged(setAccessible);	int modifiers = f.getModifiers();	if (Modifier.isStatic(modifiers)	    && Modifier.isFinal(modifiers)	    && Modifier.isPrivate(modifiers))	  {	    fields = getSerialPersistentFields(cl);	    if (fields != null)	      {		Arrays.sort (fields);		// Retrieve field reference.		for (int i=0; i < fields.length; i++)		  {		    try		      {			fields[i].lookupField(cl);		      }		    catch (NoSuchFieldException _)		      {			fields[i].setToSet(false);		      }		  }				calculateOffsets();		return;	      }	  }      }    catch (NoSuchFieldException ignore)      {      }    catch (IllegalAccessException ignore)      {      }    int num_good_fields = 0;    Field[] all_fields = cl.getDeclaredFields();    int modifiers;    // set non-serializable fields to null in all_fields    for (int i = 0; i < all_fields.length; i++)      {	modifiers = all_fields[i].getModifiers();	if (Modifier.isTransient(modifiers)	    || Modifier.isStatic(modifiers))	  all_fields[i] = null;	else	  num_good_fields++;      }    // make a copy of serializable (non-null) fields    fields = new ObjectStreamField[ num_good_fields ];    for (int from = 0, to = 0; from < all_fields.length; from++)      if (all_fields[from] != null)	{	  final Field f = all_fields[from];	  setAccessible.setMember(f);	  AccessController.doPrivileged(setAccessible);	  fields[to] = new ObjectStreamField(all_fields[from]);	  to++;	}    Arrays.sort(fields);    // Make sure we don't have any duplicate field names    // (Sun JDK 1.4.1. throws an Internal Error as well)    for (int i = 1; i < fields.length; i++)      {	if(fields[i - 1].getName().equals(fields[i].getName()))	    throw new InternalError("Duplicate field " + 			fields[i].getName() + " in class " + cl.getName());      }    calculateOffsets();  }