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

Specification of Taskbar::getIconImage doesn't mention that the returned image might not be equal to the Taskbar::setIconImage one. (eg on Mac OS)

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Specification of Taskbar::getIconImage doesn't mention that the returned image might not be equal to the Taskbar::setIconImage one.

      Problem

      As of now Taskbar::getIconImage/Taskbar::setIconImage are supported only on macOS. macOS implementation does internal conversion of passed image and always returns an instance of image of another class.

      Solution

      Clarify the current behavior in the javadoc. However we should consider possibility of returning the same instance of image if we decide to implement it another platforms in such way.

      Specification

      src/java.desktop/share/classes/java/awt/Taskbar.java

          /**
      -    * Changes this application's icon to the provided image.
      +    * Requests the system to change this application's icon to the provided {@code image}.
           *
           * @param image to change
           * @throws SecurityException if a security manager exists and it denies the
           * {@code RuntimePermission("canProcessApplicationEvents")} permission.
           * @throws UnsupportedOperationException if the current platform
           * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
           */
          public void setIconImage(final Image image) {
      
          /**
           * Obtains an image of this application's icon.
           *
      +    * @apiNote The returned icon image may not be equal
      +    * to an image set by {@link java.awt.Taskbar#setIconImage},
      +    * but should be visually similar.
      +    *
           * @return an image of this application's icon
           * @throws SecurityException if a security manager exists and it denies the
           * {@code RuntimePermission("canProcessApplicationEvents")} permission.
           * @throws UnsupportedOperationException if the current platform
           * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
           */
          public Image getIconImage() {

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              azvegint Alexander Zvegintsev
              Reporter:
              amadgundi Asha Madgundi
              Reviewed By:
              Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: