Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-1027

Add an @UnsupportedOperation annotation that can be used to mark methods that always throw UnsupportedOperationException when called

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • core
    • None

    Description

      This can be used to annotate (primarily in Javadoc) those methods, presumable defined by an interface so they must be implemented, but which make no sense in the specific implementation.  There are numerous examples, but a few should suffice:

      • NumericSpinnerData has a fixed range of values specified by the lower and upper bounds, so the "remove(...)", "clear()", "add(...)", or "update(...)" methods of the List<T> interface don't apply.
      • Various iterators backed by other lists (such as VisibleNodeIterator of TerraTreeViewSkin) doesn't support the "remove(...)" method for whatever reason, even though it is specified in the Iterator interface.
      • TabButton (part of TerraTabPaneSkin) is a subclass of Button, but many methods are unsupported because of its unique structure (such as "setTriState", "setButtonData", etc.)
      • ImageNode (one of the unique children of TextPane) always holds a single image, so the "insertRange" and "removeRange" methods make no sense.

      Note: this annotation does nothing, and is not retained at runtime, and really should be in the Java language (see https://bugs.openjdk.java.net/browse/JDK-6447051 for instance), but it makes documentation of unsupported operations a bit clearer at no real cost.

      Attachments

        Activity

          People

            rwhitcomb Roger Lee Whitcomb
            rwhitcomb Roger Lee Whitcomb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: