Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4715486

field focusEvent.opposite is not transient

XMLWordPrintable

    • mantis
    • generic
    • generic


      ###@###.### 2002-07-16

      FocusEvents in JDK 1.4.1 provides a reference to the "opposite"
      component...that is a reference to the component which lost focus when your
      component gains focus, and a reference to the component that gained focus
      when your component lost focus.

      That's great, but FocusEvent is Serializable and field focusEvent.opposite
      is not transient.

      Therefore, cannot ship FocusEvents over RMI without serializing whatever
      component is the opposite component.

      java.awt.event.FocusEvent and most other events ultimately derive
      from java.util.EventObject, which contains the following:

      public class EventObject implements java.io.Serializable {
         /**
          * The object on which the Event initially occurred.
          */
          protected transient Object source;
          :
          :

      Thus, if you serialize an event, the source that you get on deserialization
      will be null.

      The opposite component in FocusEvent should work the same way, even if only
      for consistency. (Both source and opposite refer to components at the time
      the event object was created.)

      We believe null is the *only* reasonable value upon deserialization,
      especially given that source will be null.

            prssunw Prs Prs (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: