Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description



      Name: rmT116609 Date: 05/20/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195], with Service Pack 2

      A DESCRIPTION OF THE PROBLEM :
      The java.util.Observable class would be much improved if its methods were declared in an interface. Since Java only supports single inheritance, it is impossible to write a class that extends some other class *and* is also Observable.

      Here is what I'm proposing:

      Create an "observable interface" that Observable implements:

      public interface IObservable {
         << all current Observable method>>
      }

      public class Observable implements IObservable {
        << same implementation as today >>
      }

      Now, I can write a class that extends another class *and* is also an IObservable (by using a concrete Observable as an instance field):

      class MyClass Extends MyOtherClass implements IObservable {
         private Observable obs = new Observable();

         << Delegate all IObservable methods
            to the obs object. >>
      }

      This would be a very simple change to the API but would make Observables much more flexible.

      (Review ID: 146748)
      ======================================================================

        Issue Links

          Activity

          Hide
          mmcclosksunw Michael Mccloskey (Inactive) added a comment -
          BT2:EVALUATION

          This could be done in a compatible way but we are hesitant to further evolve this legacy class.
          ###@###.### 2002-12-18
          Show
          mmcclosksunw Michael Mccloskey (Inactive) added a comment - BT2:EVALUATION This could be done in a compatible way but we are hesitant to further evolve this legacy class. ###@###.### 2002-12-18
          Hide
          smarks Stuart Marks added a comment -
          In retrospect, it would have been better for Observable to have been an interface. It was probably made a class in order to share implementation of the list of Observers and the notification dispatching mechanism.

          However, Observer and Observable will be deprecated. See JDK-8154801. Refactoring Observable into an interface is too great a change for these old APIs.
          Show
          smarks Stuart Marks added a comment - In retrospect, it would have been better for Observable to have been an interface. It was probably made a class in order to share implementation of the list of Observers and the notification dispatching mechanism. However, Observer and Observable will be deprecated. See JDK-8154801 . Refactoring Observable into an interface is too great a change for these old APIs.

            People

            • Assignee:
              smarks Stuart Marks
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: