<Swing Dev> [OpenJDK 2D-Dev] <AWT Dev> JDK 9 RFR of JDK-8032047: Fix static lint warnings in client libraries

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Jan 17 21:47:01 UTC 2014


Hello, Joe.
This version looks good to me too.

On 18.01.2014 1:13, Joe Darcy wrote:
> PS I neglected to include some affected files under 
> src/solaris/classes/sun/* previously.
>
> Those files are included in the new webrev
>
>     http://cr.openjdk.java.net/~darcy/8032047.3
>
> and the differential patch below.
>
> Thanks,
>
> -Joe
>
> --- old/src/solaris/classes/sun/awt/X11/XComponentPeer.java 2014-01-17 
> 12:51:36.000000000 -0800
> +++ new/src/solaris/classes/sun/awt/X11/XComponentPeer.java 2014-01-17 
> 12:51:36.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -184,7 +184,7 @@
>              XWindowPeer wpeer = (XWindowPeer)(container.getPeer());
>              if (wpeer != null) {
>                  return (wpeer.winAttr.visibilityState !=
> -                        wpeer.winAttr.AWT_UNOBSCURED);
> +                        XWindowAttributesData.AWT_UNOBSCURED);
>              }
>          }
>          return true;
> --- old/src/solaris/classes/sun/awt/X11/XDialogPeer.java 2014-01-17 
> 12:51:37.000000000 -0800
> +++ new/src/solaris/classes/sun/awt/X11/XDialogPeer.java 2014-01-17 
> 12:51:36.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -47,9 +47,9 @@
>          undecorated = Boolean.valueOf(target.isUndecorated());
>          winAttr.nativeDecor = !target.isUndecorated();
>          if (winAttr.nativeDecor) {
> -            winAttr.decorations = winAttr.AWT_DECOR_ALL;
> +            winAttr.decorations = XWindowAttributesData.AWT_DECOR_ALL;
>          } else {
> -            winAttr.decorations = winAttr.AWT_DECOR_NONE;
> +            winAttr.decorations = XWindowAttributesData.AWT_DECOR_NONE;
>          }
>          winAttr.functions = MWMConstants.MWM_FUNC_ALL;
>          winAttr.isResizable =  true; //target.isResizable();
> --- old/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java 
> 2014-01-17 12:51:37.000000000 -0800
> +++ new/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java 
> 2014-01-17 12:51:37.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -1005,6 +1005,7 @@
>          }
>      }
>
> +    @SuppressWarnings("static")
>      private void notifyProtocolListener(XWindow xwindow, int x, int y,
>                                          int dropAction,
>                                          XClientMessageEvent xclient,
> @@ -1147,7 +1148,7 @@
>                 event while it still can be referenced from other Java 
> events. */
>              {
>                  XClientMessageEvent copy = new XClientMessageEvent();
> -                unsafe.copyMemory(xclient.pData, copy.pData, 
> copy.getSize());
> +                unsafe.copyMemory(xclient.pData, copy.pData, 
> XClientMessageEvent.getSize());
>
>                  copy.set_data(0, xclient.get_window());
>
> --- old/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java 
> 2014-01-17 12:51:37.000000000 -0800
> +++ new/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java 
> 2014-01-17 12:51:37.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -654,9 +654,9 @@
>          if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
>              xembedLog.finer("Client message to embedder: " + msg);
>          }
> -        if (msg.get_message_type() == xembed.XEmbed.getAtom()) {
> +        if (msg.get_message_type() == XEmbedHelper.XEmbed.getAtom()) {
>              if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
> - xembedLog.fine(xembed.XEmbedMessageToString(msg));
> + xembedLog.fine(XEmbedHelper.XEmbedMessageToString(msg));
>              }
>          }
>          if (isXEmbedActive()) {
> --- old/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java 
> 2014-01-17 12:51:38.000000000 -0800
> +++ new/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java 
> 2014-01-17 12:51:38.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -647,7 +647,7 @@
>      public void dispatchEvent(XEvent ev) {
>          if (ev.get_type() == ClientMessage) {
>              XClientMessageEvent msg = ev.get_xclient();
> -            if (msg.get_message_type() == xembed.XEmbed.getAtom()) {
> +            if (msg.get_message_type() == 
> XEmbedHelper.XEmbed.getAtom()) {
>                  if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
>                      xembedLog.fine("Embedded message: " + 
> XEmbedHelper.msgidToString((int)msg.get_data(1)));
>                  }
> --- old/src/solaris/classes/sun/awt/X11/XFramePeer.java 2014-01-17 
> 12:51:39.000000000 -0800
> +++ new/src/solaris/classes/sun/awt/X11/XFramePeer.java 2014-01-17 
> 12:51:38.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -67,9 +67,9 @@
>          undecorated = Boolean.valueOf(target.isUndecorated());
>          winAttr.nativeDecor = !target.isUndecorated();
>          if (winAttr.nativeDecor) {
> -            winAttr.decorations = winAttr.AWT_DECOR_ALL;
> +            winAttr.decorations = XWindowAttributesData.AWT_DECOR_ALL;
>          } else {
> -            winAttr.decorations = winAttr.AWT_DECOR_NONE;
> +            winAttr.decorations = XWindowAttributesData.AWT_DECOR_NONE;
>          }
>          winAttr.functions = MWMConstants.MWM_FUNC_ALL;
>          winAttr.isResizable = true; // target.isResizable();
> --- old/src/solaris/classes/sun/awt/X11/XToolkit.java 2014-01-17 
> 12:51:39.000000000 -0800
> +++ new/src/solaris/classes/sun/awt/X11/XToolkit.java 2014-01-17 
> 12:51:39.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -1542,7 +1542,7 @@
>                   */
>                  if 
> (desktopProperties.get(SunToolkit.DESKTOPFONTHINTS) == null) {
>                      if (XWM.isKDE2()) {
> -                        Object hint = fcManager.getFontConfigAAHint();
> +                        Object hint = 
> FontConfigManager.getFontConfigAAHint();
>                          if (hint != null) {
>                              /* set the fontconfig/KDE property so that
>                               * getDesktopHints() below will see it
> --- old/src/solaris/classes/sun/font/FcFontConfiguration.java 
> 2014-01-17 12:51:40.000000000 -0800
> +++ new/src/solaris/classes/sun/font/FcFontConfiguration.java 
> 2014-01-17 12:51:39.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -441,7 +441,7 @@
>              try {
>                  fcVersion = Integer.parseInt(fcVersionStr);
>                  if (fcVersion != 0 &&
> -                    fcVersion != fcm.getFontConfigVersion()) {
> +                    fcVersion != 
> FontConfigManager.getFontConfigVersion()) {
>                      return;
>                  }
>              } catch (Exception e) {
> --- old/src/solaris/classes/sun/font/X11TextRenderer.java 2014-01-17 
> 12:51:40.000000000 -0800
> +++ new/src/solaris/classes/sun/font/X11TextRenderer.java 2014-01-17 
> 12:51:40.000000000 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -57,11 +57,11 @@
>              super.drawGlyphVector(sg2d, g, x, y);
>              return;
>          case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
> - sg2d.surfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y);
> +             SurfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y);
>              return;
>          case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
>          case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
> - sg2d.surfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y);
> +             SurfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y);
>              return;
>          default:
>          }
>
>
> On 01/17/2014 11:30 AM, Joe Darcy wrote:
>> Hi Sergey,
>>
>> On 01/17/2014 02:28 AM, Sergey Bylokhov wrote:
>>> Hello, Joe.
>>> Some comments:
>>>  - in the SunDropTargetContextPeer.java file header changed only
>>
>> Reverted.
>>
>>>  - Incorrect modification of if statement in D3DSurfaceDataProxy.java
>>
>> Fixed.
>>
>>>  - It is not necessary to use class name in  StyledEditorKit.java 
>>> and HTMLEditorKit.java, because defaultActions is a private static 
>>> field and it can be accessed directly.
>>
>> Improved.
>>
>> New webrev:
>>
>>     http://cr.openjdk.java.net/~darcy/8032047.2
>>
>> Thanks for the review,
>>
>> -Joe
>>
>>>
>>> On 17.01.2014 11:31, Joe Darcy wrote:
>>>> Hi Petr,
>>>>
>>>> On 01/16/2014 11:20 PM, Petr Pchelko wrote:
>>>>> Hello, Joe.
>>>>>
>>>>> A couple of small comments:
>>>>>
>>>>> AffineTransformOp.java: Could you please split a long line #241
>>>>
>>>> Done.
>>>>
>>>>>
>>>>> ClipboardTransferable.java: You can safely remove the 
>>>>> DataTransferer.getInstance in this place.
>>>>> The DataTransferer is a singleton and it's already created by this 
>>>>> time.
>>>>>
>>>>> SunDragSourceContextPeer.java: same here, you can safely remove 
>>>>> the getInstance
>>>>
>>>> Changed.
>>>>
>>>>>
>>>>> D3DDrawImage.java: you've mistyped the copyright update.
>>>>
>>>> Fixed.
>>>>
>>>>>
>>>>> D3DSurfaceDataProxy.java: Why did you choose to suppress a warning 
>>>>> here? the getD3DDevice is
>>>>> just a getter, it does not allocate new object and has no side 
>>>>> effects..
>>>>
>>>> Changed.
>>>>
>>>> Revised webrev at
>>>>
>>>>     http://cr.openjdk.java.net/~darcy/8032047.0/
>>>>
>>>> Thanks for the careful review,
>>>>
>>>> -Joe
>>>>
>>>>>
>>>>> With best regards. Petr.
>>>>>
>>>>> On 17.01.2014, at 10:55, Joe Darcy <joe.darcy at oracle.com> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> Please view my proposed fix for
>>>>>>
>>>>>>     JDK-8032047: Fix static lint warnings in client libraries
>>>>>>     http://cr.openjdk.java.net/~darcy/8032047.0/
>>>>>>
>>>>>> Mostly this fix consisted of just replacing a variable name with 
>>>>>> the class name mentioned by javac in the warning message. In a 
>>>>>> few cases where the expression allocated a new object, I choose 
>>>>>> to just suppress the warning since I didn't feel motivated to 
>>>>>> analyze the possible side-effects of the allocation.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> -Joe
>>>>>>
>>>>
>>>
>>>
>>
> g


-- 
Best regards, Sergey.




More information about the swing-dev mailing list