<AWT Dev> JDK 9 RFR of 8031550: Fix overloads lint warnings in client code

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Jan 15 02:51:32 PST 2014


Hi, Joe.
The fix looks good. Thanks.

On 15.01.2014 6:18, Joe Darcy wrote:
> *ping*
>
> Please review this patch so work can proceed on adding the overloads 
> lint warning to the build of the jdk repo (JDK-8031747).
>
> Thanks,
>
> -Joe
>
> On 01/11/2014 10:48 AM, Joe Darcy wrote:
>> Hello,
>>
>> Please review the patch below which resolves all the "overloads" 
>> warnings in the client area by applying 
>> @SuppressWarnings("overloads"). The overloads warnings are generated 
>> by javac when a set of APIs yield potentially ambiguous results. 
>> However, most of the affected methods have long been part of the 
>> public SE API and cannot be removed. Two instances are private 
>> methods so don't directly impact general programmers.
>>
>> Unless there are other occurrences of this situation in the closed 
>> code, after 8031550 is fixed; the "overloads" warning will be able to 
>> be added to the set of lint warning used in building the jdk repo :-)
>>
>> Thanks,
>>
>> -Joe
>>
>> diff -r 34b36f75d2d7 src/share/classes/java/awt/AWTEventMulticaster.java
>> --- a/src/share/classes/java/awt/AWTEventMulticaster.java    Fri Jan 
>> 10 09:24:47 2014 -0800
>> +++ b/src/share/classes/java/awt/AWTEventMulticaster.java    Sat Jan 
>> 11 10:38:12 2014 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All 
>> rights reserved.
>> + * Copyright (c) 1996, 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
>> @@ -609,6 +609,7 @@
>>       * @param b window-state-listener-b
>>       * @since 1.4
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static WindowStateListener add(WindowStateListener a,
>>                                            WindowStateListener b) {
>>          return (WindowStateListener)addInternal(a, b);
>> @@ -632,6 +633,7 @@
>>       * @param a action-listener-a
>>       * @param b action-listener-b
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static ActionListener add(ActionListener a, 
>> ActionListener b) {
>>          return (ActionListener)addInternal(a, b);
>>      }
>> @@ -642,6 +644,7 @@
>>       * @param a item-listener-a
>>       * @param b item-listener-b
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static ItemListener add(ItemListener a, ItemListener b) {
>>          return (ItemListener)addInternal(a, b);
>>      }
>> @@ -652,9 +655,11 @@
>>       * @param a adjustment-listener-a
>>       * @param b adjustment-listener-b
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static AdjustmentListener add(AdjustmentListener a, 
>> AdjustmentListener b) {
>>          return (AdjustmentListener)addInternal(a, b);
>>      }
>> +    @SuppressWarnings("overloads")
>>      public static TextListener add(TextListener a, TextListener b) {
>>          return (TextListener)addInternal(a, b);
>>      }
>> @@ -676,6 +681,7 @@
>>       * @param b hierarchy-listener-b
>>       * @since 1.3
>>       */
>> +    @SuppressWarnings("overloads")
>>       public static HierarchyListener add(HierarchyListener a, 
>> HierarchyListener b) {
>>          return (HierarchyListener)addInternal(a, b);
>>       }
>> @@ -698,6 +704,7 @@
>>       * @param b mouse-wheel-listener-b
>>       * @since 1.4
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static MouseWheelListener add(MouseWheelListener a,
>>                                           MouseWheelListener b) {
>>          return (MouseWheelListener)addInternal(a, b);
>> @@ -780,6 +787,7 @@
>>       * @param oldl the window-state-listener being removed
>>       * @since 1.4
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static WindowStateListener remove(WindowStateListener l,
>> WindowStateListener oldl) {
>>          return (WindowStateListener) removeInternal(l, oldl);
>> @@ -803,6 +811,7 @@
>>       * @param l action-listener-l
>>       * @param oldl the action-listener being removed
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static ActionListener remove(ActionListener l, 
>> ActionListener oldl) {
>>          return (ActionListener) removeInternal(l, oldl);
>>      }
>> @@ -813,6 +822,7 @@
>>       * @param l item-listener-l
>>       * @param oldl the item-listener being removed
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static ItemListener remove(ItemListener l, ItemListener 
>> oldl) {
>>          return (ItemListener) removeInternal(l, oldl);
>>      }
>> @@ -823,9 +833,11 @@
>>       * @param l adjustment-listener-l
>>       * @param oldl the adjustment-listener being removed
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static AdjustmentListener remove(AdjustmentListener l, 
>> AdjustmentListener oldl) {
>>          return (AdjustmentListener) removeInternal(l, oldl);
>>      }
>> +    @SuppressWarnings("overloads")
>>      public static TextListener remove(TextListener l, TextListener 
>> oldl) {
>>          return (TextListener) removeInternal(l, oldl);
>>      }
>> @@ -847,6 +859,7 @@
>>       * @param oldl the hierarchy-listener being removed
>>       * @since 1.3
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static HierarchyListener remove(HierarchyListener l, 
>> HierarchyListener oldl) {
>>          return (HierarchyListener) removeInternal(l, oldl);
>>      }
>> @@ -870,6 +883,7 @@
>>       * @param oldl the mouse-wheel-listener being removed
>>       * @since 1.4
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static MouseWheelListener remove(MouseWheelListener l,
>>                                              MouseWheelListener oldl) {
>>        return (MouseWheelListener) removeInternal(l, oldl);
>> diff -r 34b36f75d2d7 src/share/classes/java/awt/Toolkit.java
>> --- a/src/share/classes/java/awt/Toolkit.java    Fri Jan 10 09:24:47 
>> 2014 -0800
>> +++ b/src/share/classes/java/awt/Toolkit.java    Sat Jan 11 10:38:12 
>> 2014 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All 
>> rights reserved.
>> + * Copyright (c) 1995, 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
>> @@ -2299,6 +2299,7 @@
>>              super(a, b);
>>          }
>>
>> +        @SuppressWarnings("overloads")
>>          static AWTEventListener add(AWTEventListener a,
>>                                      AWTEventListener b) {
>>              if (a == null)  return b;
>> @@ -2306,6 +2307,7 @@
>>              return new ToolkitEventMulticaster(a, b);
>>          }
>>
>> +        @SuppressWarnings("overloads")
>>          static AWTEventListener remove(AWTEventListener l,
>>                                         AWTEventListener oldl) {
>>              return (AWTEventListener) removeInternal(l, oldl);
>> diff -r 34b36f75d2d7 
>> src/share/classes/java/awt/dnd/DnDEventMulticaster.java
>> --- a/src/share/classes/java/awt/dnd/DnDEventMulticaster.java Fri Jan 
>> 10 09:24:47 2014 -0800
>> +++ b/src/share/classes/java/awt/dnd/DnDEventMulticaster.java Sat Jan 
>> 11 10:38:12 2014 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All 
>> rights reserved.
>> + * Copyright (c) 2001, 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
>> @@ -141,6 +141,7 @@
>>       * @param a drag-source-motion-listener-a
>>       * @param b drag-source-motion-listener-b
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static DragSourceMotionListener 
>> add(DragSourceMotionListener a,
>> DragSourceMotionListener b) {
>>          return (DragSourceMotionListener)addInternal(a, b);
>> @@ -166,6 +167,7 @@
>>       * @param l drag-source-motion-listener-l
>>       * @param ol the drag-source-motion-listener being removed
>>       */
>> +    @SuppressWarnings("overloads")
>>      public static DragSourceMotionListener 
>> remove(DragSourceMotionListener l,
>> DragSourceMotionListener ol) {
>>          return (DragSourceMotionListener)removeInternal(l, ol);
>>
>


-- 
Best regards, Sergey.



More information about the awt-dev mailing list