changeset 50534:9070717a16a1

8187392: Deprecated methods in the peers can be removed Reviewed-by: prr, kaddepalli
author serb
date Wed, 18 Apr 2018 14:07:41 -0700
parents 0540b802b24e
children d70bc48b2a20
files src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuItem.java src/java.desktop/unix/classes/sun/awt/X11/XButtonPeer.java src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java src/java.desktop/windows/classes/sun/awt/windows/WChoicePeer.java src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java src/java.desktop/windows/classes/sun/awt/windows/WMenuItemPeer.java src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp src/java.desktop/windows/native/libawt/windows/awt_List.cpp
diffstat 19 files changed, 38 insertions(+), 251 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuItem.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuItem.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -129,16 +129,6 @@
         execute(ptr -> nativeSetTooltip(ptr, text));
     }
 
-//    @Override
-    public void enable() {
-        setEnabled(true);
-    }
-
-//    @Override
-    public void disable() {
-        setEnabled(false);
-    }
-
     public final boolean isEnabled() {
         return enabled.get();
     }
--- a/src/java.desktop/unix/classes/sun/awt/X11/XButtonPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XButtonPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -201,12 +201,6 @@
     }
 
     /**
-     * DEPRECATED
-     */
-    public Dimension minimumSize() {
-        return getMinimumSize();
-    }
-    /**
      * This method is called from Toolkit Thread and so it should not call any
      * client code.
      */
--- a/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -678,13 +678,6 @@
         repaint();
     }
 
-    /**
-     * DEPRECATED: Replaced by add(String, int).
-     */
-    public void addItem(String item, int index) {
-        add(item, index);
-    }
-
     public void setFont(Font font) {
         super.setFont(font);
         helper.setFont(this.font);
--- a/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -730,14 +730,6 @@
         return Toolkit.getDefaultToolkit().checkImage(img, w, h, o);
     }
 
-    public Dimension preferredSize() {
-        return getPreferredSize();
-    }
-
-    public Dimension minimumSize() {
-        return getMinimumSize();
-    }
-
     public Insets getInsets() {
         return new Insets(0, 0, 0, 0);
     }
@@ -748,15 +740,6 @@
     public void endValidate() {
     }
 
-
-    /**
-     * DEPRECATED:  Replaced by getInsets().
-     */
-
-    public Insets insets() {
-        return getInsets();
-    }
-
     // Returns true if we are inside begin/endLayout and
     // are waiting for native painting
     public boolean isPaintPending() {
--- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -81,7 +81,6 @@
     }
     public void setEnabled(boolean b) {}
     public void paint(Graphics g) {}
-    public void repaint(long tm, int x, int y, int width, int height) {}
     public void print(Graphics g) {}
     public void setBounds(int x, int y, int width, int height, int op) {
         // Unimplemeneted: Check for min/max hints for non-resizable
@@ -269,51 +268,6 @@
      */
     public void        layout() {}
 
-    /**
-     * DEPRECATED:  Replaced by getPreferredSize().
-     */
-    public Dimension            preferredSize() {
-        return getPreferredSize();
-    }
-
-    /**
-     * DEPRECATED:  Replaced by getMinimumSize().
-     */
-    public Dimension            minimumSize() {
-        return getMinimumSize();
-    }
-
-    /**
-     * DEPRECATED:  Replaced by setVisible(boolean).
-     */
-    public void         show() {
-        setVisible(true);
-    }
-
-    /**
-     * DEPRECATED:  Replaced by setVisible(boolean).
-     */
-    public void         hide() {
-        setVisible(false);
-    }
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    public void         enable() {}
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    public void         disable() {}
-
-    /**
-     * DEPRECATED:  Replaced by setBounds(int, int, int, int).
-     */
-    public void reshape(int x, int y, int width, int height) {
-        setBounds(x, y, width, height, SET_BOUNDS);
-    }
-
     Window getTopLevel(Component comp) {
         while (comp != null && !(comp instanceof Window)) {
             comp = comp.getParent();
--- a/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -212,54 +212,32 @@
         hsb.setValues(0, 0, 0, 0, HORIZ_SCROLL_AMT, HORIZ_SCROLL_AMT);
     }
 
-    /* New method name for 1.1 */
     public void add(String item, int index) {
         addItem(item, index);
     }
 
-    /* New method name for 1.1 */
     public void removeAll() {
         clear();
         maxLength = 0;
     }
 
-    /* New method name for 1.1 */
     public void setMultipleMode (boolean b) {
         setMultipleSelections(b);
     }
 
-    /* New method name for 1.1 */
-    public Dimension getPreferredSize(int rows) {
-        return preferredSize(rows);
+    public Dimension getMinimumSize() {
+        return getMinimumSize(DEFAULT_VISIBLE_ROWS);
     }
 
-    /* New method name for 1.1 */
-    public Dimension getMinimumSize(int rows) {
-        return minimumSize(rows);
+    public Dimension getPreferredSize(int rows) {
+        return getMinimumSize(rows);
     }
 
-    /**
-     * Minimum size.
-     */
-    public Dimension minimumSize() {
-        return minimumSize(DEFAULT_VISIBLE_ROWS);
-    }
-
-    /**
-     * return the preferredSize
-     */
-    public Dimension preferredSize(int v) {
-        return minimumSize(v);
-    }
-
-    /**
-     * return the minimumsize
-     */
-    public Dimension minimumSize(int v) {
+    public Dimension getMinimumSize(int rows) {
         FontMetrics fm = getFontMetrics(getFont());
         initFontMetrics();
         return new Dimension(20 + fm.stringWidth("0123456789abcde"),
-                             getItemHeight() * v + (2*MARGIN));
+                             getItemHeight() * rows + (2*MARGIN));
     }
 
     /**
--- a/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -165,22 +165,6 @@
         repaintIfShowing();
     }
 
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     * @see java.awt.peer.MenuItemPeer
-     */
-    public void enable() {
-        setEnabled( true );
-    }
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     * @see java.awt.peer.MenuItemPeer
-     */
-    public void disable() {
-        setEnabled( false );
-    }
-
     /************************************************
      *
      * Access to target's fields
--- a/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -126,13 +126,6 @@
         }
     }
 
-    /**
-     * DEPRECATED:  Replaced by getInsets().
-     */
-    public Insets insets() {
-        return getInsets();
-    }
-
     public void dispose() {
         if (embedder != null) {
             embedder.deinstall();
--- a/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -98,22 +98,6 @@
         postPaintEvent();
     }
 
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     * @see java.awt.peer.MenuItemPeer
-     */
-    public void enable() {
-        setEnabled( true );
-    }
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     * @see java.awt.peer.MenuItemPeer
-     */
-    public void disable() {
-        setEnabled( false );
-    }
-
     /*
      * From MenuPeer
      */
--- a/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -409,14 +409,6 @@
         }
     }
 
-    /**
-     * DEPRECATED
-     */
-    @Override
-    public Dimension minimumSize() {
-        return getMinimumSize();
-    }
-
     @Override
     public void setVisible(boolean b) {
         super.setVisible(b);
--- a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -557,13 +557,6 @@
                                   oldState, newState));
     }
 
-    /**
-     * DEPRECATED:  Replaced by getInsets().
-     */
-    public Insets insets() {
-        return getInsets();
-    }
-
     boolean isAutoRequestFocus() {
         if (XToolkit.isToolkitThread()) {
             return AWTAccessor.getWindowAccessor().isAutoRequestFocus((Window)target);
--- a/src/java.desktop/windows/classes/sun/awt/windows/WChoicePeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WChoicePeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -60,7 +60,7 @@
 
     @Override
     public void add(String item, int index) {
-        addItem(item, index);
+        addItems(new String[] {item}, index);
     }
 
     @Override
@@ -73,12 +73,6 @@
     @Override
     public native void remove(int index);
 
-    /**
-     * DEPRECATED, but for now, called by add(String, int).
-     */
-    public void addItem(String item, int index) {
-        addItems(new String[] {item}, index);
-    }
     public native void addItems(String[] items, int index);
 
     @Override
--- a/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -914,13 +914,6 @@
     public native void endValidate();
 
     /**
-     * DEPRECATED
-     */
-    public Dimension preferredSize() {
-        return getPreferredSize();
-    }
-
-    /**
      * register a DropTarget with this native peer
      */
 
--- a/src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -54,34 +54,36 @@
         return selected;
     }
 
-    /* New method name for 1.1 */
     @Override
     public void add(String item, int index) {
         addItem(item, index);
     }
 
-    /* New method name for 1.1 */
     @Override
     public void removeAll() {
         clear();
     }
 
-    /* New method name for 1.1 */
     @Override
     public void setMultipleMode (boolean b) {
         setMultipleSelections(b);
     }
 
-    /* New method name for 1.1 */
     @Override
     public Dimension getPreferredSize(int rows) {
-        return preferredSize(rows);
+        if ( fm == null ) {
+            List li = (List)target;
+            fm = getFontMetrics( li.getFont() );
+        }
+        Dimension d = getMinimumSize(rows);
+        d.width = Math.max(d.width, getMaxWidth() + 20);
+        return d;
     }
 
-    /* New method name for 1.1 */
     @Override
     public Dimension getMinimumSize(int rows) {
-        return minimumSize(rows);
+        return new Dimension(20 + fm.stringWidth("0123456789abcde"),
+                             (fm.getHeight() * rows) + 4); // include borders
     }
 
     private FontMetrics   fm;
@@ -104,21 +106,6 @@
     public native void makeVisible(int index);
     public native void setMultipleSelections(boolean v);
     public native int  getMaxWidth();
-
-    public Dimension preferredSize(int v) {
-        if ( fm == null ) {
-            List li = (List)target;
-            fm = getFontMetrics( li.getFont() );
-        }
-        Dimension d = minimumSize(v);
-        d.width = Math.max(d.width, getMaxWidth() + 20);
-        return d;
-    }
-    public Dimension minimumSize(int v) {
-        return new Dimension(20 + fm.stringWidth("0123456789abcde"),
-                             (fm.getHeight() * v) + 4); // include borders
-    }
-
     // Toolkit & peer internals
 
     WListPeer(List target) {
--- a/src/java.desktop/windows/classes/sun/awt/windows/WMenuItemPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WMenuItemPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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,20 +57,6 @@
         enable(b);
     }
 
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    public void enable() {
-        enable(true);
-    }
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    public void disable() {
-        enable(false);
-    }
-
     private void readShortcutLabel() {
         //Fix for 6288578: PIT. Windows: Shortcuts displayed for the menuitems in a popup menu
         WMenuPeer ancestor = parent;
--- a/src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -98,11 +98,4 @@
             setForeground(c);
         }
     }
-
-    /**
-     * DEPRECATED:  Replaced by getInsets().
-     */
-    public Insets insets() {
-        return getInsets();
-    }
 }
--- a/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -71,10 +71,6 @@
         // The unitIncrement is grabbed from the target as needed.
     }
 
-    @Override
-    public Insets insets() {
-        return getInsets();
-    }
     private native void setInsets();
 
     @Override
--- a/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -152,7 +152,7 @@
             jint height = env->GetIntField(target, AwtComponent::heightID);
 
             jobject dimension = JNU_CallMethodByName(env, NULL, peer,
-                                                     "preferredSize",
+                                                     "getPreferredSize",
                                                      "()Ljava/awt/Dimension;").l;
             DASSERT(!safe_ExceptionOccurred(env));
             if (env->ExceptionCheck()) goto done;
@@ -334,7 +334,7 @@
 jobject AwtChoice::PreferredItemSize(JNIEnv *env)
 {
     jobject dimension = JNU_CallMethodByName(env, NULL, GetPeer(env),
-                                             "preferredSize",
+                                             "getPreferredSize",
                                              "()Ljava/awt/Dimension;").l;
     DASSERT(!safe_ExceptionOccurred(env));
     CHECK_NULL_RETURN(dimension, NULL);
--- a/src/java.desktop/windows/native/libawt/windows/awt_List.cpp	Wed Apr 18 08:48:06 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_List.cpp	Wed Apr 18 14:07:41 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -319,7 +319,7 @@
 jobject AwtList::PreferredItemSize(JNIEnv *env)
 {
     jobject peer = GetPeer(env);
-    jobject dimension = JNU_CallMethodByName(env, NULL, peer, "preferredSize",
+    jobject dimension = JNU_CallMethodByName(env, NULL, peer, "getPreferredSize",
                                              "(I)Ljava/awt/Dimension;",
                                              1).l;