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

The "com.sun.awt.AWTUtilities" class can be dropped in favour of public API

    Details

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

      Description

      Summary

      Deprecate for removal com.sun.awt.AWTUtilities.

      Problem

      The client code has a "com.sun.awt.AWTUtilities" class which at some point in the past, JDK 6u10, was used as a kind of "public" API.

      Notes:
       - In the latest version of jdk9 the default value of "--illegal-access" was changed, so this class is accessible at runtime,
         but still is not accessible at compile time or when the option "--illegal-access=deny" is specified.
       - jdeps is also reports this package as internal " -> com.sun.awt  JDK internal API (java.desktop)"
      
      
      In jdk9 the "src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java" is inaccessible and all its functionality was already provided by the public API:
      
      AWTUtilities.isTranslucencySupported()/AWTUtilities.isWindowShapingSupported()
          -> java.awt.GraphicsDevice.isWindowTranslucencySupported()
      
      AWTUtilities.setWindowOpacity()/AWTUtilities.getWindowOpacity()
          -> java.awt.Window.setOpacity/getOpacity
      
      AWTUtilities.getWindowShape()/AWTUtilities.setWindowShape()
          -> java.awt.Window.setShape()/getShape()
      
      AWTUtilities.setWindowOpaque/AWTUtilities.isWindowOpaque
          -> java.awt.Window.setBackground()/isOpaque()
      
      AWTUtilities.isTranslucencyCapable
          -> java.awt.GraphicsConfiguration.isTranslucencyCapable()
      
      AWTUtilities.setComponentMixingCutoutShape
          -> java.awt.Component.setMixingCutoutShape() 

      Solution

      The solutions is to deprecate this APi in jdk10 and remove later.

      Specification: http://cr.openjdk.java.net/~serb/8186617/webrev.01/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java.udiff.html

      =====================
       * <b>WARNING</b>: This class is an implementation detail and only meant
       * for limited use outside of the core platform. This API may change
       * drastically between update release, and it may even be
       * removed or be moved in some other package(s)/class(es).
       */
      +@Deprecated(forRemoval = true, since = "10")
       public final class AWTUtilities {
      
      =====================
      +* @deprecated use {@link GraphicsDevice#isWindowTranslucencySupported}
      +*             instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static boolean isTranslucencySupported(Translucency translucencyKind) {
      
       =====================
      +* @deprecated use {@link Window#setOpacity} instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static void setWindowOpacity(Window window, float opacity) {
      
       =====================
      +* @deprecated use {@link Window#getOpacity} instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static float getWindowOpacity(Window window) {
      
       =====================
      +* @deprecated use {@link GraphicsDevice#isWindowTranslucencySupported}
      +*             instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static boolean isWindowShapingSupported() {
      
       =====================
      +* @deprecated use {@link Window#getShape} instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static Shape getWindowShape(Window window) {
      
       =====================
      +* @deprecated use {@link Window#setShape} instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static void setWindowShape(Window window, Shape shape) {
      
       =====================
      +* @deprecated use {@link Window#setBackground} instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static void setWindowOpaque(Window window, boolean isOpaque) {
      
       =====================
      +* @deprecated use {@link Window#isOpaque} instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static boolean isWindowOpaque(Window window) {
      
       =====================
      +* @deprecated use {@link GraphicsConfiguration#isTranslucencyCapable}
      +*             instead
       */
      +@Deprecated(forRemoval = true, since = "10")
       public static boolean isTranslucencyCapable(GraphicsConfiguration gc) {
      
       =====================
      +* @deprecated use {@link Component#setMixingCutoutShape} instead
       */
      -@Deprecated(since = "9")
      +@Deprecated(forRemoval = true, since = "9")
       public static void setComponentMixingCutoutShape(Component component,
           Shape shape)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serb Sergey Bylokhov
                Reporter:
                serb Sergey Bylokhov
                Reviewed By:
                Alexander Zvegintsev (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: