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

Every event should define ANY type

XMLWordPrintable

      Every event needs to define its ANY type.

      For instance, there is ActionEvent, which has only one type - ACTION. The problem is that the ActionEvent extends from Event and inherits its (static) ANY type. So code completion offers registering handler to ActionEvent.ANY, which is a correct expression but will get all existing events because it is in fact Event.ANY.

      So the inherited ANY type needs to be covered by a more specific ANY type. For the single-type events it should be OK to let the ANY type reference to the single actual type, like
          public static final EventType<ActionEvent> ANY = ACTION;

            psafrata Pavel Šafrata
            psafrata Pavel Šafrata
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: