From b9aead1b2c1f41473fd85b1b351d747614360ba9 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 17 Apr 2015 16:54:13 +0300 Subject: [PATCH] 8074028: Remove API references to java.awt.peer Reviewed-by: alanb, ant, yan, prr --- .../classes/com/apple/eawt/Application.java | 18 ++++---- .../com/apple/eawt/_AppDockIconHandler.java | 8 ++-- .../com/apple/eawt/_AppMenuBarHandler.java | 11 +++-- .../classes/com/apple/laf/ScreenMenu.java | 35 ++++++++++------ .../classes/com/apple/laf/ScreenMenuBar.java | 23 +++++----- .../classes/com/apple/laf/ScreenMenuItem.java | 18 ++++---- .../com/apple/laf/ScreenMenuItemCheckbox.java | 22 +++++----- .../classes/sun/awt/CGraphicsDevice.java | 8 ++-- .../opengl/CGLVolatileSurfaceManager.java | 9 ++-- .../classes/sun/lwawt/LWComponentPeer.java | 4 +- .../classes/sun/lwawt/LWWindowPeer.java | 13 +++--- .../lwawt/macosx/CDragSourceContextPeer.java | 8 ++-- .../sun/lwawt/macosx/CEmbeddedFrame.java | 11 +++-- .../sun/lwawt/macosx/CInputMethod.java | 12 +++--- .../classes/sun/lwawt/macosx/CMenuBar.java | 7 ++-- .../sun/lwawt/macosx/CPlatformWindow.java | 22 +++++----- .../classes/sun/lwawt/macosx/CTrayIcon.java | 10 +++-- .../sun/lwawt/macosx/CViewEmbeddedFrame.java | 16 +++---- .../share/classes/java/awt/Canvas.java | 5 +-- .../share/classes/java/awt/Component.java | 35 ++++++---------- .../share/classes/java/awt/Container.java | 12 +++--- .../java/awt/DefaultFocusTraversalPolicy.java | 5 +-- .../java/awt/DefaultKeyboardFocusManager.java | 9 ++-- .../share/classes/java/awt/Dialog.java | 7 +--- .../share/classes/java/awt/FileDialog.java | 5 +-- .../share/classes/java/awt/Font.java | 27 +++++------- .../java/awt/KeyboardFocusManager.java | 7 ++-- .../share/classes/java/awt/MenuComponent.java | 17 +++----- .../share/classes/java/awt/PopupMenu.java | 5 +-- .../share/classes/java/awt/Window.java | 29 +++++-------- .../classes/java/awt/dnd/DropTarget.java | 9 ++-- .../share/classes/javax/swing/JComponent.java | 9 ++-- .../share/classes/javax/swing/JViewport.java | 9 ++-- .../classes/javax/swing/RepaintManager.java | 5 +-- .../swing/plaf/basic/BasicSplitPaneUI.java | 10 +++-- .../share/classes/sun/awt/AWTAccessor.java | 12 ++++-- .../share/classes/sun/awt/EmbeddedFrame.java | 16 +++---- .../sun/awt/KeyboardFocusManagerPeerImpl.java | 16 +++---- .../classes/sun/awt/LightweightFrame.java | 8 ++-- .../classes/sun/awt/SunGraphicsCallback.java | 5 +-- .../share/classes/sun/font/FontAccess.java | 2 + .../share/classes/sun/print/PSPrinterJob.java | 15 +++---- .../classes/sun/swing/JLightweightFrame.java | 15 +++---- .../classes/sun/awt/X11/XBaseMenuWindow.java | 5 +-- .../classes/sun/awt/X11/XComponentPeer.java | 29 ++++++------- .../classes/sun/awt/X11/XDecoratedPeer.java | 2 +- .../unix/classes/sun/awt/X11/XDialogPeer.java | 4 +- .../sun/awt/X11/XDragSourceContextPeer.java | 5 +-- .../sun/awt/X11/XDropTargetContextPeer.java | 7 ++-- .../sun/awt/X11/XEmbedChildProxyPeer.java | 5 +-- .../classes/sun/awt/X11/XEmbeddedFrame.java | 27 ++++++------ .../sun/awt/X11/XEmbeddingContainer.java | 10 ++--- .../classes/sun/awt/X11/XFileDialogPeer.java | 34 +++++++++------ .../unix/classes/sun/awt/X11/XFramePeer.java | 5 ++- .../classes/sun/awt/X11/XInputMethod.java | 9 ++-- .../awt/X11/XKeyboardFocusManagerPeer.java | 4 +- .../classes/sun/awt/X11/XMenuBarPeer.java | 8 ++-- .../classes/sun/awt/X11/XMouseInfoPeer.java | 9 ++-- .../unix/classes/sun/awt/X11/XPanelPeer.java | 12 +++--- .../classes/sun/awt/X11/XRepaintArea.java | 7 ++-- .../classes/sun/awt/X11/XTextAreaPeer.java | 6 --- .../classes/sun/awt/X11/XTextFieldPeer.java | 42 ++++++++----------- .../unix/classes/sun/awt/X11/XToolkit.java | 14 +++---- .../classes/sun/awt/X11/XTrayIconPeer.java | 13 +++--- .../unix/classes/sun/awt/X11/XWindow.java | 17 ++++---- .../unix/classes/sun/awt/X11/XWindowPeer.java | 19 +++++---- .../classes/sun/awt/X11GraphicsDevice.java | 8 ++-- .../opengl/GLXVolatileSurfaceManager.java | 10 +++-- .../unix/native/common/awt/awt_Font.c | 4 +- .../classes/sun/awt/Win32GraphicsDevice.java | 10 ++--- .../classes/sun/awt/windows/WChoicePeer.java | 12 +++--- .../sun/awt/windows/WComponentPeer.java | 18 ++++---- .../classes/sun/awt/windows/WDialogPeer.java | 2 +- .../sun/awt/windows/WEmbeddedFrame.java | 17 ++++---- .../sun/awt/windows/WFileDialogPeer.java | 2 +- .../classes/sun/awt/windows/WInputMethod.java | 12 +++--- .../windows/WKeyboardFocusManagerPeer.java | 9 ++-- .../classes/sun/awt/windows/WPageDialog.java | 8 ++-- .../classes/sun/awt/windows/WPrintDialog.java | 7 ++-- .../sun/awt/windows/WPrintDialogPeer.java | 2 +- .../classes/sun/awt/windows/WPrinterJob.java | 10 ++--- .../sun/awt/windows/WScrollPanePeer.java | 9 ++-- .../classes/sun/awt/windows/WToolkit.java | 19 +++++---- .../sun/awt/windows/WTrayIconPeer.java | 38 ++++++++--------- .../classes/sun/awt/windows/WWindowPeer.java | 13 +++--- .../sun/java2d/d3d/D3DGraphicsDevice.java | 26 ++++++------ .../java2d/d3d/D3DScreenUpdateManager.java | 7 ++-- .../java2d/d3d/D3DVolatileSurfaceManager.java | 10 +++-- .../opengl/WGLVolatileSurfaceManager.java | 10 +++-- .../native/libawt/windows/awt_Font.cpp | 2 +- .../Component/Headless/HeadlessComponent.java | 3 +- .../Component/Headless/HeadlessContainer.java | 3 +- .../awt/Component/Headless/HeadlessPanel.java | 3 +- jdk/test/java/awt/FontClass/HeadlessFont.java | 7 +--- .../AWT_Mixing/OverlappingTestBase.java | 9 ++-- jdk/test/java/awt/Paint/ButtonRepaint.java | 10 +---- jdk/test/java/awt/Paint/CheckboxRepaint.java | 13 +----- jdk/test/java/awt/Paint/LabelRepaint.java | 11 +---- jdk/test/java/awt/Paint/ListRepaint.java | 8 +--- .../bug7129742.java | 10 +++-- .../java/awt/regtesthelpers/UtilInternal.java | 4 +- .../javax/swing/Headless/HeadlessBox.java | 3 +- .../swing/Headless/HeadlessBox_Filler.java | 3 +- .../Headless/HeadlessCellRendererPane.java | 3 +- .../HeadlessDefaultListCellRenderer.java | 3 +- ...essDefaultListCellRenderer_UIResource.java | 3 +- .../javax/swing/Headless/HeadlessJButton.java | 3 +- .../swing/Headless/HeadlessJCheckBox.java | 3 +- .../Headless/HeadlessJCheckBoxMenuItem.java | 3 +- .../swing/Headless/HeadlessJColorChooser.java | 3 +- .../swing/Headless/HeadlessJComboBox.java | 3 +- .../swing/Headless/HeadlessJComponent.java | 3 +- .../swing/Headless/HeadlessJDesktopPane.java | 3 +- .../swing/Headless/HeadlessJEditorPane.java | 3 +- .../swing/Headless/HeadlessJFileChooser.java | 3 +- .../Headless/HeadlessJInternalFrame.java | 3 +- .../HeadlessJInternalFrame_JDesktopIcon.java | 3 +- .../javax/swing/Headless/HeadlessJLabel.java | 3 +- .../swing/Headless/HeadlessJLayeredPane.java | 3 +- .../javax/swing/Headless/HeadlessJList.java | 3 +- .../javax/swing/Headless/HeadlessJMenu.java | 3 +- .../swing/Headless/HeadlessJMenuBar.java | 3 +- .../swing/Headless/HeadlessJMenuItem.java | 3 +- .../swing/Headless/HeadlessJOptionPane.java | 3 +- .../javax/swing/Headless/HeadlessJPanel.java | 3 +- .../swing/Headless/HeadlessJPopupMenu.java | 3 +- .../HeadlessJPopupMenu_Separator.java | 3 +- .../swing/Headless/HeadlessJProgressBar.java | 3 +- .../swing/Headless/HeadlessJRadioButton.java | 3 +- .../HeadlessJRadioButtonMenuItem.java | 3 +- .../swing/Headless/HeadlessJRootPane.java | 3 +- .../swing/Headless/HeadlessJScrollBar.java | 3 +- .../swing/Headless/HeadlessJScrollPane.java | 3 +- .../swing/Headless/HeadlessJSeparator.java | 3 +- .../javax/swing/Headless/HeadlessJSlider.java | 3 +- .../swing/Headless/HeadlessJSpinner.java | 3 +- .../swing/Headless/HeadlessJSplitPane.java | 3 +- .../swing/Headless/HeadlessJTabbedPane.java | 3 +- .../javax/swing/Headless/HeadlessJTable.java | 3 +- .../swing/Headless/HeadlessJTextArea.java | 3 +- .../swing/Headless/HeadlessJTextField.java | 3 +- .../swing/Headless/HeadlessJToggleButton.java | 3 +- .../swing/Headless/HeadlessJToolBar.java | 3 +- .../Headless/HeadlessJToolBar_Separator.java | 3 +- .../swing/Headless/HeadlessJToolTip.java | 3 +- .../javax/swing/Headless/HeadlessJTree.java | 3 +- .../swing/Headless/HeadlessJViewport.java | 3 +- 147 files changed, 625 insertions(+), 701 deletions(-) diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java index df3ad8dd893..19d1edd43dc 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -25,14 +25,18 @@ package com.apple.eawt; -import java.awt.*; -import java.awt.peer.*; +import java.awt.Image; +import java.awt.Point; +import java.awt.PopupMenu; +import java.awt.Toolkit; +import java.awt.Window; import java.beans.Beans; import javax.swing.JMenuBar; -import sun.lwawt.*; -import sun.lwawt.macosx.*; +import sun.awt.AWTAccessor; +import sun.lwawt.LWWindowPeer; +import sun.lwawt.macosx.CPlatformWindow; /** * The Application class allows you to integrate your Java application with the native Mac OS X environment. @@ -385,10 +389,8 @@ public class Application { * * @since Java for Mac OS X 10.7 Update 1 */ - @SuppressWarnings("deprecation") public void requestToggleFullScreen(final Window window) { - final ComponentPeer peer = window.getPeer(); - + final Object peer = AWTAccessor.getComponentAccessor().getPeer(window); if (!(peer instanceof LWWindowPeer)) return; Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow(); if (!(platformWindow instanceof CPlatformWindow)) return; diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java index 76dea3a7ed3..4f09f53e930 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -28,6 +28,7 @@ package com.apple.eawt; import java.awt.*; import java.lang.reflect.*; +import sun.awt.AWTAccessor; import sun.lwawt.macosx.*; import sun.lwawt.macosx.CImage.Creator; @@ -41,7 +42,6 @@ class _AppDockIconHandler { _AppDockIconHandler() { } - @SuppressWarnings("deprecation") public void setDockMenu(final PopupMenu menu) { fDockMenu = menu; @@ -61,8 +61,8 @@ class _AppDockIconHandler { // instantiate the menu peer and set the native fDockMenu ivar menu.addNotify(); - final long nsMenuPtr = ((CMenu)fDockMenu.getPeer()).getNativeMenu(); - nativeSetDockMenu(nsMenuPtr); + CMenu peer = AWTAccessor.getMenuComponentAccessor().getPeer(fDockMenu); + nativeSetDockMenu(peer.getNativeMenu()); } public PopupMenu getDockMenu() { diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java index f63441ba285..3ac88f81379 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -32,6 +32,7 @@ import javax.swing.*; import javax.swing.plaf.MenuBarUI; import com.apple.laf.ScreenMenuBar; +import sun.awt.AWTAccessor; import sun.lwawt.macosx.CMenuBar; import com.apple.laf.AquaMenuBarUI; @@ -49,7 +50,10 @@ class _AppMenuBarHandler { } // callback from the native delegate -init function - private static void initMenuStates(final boolean aboutMenuItemVisible, final boolean aboutMenuItemEnabled, final boolean prefsMenuItemVisible, final boolean prefsMenuItemEnabled) { + private static void initMenuStates(final boolean aboutMenuItemVisible, + final boolean aboutMenuItemEnabled, + final boolean prefsMenuItemVisible, + final boolean prefsMenuItemEnabled) { synchronized (instance) { instance.aboutMenuItemVisible = aboutMenuItemVisible; instance.aboutMenuItemEnabled = aboutMenuItemEnabled; @@ -92,7 +96,6 @@ class _AppMenuBarHandler { return (frame.getExtendedState() & Frame.ICONIFIED) != 0; } - @SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu @@ -114,7 +117,7 @@ class _AppMenuBarHandler { } screenMenuBar.addNotify(); - final MenuComponentPeer peer = screenMenuBar.getPeer(); + final Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(screenMenuBar); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java index 26f2971f040..5ad93e40555 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -27,11 +27,11 @@ package com.apple.laf; import java.awt.*; import java.awt.event.*; -import java.awt.peer.MenuComponentPeer; import java.util.Hashtable; import javax.swing.*; +import sun.awt.AWTAccessor; import sun.awt.SunToolkit; import sun.lwawt.LWToolkit; import sun.lwawt.macosx.*; @@ -212,24 +212,36 @@ final class ScreenMenu extends Menu // Send a mouseExited to the previously hilited item, if it wasn't 0. if (target != fLastMouseEventTarget) { if (fLastMouseEventTarget != null) { - LWToolkit.postEvent(new MouseEvent(fLastMouseEventTarget, MouseEvent.MOUSE_EXITED, when, modifiers, x - fLastTargetRect.x, y - fLastTargetRect.y, 0, false)); + LWToolkit.postEvent( + new MouseEvent(fLastMouseEventTarget, + MouseEvent.MOUSE_EXITED, when, + modifiers, x - fLastTargetRect.x, + y - fLastTargetRect.y, 0, + false)); } - // Send a mouseEntered to the current hilited item, if it wasn't 0. + // Send a mouseEntered to the current hilited item, if it + // wasn't 0. if (target != null) { - LWToolkit.postEvent(new MouseEvent(target, MouseEvent.MOUSE_ENTERED, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false)); + LWToolkit.postEvent( + new MouseEvent(target, MouseEvent.MOUSE_ENTERED, + when, modifiers, + x - targetRect.x, + y - targetRect.y, 0, false)); } fLastMouseEventTarget = target; fLastTargetRect = targetRect; } // Post a mouse event to the current item. if (target == null) return; - LWToolkit.postEvent(new MouseEvent(target, kind, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false)); + LWToolkit.postEvent( + new MouseEvent(target, kind, when, modifiers, + x - targetRect.x, y - targetRect.y, 0, + false)); } }); } @Override - @SuppressWarnings("deprecation") public void addNotify() { synchronized (getTreeLock()) { super.addNotify(); @@ -248,7 +260,8 @@ final class ScreenMenu extends Menu if (tooltipText != null) { setToolTipText(tooltipText); } - final MenuComponentPeer peer = getPeer(); + final Object peer = AWTAccessor.getMenuComponentAccessor() + .getPeer(this); if (peer instanceof CMenu) { final CMenu menu = (CMenu) peer; final long nativeMenu = menu.getNativeMenu(); @@ -355,9 +368,8 @@ final class ScreenMenu extends Menu public void setIndeterminate(boolean indeterminate) { } @Override - @SuppressWarnings("deprecation") public void setToolTipText(final String text) { - final MenuComponentPeer peer = getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; @@ -365,9 +377,8 @@ final class ScreenMenu extends Menu } @Override - @SuppressWarnings("deprecation") public void setIcon(final Icon i) { - final MenuComponentPeer peer = getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java index a3591e64250..5f4ede3687c 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -25,19 +25,21 @@ package com.apple.laf; -import sun.awt.AWTAccessor; import sun.lwawt.macosx.CMenuBar; import java.awt.*; import java.awt.event.*; -import java.lang.reflect.*; -import java.security.*; import java.util.*; import javax.swing.*; +import static sun.awt.AWTAccessor.*; + @SuppressWarnings("serial") // JDK implementation class -public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenMenuPropertyHandler, ComponentListener { +public class ScreenMenuBar extends MenuBar + implements ContainerListener, ScreenMenuPropertyHandler, + ComponentListener { + static boolean sJMenuBarHasHelpMenus = false; //$ could check by calling getHelpMenu in a try block JMenuBar fSwingBar; @@ -246,22 +248,23 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM fSubmenus.remove(menu); } - @SuppressWarnings("deprecation") public Menu add(final Menu m, final int index) { synchronized (getTreeLock()) { if (m.getParent() != null) { m.getParent().remove(m); } - final Vector menus = AWTAccessor.getMenuBarAccessor().getMenus(this); + final Vector menus = getMenuBarAccessor().getMenus(this); menus.insertElementAt(m, index); - AWTAccessor.getMenuComponentAccessor().setParent(m, this); + final MenuComponentAccessor acc = getMenuComponentAccessor(); + acc.setParent(m, this); - final CMenuBar peer = (CMenuBar)getPeer(); + final CMenuBar peer = acc.getPeer(this); if (peer == null) return m; peer.setNextInsertionIndex(index); - if (m.getPeer() == null) { + final CMenuBar mPeer = acc.getPeer(m); + if (mPeer == null) { m.addNotify(); } diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItem.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItem.java index 127760a2db5..8d0b67489b6 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItem.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -27,15 +27,18 @@ package com.apple.laf; import java.awt.*; import java.awt.event.*; -import java.awt.peer.MenuComponentPeer; import javax.swing.*; import javax.swing.plaf.ComponentUI; +import sun.awt.AWTAccessor; import sun.lwawt.macosx.CMenuItem; @SuppressWarnings("serial") // JDK implementation class -final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler { +final class ScreenMenuItem extends MenuItem + implements ActionListener, ComponentListener, + ScreenMenuPropertyHandler { + ScreenMenuPropertyListener fListener; JMenuItem fMenuItem; @@ -97,9 +100,8 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component fMenuItem.removeComponentListener(this); } - @SuppressWarnings("deprecation") static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) { - final MenuComponentPeer peer = menuItem.getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem); if (!(peer instanceof CMenuItem)) { //Is it possible? return; @@ -166,18 +168,16 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component } } - @SuppressWarnings("deprecation") public void setToolTipText(final String text) { - final MenuComponentPeer peer = getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; cmi.setToolTipText(text); } - @SuppressWarnings("deprecation") public void setIcon(final Icon i) { - final MenuComponentPeer peer = getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java index 2ee97f805b7..de38fd52b42 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -27,17 +27,20 @@ package com.apple.laf; import java.awt.*; import java.awt.event.*; -import java.awt.peer.MenuComponentPeer; import javax.swing.*; import javax.swing.plaf.ButtonUI; import com.apple.laf.AquaMenuItemUI.IndeterminateListener; +import sun.awt.AWTAccessor; import sun.lwawt.macosx.*; @SuppressWarnings("serial") // JDK implementation class -final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener { +final class ScreenMenuItemCheckbox extends CheckboxMenuItem + implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, + ItemListener { + JMenuItem fMenuItem; MenuContainer fParent; @@ -57,12 +60,12 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis } ScreenMenuPropertyListener fPropertyListener; - @SuppressWarnings("deprecation") + public void addNotify() { super.addNotify(); // Avoid the Auto toggle behavior of AWT CheckBoxMenuItem - CCheckboxMenuItem ccb = (CCheckboxMenuItem) getPeer(); + CCheckboxMenuItem ccb = AWTAccessor.getMenuComponentAccessor().getPeer(this); ccb.setAutoToggle(false); fMenuItem.addComponentListener(this); @@ -155,17 +158,15 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis setVisible(false); } - @SuppressWarnings("deprecation") public void setToolTipText(final String text) { - final MenuComponentPeer peer = getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; ((CMenuItem)peer).setToolTipText(text); } - @SuppressWarnings("deprecation") public void setIcon(final Icon i) { - final MenuComponentPeer peer = getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; @@ -208,9 +209,8 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis } } - @SuppressWarnings("deprecation") public void setIndeterminate(final boolean indeterminate) { - final MenuComponentPeer peer = getPeer(); + Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (peer instanceof CCheckboxMenuItem) { ((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate); } diff --git a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java index c69723af22d..05fe2531c13 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java +++ b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -206,17 +206,15 @@ public final class CGraphicsDevice extends GraphicsDevice return true; } - @SuppressWarnings("deprecation") private static void enterFullScreenExclusive(Window w) { - FullScreenCapable peer = (FullScreenCapable)w.getPeer(); + FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w); if (peer != null) { peer.enterFullScreenMode(); } } - @SuppressWarnings("deprecation") private static void exitFullScreenExclusive(Window w) { - FullScreenCapable peer = (FullScreenCapable)w.getPeer(); + FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w); if (peer != null) { peer.exitFullScreenMode(); } diff --git a/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java b/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java index d54583bca91..9071f40ae57 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java +++ b/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -33,13 +33,14 @@ import java.awt.Transparency; import java.awt.image.ColorModel; import java.awt.peer.ComponentPeer; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.image.SunVolatileImage; import sun.awt.image.VolatileSurfaceManager; import sun.java2d.BackBufferCapsProvider; import sun.java2d.SurfaceData; import static sun.java2d.opengl.OGLContext.OGLContextCaps.*; import sun.java2d.pipe.hw.ExtendedBufferCapabilities; -import static sun.java2d.pipe.hw.AccelSurface.*; import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*; public class CGLVolatileSurfaceManager extends VolatileSurfaceManager { @@ -74,11 +75,11 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager { * Create a pbuffer-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig) */ - @SuppressWarnings("deprecation") protected SurfaceData initAcceleratedSurface() { SurfaceData sData = null; Component comp = vImg.getComponent(); - final ComponentPeer peer = (comp != null) ? comp.getPeer() : null; + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + final ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null; try { boolean createVSynced = false; diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java index ca731ba3a72..d0a3f65ed58 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -930,8 +930,8 @@ public abstract class LWComponentPeer return false; } final LWWindowPeer parentPeer = - (LWWindowPeer) AWTAccessor.getComponentAccessor() - .getPeer(parentWindow); + AWTAccessor.getComponentAccessor() + .getPeer(parentWindow); if (parentPeer == null) { focusLog.fine("request rejected, parentPeer is null"); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java index d8656c58750..1db30c021fa 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -33,6 +33,7 @@ import java.util.List; import javax.swing.*; import sun.awt.*; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.java2d.*; import sun.java2d.loops.Blit; import sun.java2d.loops.CompositeType; @@ -505,7 +506,7 @@ public class LWWindowPeer @Override public void repositionSecurityWarning() { if (warningWindow != null) { - AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); + ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); Window target = getTarget(); int x = compAccessor.getX(target); int y = compAccessor.getY(target); @@ -563,8 +564,7 @@ public class LWWindowPeer public void blockWindows(List windows) { //TODO: LWX will probably need some collectJavaToplevels to speed this up for (Window w : windows) { - WindowPeer wp = - (WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w); + WindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w); if (wp != null) { wp.setModalBlocked((Dialog)getTarget(), true); } @@ -1247,7 +1247,8 @@ public class LWWindowPeer private boolean isOneOfOwnersOf(LWWindowPeer peer) { Window owner = (peer != null ? peer.getTarget().getOwner() : null); while (owner != null) { - if ((LWWindowPeer)owner.getPeer() == this) { + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + if (acc.getPeer(owner) == this) { return true; } owner = owner.getOwner(); @@ -1321,8 +1322,8 @@ public class LWWindowPeer while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { owner = owner.getOwner(); } - return owner == null ? null : - (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner); + return owner == null ? null : AWTAccessor.getComponentAccessor() + .getPeer(owner); } /** diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java index 0f4224bb803..af5c59d420c 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -39,6 +39,7 @@ import javax.accessibility.*; import java.util.Map; import java.util.concurrent.Callable; +import sun.awt.AWTAccessor; import sun.awt.dnd.*; import sun.lwawt.LWComponentPeer; import sun.lwawt.LWWindowPeer; @@ -88,7 +89,6 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { super.startDrag(dsc, cursor, dragImage, dragImageOffset); } - @SuppressWarnings("deprecation") protected void startDrag(Transferable transferable, long[] formats, Map formatMap) { DragGestureEvent trigger = getTrigger(); InputEvent triggerEvent = trigger.getTriggerEvent(); @@ -135,7 +135,9 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { try { //It sure will be LWComponentPeer instance as rootComponent is a Window - PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow(); + LWComponentPeer peer = AWTAccessor.getComponentAccessor() + .getPeer(rootComponent); + PlatformWindow platformWindow = peer.getPlatformWindow(); long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow); if (nativeViewPtr == 0L) throw new InvalidDnDOperationException("Unsupported platform window implementation"); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java index e1895c2e2f0..b34eff3f373 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke; import java.awt.Point; import java.awt.Toolkit; +import sun.awt.AWTAccessor; import sun.awt.EmbeddedFrame; import sun.lwawt.LWWindowPeer; @@ -46,9 +47,8 @@ public class CEmbeddedFrame extends EmbeddedFrame { show(); } - @SuppressWarnings("deprecation") public void addNotify() { - if (getPeer() == null) { + if (!isDisplayable()) { LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit(); LWWindowPeer peer = toolkit.createEmbeddedFrame(this); setPeer(peer); @@ -61,10 +61,9 @@ public class CEmbeddedFrame extends EmbeddedFrame { public void unregisterAccelerator(AWTKeyStroke stroke) {} - @SuppressWarnings("deprecation") protected long getLayerPtr() { - LWWindowPeer peer = (LWWindowPeer)getPeer(); - return peer.getLayerPtr(); + return AWTAccessor.getComponentAccessor().getPeer(this) + .getLayerPtr(); } // ----------------------------------------------------------------------- diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethod.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethod.java index 0ee9ea7afac..80a68126a98 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethod.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -38,9 +38,12 @@ import java.text.AttributedCharacterIterator.Attribute; import java.text.*; import javax.swing.text.JTextComponent; +import sun.awt.AWTAccessor; import sun.awt.im.InputMethodAdapter; import sun.lwawt.*; +import static sun.awt.AWTAccessor.ComponentAccessor; + public class CInputMethod extends InputMethodAdapter { private InputMethodContext fIMContext; private Component fAwtFocussedComponent; @@ -385,12 +388,11 @@ public class CInputMethod extends InputMethodAdapter { // java.awt.Toolkit#getNativeContainer() is not available // from this package - @SuppressWarnings("deprecation") private LWComponentPeer getNearestNativePeer(Component comp) { if (comp==null) return null; - - ComponentPeer peer = comp.getPeer(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + ComponentPeer peer = acc.getPeer(comp); if (peer==null) return null; @@ -398,7 +400,7 @@ public class CInputMethod extends InputMethodAdapter { comp = comp.getParent(); if (comp==null) return null; - peer = comp.getPeer(); + peer = acc.getPeer(comp); if (peer==null) return null; } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java index 9073b5a7878..7d2aa7b7beb 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -29,6 +29,8 @@ import java.awt.Menu; import java.awt.MenuBar; import java.awt.peer.MenuBarPeer; +import sun.awt.AWTAccessor; + public class CMenuBar extends CMenuComponent implements MenuBarPeer { private int nextInsertionIndex = -1; @@ -43,9 +45,8 @@ public class CMenuBar extends CMenuComponent implements MenuBarPeer { } @Override - @SuppressWarnings("deprecation") public void addHelpMenu(Menu m) { - CMenu cMenu = (CMenu)m.getPeer(); + CMenu cMenu = AWTAccessor.getMenuComponentAccessor().getPeer(m); nativeSetHelpMenu(getModel(), cMenu.getModel()); } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 888e89cd11c..949a9a168d9 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -31,12 +31,11 @@ import java.awt.event.*; import java.awt.peer.WindowPeer; import java.beans.*; import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.Objects; import javax.swing.*; import sun.awt.*; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.java2d.SurfaceData; import sun.java2d.opengl.CGLSurfaceData; import sun.lwawt.*; @@ -193,8 +192,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo @SuppressWarnings("deprecation") public CPlatformWindow convertJComponentToTarget(final JRootPane p) { Component root = SwingUtilities.getRoot(p); - if (root == null || (LWWindowPeer)root.getPeer() == null) return null; - return (CPlatformWindow)((LWWindowPeer)root.getPeer()).getPlatformWindow(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + if (root == null || acc.getPeer(root) == null) return null; + return (CPlatformWindow)((LWWindowPeer)acc.getPeer(root)).getPlatformWindow(); } }; @@ -523,15 +523,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo } @Override // PlatformWindow - @SuppressWarnings("deprecation") public void setVisible(boolean visible) { final long nsWindowPtr = getNSWindowPtr(); // Process parent-child relationship when hiding + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); if (!visible) { // Unparent my children for (Window w : target.getOwnedWindows()) { - WindowPeer p = (WindowPeer)w.getPeer(); + WindowPeer p = acc.getPeer(w); if (p instanceof LWWindowPeer) { CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); if (pw != null && pw.isVisible()) { @@ -627,7 +627,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // Add my own children to myself for (Window w : target.getOwnedWindows()) { - WindowPeer p = (WindowPeer)w.getPeer(); + final Object p = acc.getPeer(w); if (p instanceof LWWindowPeer) { CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); if (pw != null && pw.isVisible()) { @@ -679,13 +679,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo } @Override // PlatformWindow - @SuppressWarnings("deprecation") public void toFront() { final long nsWindowPtr = getNSWindowPtr(); LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit(); Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); - if( w != null && w.getPeer() != null - && ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + if( w != null && acc.getPeer(w) != null + && ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME && !lwcToolkit.isApplicationActive()) { lwcToolkit.activateApplicationIgnoringOtherApps(); } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java index 00a68af0dc4..0e0d0a475e0 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -37,6 +37,8 @@ import java.awt.peer.TrayIconPeer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import static sun.awt.AWTAccessor.*; + public class CTrayIcon extends CFRetainedResource implements TrayIconPeer { private TrayIcon target; private PopupMenu popup; @@ -68,15 +70,15 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer { updateImage(); } - @SuppressWarnings("deprecation") private CPopupMenu checkAndCreatePopupPeer() { CPopupMenu menuPeer = null; if (popup != null) { try { - menuPeer = (CPopupMenu)popup.getPeer(); + final MenuComponentAccessor acc = getMenuComponentAccessor(); + menuPeer = acc.getPeer(popup); if (menuPeer == null) { popup.addNotify(); - menuPeer = (CPopupMenu)popup.getPeer(); + menuPeer = acc.getPeer(popup); } } catch (Exception e) { e.printStackTrace(); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java index e40e56e9b2e..095922047fe 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke; import java.awt.Toolkit; import java.lang.reflect.InvocationTargetException; +import sun.awt.AWTAccessor; import sun.awt.EmbeddedFrame; import sun.lwawt.LWWindowPeer; @@ -48,10 +49,9 @@ public class CViewEmbeddedFrame extends EmbeddedFrame { this.nsViewPtr = nsViewPtr; } - @SuppressWarnings("deprecation") @Override public void addNotify() { - if (getPeer() == null) { + if (!isDisplayable()) { LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit(); setPeer(toolkit.createEmbeddedFrame(this)); } @@ -78,11 +78,12 @@ public class CViewEmbeddedFrame extends EmbeddedFrame { * Synthetic event delivery for focus management */ @Override - @SuppressWarnings("deprecation") public void synthesizeWindowActivation(boolean activated) { if (isActive != activated) { isActive = activated; - ((LWWindowPeer)getPeer()).notifyActivation(activated, null); + final LWWindowPeer peer = AWTAccessor.getComponentAccessor() + .getPeer(this); + peer.notifyActivation(activated, null); } } @@ -91,13 +92,14 @@ public class CViewEmbeddedFrame extends EmbeddedFrame { * Designed to be called from the main thread * This method should be called once from the initialization of the SWT_AWT Bridge */ - @SuppressWarnings("deprecation") public void validateWithBounds(final int x, final int y, final int width, final int height) { try { + final LWWindowPeer peer = AWTAccessor.getComponentAccessor() + .getPeer(this); LWCToolkit.invokeAndWait(new Runnable() { @Override public void run() { - ((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height); + peer.setBoundsPrivate(0, 0, width, height); validate(); setVisible(true); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/Canvas.java b/jdk/src/java.desktop/share/classes/java/awt/Canvas.java index 372f50f508d..02b2bec0f43 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Canvas.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Canvas.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, 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 @@ -70,10 +70,9 @@ public class Canvas extends Component implements Accessible { } @Override - @SuppressWarnings("deprecation") void setGraphicsConfiguration(GraphicsConfiguration gc) { synchronized(getTreeLock()) { - CanvasPeer peer = (CanvasPeer)getPeer(); + CanvasPeer peer = (CanvasPeer) this.peer; if (peer != null) { gc = peer.getAppropriateGraphicsConfiguration(gc); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/Component.java b/jdk/src/java.desktop/share/classes/java/awt/Component.java index 72e473d8465..41cf33369b0 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Component.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java @@ -198,7 +198,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @see #addNotify * @see #removeNotify */ - transient ComponentPeer peer; + transient volatile ComponentPeer peer; /** * The parent of the object. It may be null @@ -924,8 +924,9 @@ public abstract class Component implements ImageObserver, MenuContainer, public Cursor getCursor(Component comp) { return comp.getCursor_NoClientCode(); } - public ComponentPeer getPeer(Component comp) { - return comp.peer; + @SuppressWarnings("unchecked") + public T getPeer(Component comp) { + return (T) comp.peer; } public void setPeer(Component comp, ComponentPeer peer) { comp.peer = peer; @@ -1068,17 +1069,6 @@ public abstract class Component implements ImageObserver, MenuContainer, return getParent_NoClientCode(); } - /** - * @deprecated As of JDK version 1.1, - * programs should not directly manipulate peers; - * replaced by boolean isDisplayable(). - * @return the peer for this component - */ - @Deprecated - public ComponentPeer getPeer() { - return peer; - } - /** * Associate a DropTarget with this component. * The Component will receive drops only if it @@ -1179,7 +1169,7 @@ public abstract class Component implements ImageObserver, MenuContainer, graphicsConfig = gc; - ComponentPeer peer = getPeer(); + ComponentPeer peer = this.peer; if (peer != null) { return peer.updateGraphicsData(gc); } @@ -1281,7 +1271,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @since 1.2 */ public boolean isDisplayable() { - return getPeer() != null; + return peer != null; } /** @@ -2582,7 +2572,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @since 1.2 */ public boolean isOpaque() { - if (getPeer() == null) { + if (peer == null) { return false; } else { @@ -2608,7 +2598,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @since 1.2 */ public boolean isLightweight() { - return getPeer() instanceof LightweightPeer; + return peer instanceof LightweightPeer; } @@ -3126,7 +3116,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * obtained * @return the font metrics for font * @see #getFont - * @see #getPeer * @see java.awt.peer.ComponentPeer#getFontMetrics(Font) * @see Toolkit#getFontMetrics(Font) * @since 1.0 @@ -3186,7 +3175,7 @@ public abstract class Component implements ImageObserver, MenuContainer, if (nativeContainer == null) return; - ComponentPeer cPeer = nativeContainer.getPeer(); + ComponentPeer cPeer = nativeContainer.peer; if (cPeer != null) { cPeer.updateCursorImmediately(); @@ -5019,7 +5008,7 @@ public abstract class Component implements ImageObserver, MenuContainer, if (source != null) { Container target = source.getNativeContainer(); if (target != null) { - tpeer = target.getPeer(); + tpeer = target.peer; } } } @@ -9851,7 +9840,7 @@ public abstract class Component implements ImageObserver, MenuContainer, } if (!isLightweight()) { - ComponentPeer peer = getPeer(); + ComponentPeer peer = this.peer; if (peer != null) { // The Region class has some optimizations. That's why // we should manually check whether it's empty and @@ -9975,7 +9964,7 @@ public abstract class Component implements ImageObserver, MenuContainer, for (int i = indexAbove; i > -1; i--) { Component comp = cont.getComponent(i); if (comp != null && comp.isDisplayable() && !comp.isLightweight()) { - return comp.getPeer(); + return comp.peer; } } // traversing the hierarchy up to the closest HW container; diff --git a/jdk/src/java.desktop/share/classes/java/awt/Container.java b/jdk/src/java.desktop/share/classes/java/awt/Container.java index 86607534163..cbd01b957ee 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Container.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java @@ -820,7 +820,7 @@ public class Container extends Component { } } else { // Q: Need to update NativeInLightFixer? - comp.getPeer().reparent(parentPeer); + comp.peer.reparent(parentPeer); } } } @@ -840,10 +840,10 @@ public class Container extends Component { // If component is lightweight container we need to reparent all its explicit heavyweight children if (comp instanceof Container) { // Traverse component's tree till depth-first until encountering heavyweight component - reparentTraverse((ContainerPeer)getPeer(), (Container)comp); + reparentTraverse((ContainerPeer)peer, (Container)comp); } } else { - comp.getPeer().reparent((ContainerPeer)getPeer()); + comp.peer.reparent((ContainerPeer) peer); } } @@ -4195,7 +4195,7 @@ public class Container extends Component { } } else { if (comp.isVisible()) { - ComponentPeer peer = comp.getPeer(); + ComponentPeer peer = comp.peer; if (peer != null) { peer.setVisible(true); } @@ -4217,7 +4217,7 @@ public class Container extends Component { } } else { if (comp.isVisible()) { - ComponentPeer peer = comp.getPeer(); + ComponentPeer peer = comp.peer; if (peer != null) { peer.setVisible(false); } @@ -4239,7 +4239,7 @@ public class Container extends Component { ((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin); } } else { - ComponentPeer peer = comp.getPeer(); + ComponentPeer peer = comp.peer; if (peer != null) { peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(), comp.getWidth(), comp.getHeight(), diff --git a/jdk/src/java.desktop/share/classes/java/awt/DefaultFocusTraversalPolicy.java b/jdk/src/java.desktop/share/classes/java/awt/DefaultFocusTraversalPolicy.java index e53ca92830e..508de7d9bc9 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/DefaultFocusTraversalPolicy.java +++ b/jdk/src/java.desktop/share/classes/java/awt/DefaultFocusTraversalPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -93,7 +93,6 @@ public class DefaultFocusTraversalPolicy * @return true if aComponent meets the above requirements; * false otherwise */ - @SuppressWarnings("deprecation") protected boolean accept(Component aComponent) { if (!(aComponent.isVisible() && aComponent.isDisplayable() && aComponent.isEnabled())) @@ -123,7 +122,7 @@ public class DefaultFocusTraversalPolicy return focusable; } - ComponentPeer peer = aComponent.getPeer(); + ComponentPeer peer = aComponent.peer; return (peer != null && peer.isFocusable()); } } diff --git a/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java b/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java index b18e1e2a473..d6ef4d61fdd 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -796,7 +796,6 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { * @return true * @see Component#dispatchEvent */ - @SuppressWarnings("deprecation") public boolean dispatchKeyEvent(KeyEvent e) { Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent(); @@ -824,14 +823,14 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { // Allow the peer to process KeyEvent Component source = e.getComponent(); - ComponentPeer peer = source.getPeer(); + ComponentPeer peer = source.peer; if (peer == null || peer instanceof LightweightPeer) { // if focus owner is lightweight then its native container // processes event Container target = source.getNativeContainer(); if (target != null) { - peer = target.getPeer(); + peer = target.peer; } } if (peer != null) { @@ -1049,7 +1048,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { Component source = (Component)ke.getSource(); Container target = source.getNativeContainer(); if (target != null) { - ComponentPeer peer = target.getPeer(); + ComponentPeer peer = target.peer; if (peer != null) { peer.handleEvent(ke); /** diff --git a/jdk/src/java.desktop/share/classes/java/awt/Dialog.java b/jdk/src/java.desktop/share/classes/java/awt/Dialog.java index 4aa69d837e8..25274a6326a 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Dialog.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Dialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, 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 @@ -36,11 +36,9 @@ import javax.accessibility.*; import sun.awt.AppContext; import sun.awt.AWTPermissions; import sun.awt.SunToolkit; -import sun.awt.PeerEvent; import sun.awt.util.IdentityArrayList; import sun.awt.util.IdentityLinkedList; import java.security.AccessControlException; -import java.util.function.BooleanSupplier; /** * A Dialog is a top-level window with a title and a border @@ -749,10 +747,9 @@ public class Dialog extends Window { * @see Component#isDisplayable * @see #removeNotify */ - @SuppressWarnings("deprecation") public void addNotify() { synchronized (getTreeLock()) { - if (parent != null && parent.getPeer() == null) { + if (parent != null && parent.peer == null) { parent.addNotify(); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/FileDialog.java b/jdk/src/java.desktop/share/classes/java/awt/FileDialog.java index 6a6052e6ea8..005ed37ad42 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/FileDialog.java +++ b/jdk/src/java.desktop/share/classes/java/awt/FileDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, 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 @@ -314,10 +314,9 @@ public class FileDialog extends Dialog { * Creates the file dialog's peer. The peer allows us to change the look * of the file dialog without changing its functionality. */ - @SuppressWarnings("deprecation") public void addNotify() { synchronized(getTreeLock()) { - if (parent != null && parent.getPeer() == null) { + if (parent != null && parent.peer == null) { parent.addNotify(); } if (peer == null) diff --git a/jdk/src/java.desktop/share/classes/java/awt/Font.java b/jdk/src/java.desktop/share/classes/java/awt/Font.java index 3a251709bd5..e76801c483a 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Font.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Font.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, 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 @@ -41,7 +41,6 @@ import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.text.AttributedCharacterIterator.Attribute; import java.text.CharacterIterator; -import java.text.StringCharacterIterator; import java.util.Hashtable; import java.util.Locale; import java.util.Map; @@ -239,6 +238,11 @@ public class Font implements java.io.Serializable public boolean isCreatedFont(Font font) { return font.createdFont; } + + @Override + public FontPeer getFontPeer(final Font font) { + return font.getFontPeer(); + } } static { @@ -434,24 +438,15 @@ public class Font implements java.io.Serializable private static final long serialVersionUID = -4206021311591459213L; /** - * Gets the peer of this Font. - * @return the peer of the Font. - * @since 1.1 - * @deprecated Font rendering is now platform independent. + * Gets the peer of this {@code Font}. + * + * @return the peer of the {@code Font}. */ - @Deprecated - public FontPeer getPeer(){ - return getPeer_NoClientCode(); - } - // NOTE: This method is called by privileged threads. - // We implement this functionality in a package-private method - // to insure that it cannot be overridden by client subclasses. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! @SuppressWarnings("deprecation") - final FontPeer getPeer_NoClientCode() { + private FontPeer getFontPeer() { if(peer == null) { Toolkit tk = Toolkit.getDefaultToolkit(); - this.peer = tk.getFontPeer(name, style); + peer = tk.getFontPeer(name, style); } return peer; } diff --git a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java index d601fbfcdfc..f234b1bf784 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -3054,11 +3054,10 @@ public abstract class KeyboardFocusManager return (wto != wfrom); } - @SuppressWarnings("deprecation") static Component getHeavyweight(Component comp) { - if (comp == null || comp.getPeer() == null) { + if (comp == null || comp.peer == null) { return null; - } else if (comp.getPeer() instanceof LightweightPeer) { + } else if (comp.peer instanceof LightweightPeer) { return comp.getNativeContainer(); } else { return comp; diff --git a/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java b/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java index f9f9f28da0d..0fafb180d10 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java @@ -57,7 +57,7 @@ public abstract class MenuComponent implements java.io.Serializable { } } - transient MenuComponentPeer peer; + transient volatile MenuComponentPeer peer; transient MenuContainer parent; /** @@ -142,6 +142,11 @@ public abstract class MenuComponent implements java.io.Serializable { menuComp.appContext = appContext; } @Override + @SuppressWarnings("unchecked") + public T getPeer(MenuComponent menuComp) { + return (T) menuComp.peer; + } + @Override public MenuContainer getParent(MenuComponent menuComp) { return menuComp.parent; } @@ -225,16 +230,6 @@ public abstract class MenuComponent implements java.io.Serializable { return parent; } - /** - * @deprecated As of JDK version 1.1, - * programs should not directly manipulate peers. - * @return the peer for this component - */ - @Deprecated - public MenuComponentPeer getPeer() { - return peer; - } - /** * Gets the font used for this menu component. * @return the font used in this menu component, if there is one; diff --git a/jdk/src/java.desktop/share/classes/java/awt/PopupMenu.java b/jdk/src/java.desktop/share/classes/java/awt/PopupMenu.java index 6b9f6432066..690c7f976d9 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/PopupMenu.java +++ b/jdk/src/java.desktop/share/classes/java/awt/PopupMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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 @@ -153,7 +153,6 @@ public class PopupMenu extends Menu { * parent's hierarchy * @exception RuntimeException if the parent is not showing on screen */ - @SuppressWarnings("deprecation") public void show(Component origin, int x, int y) { // Use localParent for thread safety. MenuContainer localParent = parent; @@ -177,7 +176,7 @@ public class PopupMenu extends Menu { throw new IllegalArgumentException("origin not in parent's hierarchy"); } } - if (compParent.getPeer() == null || !compParent.isShowing()) { + if (compParent.peer == null || !compParent.isShowing()) { throw new RuntimeException("parent not showing on screen"); } if (peer == null) { diff --git a/jdk/src/java.desktop/share/classes/java/awt/Window.java b/jdk/src/java.desktop/share/classes/java/awt/Window.java index 56ca461a90b..8ecb6c266da 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Window.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java @@ -29,7 +29,6 @@ import java.awt.geom.Path2D; import java.awt.geom.Point2D; import java.awt.im.InputContext; import java.awt.image.BufferStrategy; -import java.awt.image.BufferedImage; import java.awt.peer.ComponentPeer; import java.awt.peer.WindowPeer; import java.beans.PropertyChangeListener; @@ -56,7 +55,6 @@ import sun.awt.AppContext; import sun.awt.CausedFocusEvent; import sun.awt.SunToolkit; import sun.awt.util.IdentityArrayList; -import sun.java2d.Disposer; import sun.java2d.pipe.Region; import sun.security.action.GetPropertyAction; import sun.util.logging.PlatformLogger; @@ -755,11 +753,10 @@ public class Window extends Container implements Accessible { * @see Container#removeNotify * @since 1.0 */ - @SuppressWarnings("deprecation") public void addNotify() { synchronized (getTreeLock()) { Container parent = this.parent; - if (parent != null && parent.getPeer() == null) { + if (parent != null && parent.peer == null) { parent.addNotify(); } if (peer == null) { @@ -802,7 +799,7 @@ public class Window extends Container implements Accessible { @SuppressWarnings("deprecation") public void pack() { Container parent = this.parent; - if (parent != null && parent.getPeer() == null) { + if (parent != null && parent.peer == null) { parent.addNotify(); } if (peer == null) { @@ -1072,10 +1069,9 @@ public class Window extends Container implements Accessible { } } - @SuppressWarnings("deprecation") static void updateChildFocusableWindowState(Window w) { - if (w.getPeer() != null && w.isShowing()) { - ((WindowPeer)w.getPeer()).updateFocusableWindowState(); + if (w.peer != null && w.isShowing()) { + ((WindowPeer)w.peer).updateFocusableWindowState(); } for (int i = 0; i < w.ownedWindowList.size(); i++) { Window child = w.ownedWindowList.elementAt(i).get(); @@ -1160,10 +1156,9 @@ public class Window extends Container implements Accessible { * as reported in javadoc. So we need to implement this functionality even if a * child overrides dispose() in a wrong way without calling super.dispose(). */ - @SuppressWarnings("deprecation") void disposeImpl() { dispose(); - if (getPeer() != null) { + if (peer != null) { doDispose(); } } @@ -3651,7 +3646,7 @@ public class Window extends Container implements Accessible { } } this.opacity = opacity; - WindowPeer peer = (WindowPeer)getPeer(); + WindowPeer peer = (WindowPeer) this.peer; if (peer != null) { peer.setOpacity(opacity); } @@ -3728,7 +3723,6 @@ public class Window extends Container implements Accessible { * * @since 1.7 */ - @SuppressWarnings("deprecation") public void setShape(Shape shape) { synchronized (getTreeLock()) { if (shape != null) { @@ -3746,7 +3740,7 @@ public class Window extends Container implements Accessible { } } this.shape = (shape == null) ? null : new Path2D.Float(shape); - WindowPeer peer = (WindowPeer)getPeer(); + WindowPeer peer = (WindowPeer) this.peer; if (peer != null) { peer.applyShape(shape == null ? null : Region.getInstance(shape, null)); } @@ -3846,7 +3840,6 @@ public class Window extends Container implements Accessible { * @see GraphicsConfiguration#isTranslucencyCapable() */ @Override - @SuppressWarnings("deprecation") public void setBackground(Color bgColor) { Color oldBg = getBackground(); super.setBackground(bgColor); @@ -3874,7 +3867,7 @@ public class Window extends Container implements Accessible { } else if ((oldAlpha < 255) && (alpha == 255)) { setLayersOpaque(this, true); } - WindowPeer peer = (WindowPeer)getPeer(); + WindowPeer peer = (WindowPeer) this.peer; if (peer != null) { peer.setOpaque(alpha == 255); } @@ -3899,10 +3892,9 @@ public class Window extends Container implements Accessible { return bg != null ? bg.getAlpha() == 255 : true; } - @SuppressWarnings("deprecation") private void updateWindow() { synchronized (getTreeLock()) { - WindowPeer peer = (WindowPeer)getPeer(); + WindowPeer peer = (WindowPeer) this.peer; if (peer != null) { peer.updateWindow(); } @@ -4090,7 +4082,6 @@ public class Window extends Container implements Accessible { window.securityWarningHeight = height; } - @SuppressWarnings("deprecation") public void setSecurityWarningPosition(Window window, Point2D point, float alignmentX, float alignmentY) { @@ -4100,7 +4091,7 @@ public class Window extends Container implements Accessible { window.securityWarningAlignmentY = alignmentY; synchronized (window.getTreeLock()) { - WindowPeer peer = (WindowPeer)window.getPeer(); + WindowPeer peer = (WindowPeer) window.peer; if (peer != null) { peer.repositionSecurityWarning(); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java index 7a674cc19e1..719a65b7a93 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java +++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -49,6 +49,9 @@ import java.awt.peer.ComponentPeer; import java.awt.peer.LightweightPeer; import java.awt.dnd.peer.DropTargetPeer; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; + /** * The DropTarget is associated @@ -499,15 +502,15 @@ public class DropTarget implements DropTargetListener, Serializable { * */ - @SuppressWarnings("deprecation") public void addNotify(ComponentPeer peer) { if (peer == componentPeer) return; componentPeer = peer; + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); for (Component c = component; c != null && peer instanceof LightweightPeer; c = c.getParent()) { - peer = c.getPeer(); + peer = acc.getPeer(c); } if (peer instanceof DropTargetPeer) { diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java index db466edc527..09e6249e4eb 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java @@ -57,6 +57,7 @@ import javax.swing.plaf.*; import static javax.swing.ClientPropertyKey.*; import javax.accessibility.*; +import sun.awt.AWTAccessor; import sun.awt.SunToolkit; import sun.swing.SwingUtilities2; import sun.swing.UIClientPropertyKey; @@ -4218,9 +4219,10 @@ public abstract class JComponent extends Container implements Serializable, * @param c the {@code Component} to be checked * @return true if this component is lightweight */ - @SuppressWarnings("deprecation") public static boolean isLightweightComponent(Component c) { - return c.getPeer() instanceof LightweightPeer; + // TODO we cannot call c.isLightweight() because it is incorrectly + // overriden in DelegateContainer on osx. + return AWTAccessor.getComponentAccessor().isLightweight(c); } @@ -5033,7 +5035,6 @@ public abstract class JComponent extends Container implements Serializable, this.paintingChild = paintingChild; } - @SuppressWarnings("deprecation") void _paintImmediately(int x, int y, int w, int h) { Graphics g; Container c; @@ -5159,7 +5160,7 @@ public abstract class JComponent extends Container implements Serializable, } // If the clip width or height is negative, don't bother painting - if(c == null || c.getPeer() == null || + if(c == null || !c.isDisplayable() || paintImmediatelyClip.width <= 0 || paintImmediatelyClip.height <= 0) { recycleRectangle(paintImmediatelyClip); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java b/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java index 3b5d53080e6..856e172f6f7 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -37,6 +37,8 @@ import javax.accessibility.*; import java.io.Serializable; +import sun.awt.AWTAccessor; + /** * The "viewport" or "porthole" through which you see the underlying * information. When you scroll, what moves is the viewport. It is like @@ -380,7 +382,6 @@ public class JViewport extends JComponent implements Accessible * @param contentRect the Rectangle to display * @see JComponent#isValidateRoot * @see java.awt.Component#isValid - * @see java.awt.Component#getPeer */ public void scrollRectToVisible(Rectangle contentRect) { Component view = getView(); @@ -1448,7 +1449,6 @@ public class JViewport extends JComponent implements Accessible * Returns true if the component needs to be completely repainted after * a blit and a paint is received. */ - @SuppressWarnings("deprecation") private boolean needsRepaintAfterBlit() { // Find the first heavy weight ancestor. isObscured and // canDetermineObscurity are only appropriate for heavy weights. @@ -1459,7 +1459,8 @@ public class JViewport extends JComponent implements Accessible } if (heavyParent != null) { - ComponentPeer peer = heavyParent.getPeer(); + ComponentPeer peer = AWTAccessor.getComponentAccessor() + .getPeer(heavyParent); if (peer != null && peer.canDetermineObscurity() && !peer.isObscured()) { diff --git a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java index 14fabcbd57a..bc50cb734a6 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -401,7 +401,6 @@ public class RepaintManager * * @see JComponent#repaint */ - @SuppressWarnings("deprecation") private void addDirtyRegion0(Container c, int x, int y, int w, int h) { /* Special cases we don't have to bother with. */ @@ -432,7 +431,7 @@ public class RepaintManager // it could lead to the possibility of getting locks out // of order and deadlocking. for (Container p = c; p != null; p = p.getParent()) { - if (!p.isVisible() || (p.getPeer() == null)) { + if (!p.isVisible() || !p.isDisplayable()) { return; } if ((p instanceof Window) || (p instanceof Applet)) { diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java index ad460d4d00b..5b0c9612486 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -27,6 +27,8 @@ package javax.swing.plaf.basic; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.swing.DefaultLookup; import sun.swing.UIAction; import javax.swing.*; @@ -1191,7 +1193,6 @@ public class BasicSplitPaneUI extends SplitPaneUI * Should be messaged before the dragging session starts, resets * lastDragLocation and dividerSize. */ - @SuppressWarnings("deprecation") protected void startDragging() { Component leftC = splitPane.getLeftComponent(); Component rightC = splitPane.getRightComponent(); @@ -1199,10 +1200,11 @@ public class BasicSplitPaneUI extends SplitPaneUI beginDragDividerLocation = getDividerLocation(splitPane); draggingHW = false; - if(leftC != null && (cPeer = leftC.getPeer()) != null && + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + if(leftC != null && (cPeer = acc.getPeer(leftC)) != null && !(cPeer instanceof LightweightPeer)) { draggingHW = true; - } else if(rightC != null && (cPeer = rightC.getPeer()) != null + } else if(rightC != null && (cPeer = acc.getPeer(rightC)) != null && !(cPeer instanceof LightweightPeer)) { draggingHW = true; } diff --git a/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java b/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java index ddf88d39c79..d3b296f2e96 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, 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 @@ -29,8 +29,6 @@ import sun.misc.Unsafe; import javax.accessibility.AccessibleContext; import java.awt.*; -import java.awt.KeyboardFocusManager; -import java.awt.DefaultKeyboardFocusManager; import java.awt.event.InputEvent; import java.awt.event.InvocationEvent; import java.awt.event.KeyEvent; @@ -38,6 +36,7 @@ import java.awt.geom.Point2D; import java.awt.image.BufferStrategy; import java.awt.peer.ComponentPeer; +import java.awt.peer.MenuComponentPeer; import java.lang.reflect.InvocationTargetException; import java.security.AccessControlContext; @@ -171,7 +170,7 @@ public final class AWTAccessor { /** * Returns the peer of the component. */ - ComponentPeer getPeer(Component comp); + T getPeer(Component comp); /** * Sets the peer of the component to the specified peer. @@ -480,6 +479,11 @@ public final class AWTAccessor { */ void setAppContext(MenuComponent menuComp, AppContext appContext); + /** + * Returns the peer of the menu component. + */ + T getPeer(MenuComponent menuComp); + /** * Returns the menu container of the menu component. */ diff --git a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java index e214ca66607..8863845566a 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java @@ -27,14 +27,12 @@ package sun.awt; import java.awt.*; import java.awt.event.*; -import java.awt.image.*; import java.awt.peer.*; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import java.util.Set; import java.awt.AWTKeyStroke; import java.applet.Applet; -import sun.applet.AppletPanel; /** * A generic container used for embedding Java components, usually applets. @@ -320,10 +318,9 @@ public abstract class EmbeddedFrame extends Frame return true; } - @SuppressWarnings("deprecation") public void addNotify() { synchronized (getTreeLock()) { - if (getPeer() == null) { + if (!isDisplayable()) { setPeer(new NullEmbeddedFramePeer()); } super.addNotify(); @@ -331,10 +328,10 @@ public abstract class EmbeddedFrame extends Frame } // These three functions consitute RFE 4100710. Do not remove. - @SuppressWarnings("deprecation") public void setCursorAllowed(boolean isCursorAllowed) { this.isCursorAllowed = isCursorAllowed; - getPeer().updateCursorImmediately(); + final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this); + peer.updateCursorImmediately(); } public boolean isCursorAllowed() { return isCursorAllowed; @@ -345,7 +342,6 @@ public abstract class EmbeddedFrame extends Frame : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } - @SuppressWarnings("deprecation") protected void setPeer(final ComponentPeer p){ AWTAccessor.getComponentAccessor().setPeer(EmbeddedFrame.this, p); }; @@ -458,9 +454,8 @@ public abstract class EmbeddedFrame extends Frame * @see #getBoundsPrivate * @since 1.5 */ - @SuppressWarnings("deprecation") protected void setBoundsPrivate(int x, int y, int width, int height) { - final FramePeer peer = (FramePeer)getPeer(); + final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this); if (peer != null) { peer.setBoundsPrivate(x, y, width, height); } @@ -490,9 +485,8 @@ public abstract class EmbeddedFrame extends Frame * @see #setBoundsPrivate * @since 1.6 */ - @SuppressWarnings("deprecation") protected Rectangle getBoundsPrivate() { - final FramePeer peer = (FramePeer)getPeer(); + final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this); if (peer != null) { return peer.getBoundsPrivate(); } diff --git a/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java b/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java index 6a7f570c10c..d189c3819ee 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -25,7 +25,6 @@ package sun.awt; import java.awt.Component; -import java.awt.KeyboardFocusManager; import java.awt.Window; import java.awt.Canvas; import java.awt.Scrollbar; @@ -36,9 +35,7 @@ import java.awt.event.FocusEvent; import java.awt.peer.KeyboardFocusManagerPeer; import java.awt.peer.ComponentPeer; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - +import sun.awt.AWTAccessor.ComponentAccessor; import sun.util.logging.PlatformLogger; public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer { @@ -75,7 +72,6 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag * 1) accepts focus on click (in general) * 2) may be a focus owner (in particular) */ - @SuppressWarnings("deprecation") public static boolean shouldFocusOnClick(Component component) { boolean acceptFocusOnClick = false; @@ -84,6 +80,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag // CANVAS & SCROLLBAR accept focus on click + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); if (component instanceof Canvas || component instanceof Scrollbar) { @@ -96,11 +93,10 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag // Other components } else { - ComponentPeer peer = (component != null ? component.getPeer() : null); + ComponentPeer peer = (component != null ? acc.getPeer(component) : null); acceptFocusOnClick = (peer != null ? peer.isFocusable() : false); } - return acceptFocusOnClick && - AWTAccessor.getComponentAccessor().canBeFocusOwner(component); + return acceptFocusOnClick && acc.canBeFocusOwner(component); } /* @@ -120,7 +116,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag } Component currentOwner = currentFocusOwner; - if (currentOwner != null && currentOwner.getPeer() == null) { + if (currentOwner != null && !currentOwner.isDisplayable()) { currentOwner = null; } if (currentOwner != null) { diff --git a/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java b/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java index 2d3567d2016..1a203b83700 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -91,7 +91,7 @@ public abstract class LightweightFrame extends Frame { @SuppressWarnings("deprecation") @Override public void addNotify() { synchronized (getTreeLock()) { - if (getPeer() == null) { + if (!isDisplayable()) { SunToolkit stk = (SunToolkit)Toolkit.getDefaultToolkit(); try { setPeer(stk.createLightweightFrame(this)); @@ -115,9 +115,9 @@ public abstract class LightweightFrame extends Frame { * @param activate if true, activates the frame; * otherwise, deactivates the frame */ - @SuppressWarnings("deprecation") public void emulateActivation(boolean activate) { - ((FramePeer)getPeer()).emulateActivation(activate); + final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this); + peer.emulateActivation(activate); } /** diff --git a/jdk/src/java.desktop/share/classes/sun/awt/SunGraphicsCallback.java b/jdk/src/java.desktop/share/classes/sun/awt/SunGraphicsCallback.java index 794dbfa7a00..55dc22af869 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/SunGraphicsCallback.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/SunGraphicsCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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,11 +47,10 @@ public abstract class SunGraphicsCallback { g.clipRect(0, 0, bounds.width, bounds.height); } - @SuppressWarnings("deprecation") public final void runOneComponent(Component comp, Rectangle bounds, Graphics g, Shape clip, int weightFlags) { - if (comp == null || comp.getPeer() == null || !comp.isVisible()) { + if (comp == null || !comp.isDisplayable() || !comp.isVisible()) { return; } boolean lightweight = comp.isLightweight(); diff --git a/jdk/src/java.desktop/share/classes/sun/font/FontAccess.java b/jdk/src/java.desktop/share/classes/sun/font/FontAccess.java index 20717572282..c51077e0533 100644 --- a/jdk/src/java.desktop/share/classes/sun/font/FontAccess.java +++ b/jdk/src/java.desktop/share/classes/sun/font/FontAccess.java @@ -26,6 +26,7 @@ package sun.font; import java.awt.Font; +import java.awt.peer.FontPeer; public abstract class FontAccess { @@ -45,4 +46,5 @@ public abstract class FontAccess { public abstract void setFont2D(Font f, Font2DHandle h); public abstract void setCreatedFont(Font f); public abstract boolean isCreatedFont(Font f); + public abstract FontPeer getFontPeer(Font f); } diff --git a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java index 1a1e791d6a5..a386f5dc5e6 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java +++ b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java @@ -46,6 +46,7 @@ import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.awt.peer.FontPeer; import java.awt.print.Pageable; import java.awt.print.PageFormat; import java.awt.print.Paper; @@ -93,6 +94,7 @@ import sun.awt.FontConfiguration; import sun.awt.FontDescriptor; import sun.awt.PlatformFont; import sun.awt.SunToolkit; +import sun.font.FontAccess; import sun.font.FontManagerFactory; import sun.font.FontUtilities; @@ -1214,13 +1216,13 @@ public class PSPrinterJob extends RasterPrinterJob { * of distinct PS fonts needed to draw this text. This saves us * doing this processing one extra time. */ - @SuppressWarnings("deprecation") protected int platformFontCount(Font font, String str) { if (mFontProps == null) { return 0; } - CharsetString[] acs = - ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false); + PlatformFont peer = (PlatformFont) FontAccess.getFontAccess() + .getFontPeer(font); + CharsetString[] acs = peer.makeMultiCharsetString(str, false); if (acs == null) { /* AWT can't convert all chars so use 2D path */ return 0; @@ -1229,7 +1231,6 @@ public class PSPrinterJob extends RasterPrinterJob { return (psFonts == null) ? 0 : psFonts.length; } - @SuppressWarnings("deprecation") protected boolean textOut(Graphics g, String str, float x, float y, Font mLastFont, FontRenderContext frc, float width) { @@ -1254,9 +1255,9 @@ public class PSPrinterJob extends RasterPrinterJob { if (str.length() == 0) { return true; } - CharsetString[] acs = - ((PlatformFont) - (mLastFont.getPeer())).makeMultiCharsetString(str, false); + PlatformFont peer = (PlatformFont) FontAccess.getFontAccess() + .getFontPeer(mLastFont); + CharsetString[] acs = peer.makeMultiCharsetString(str, false); if (acs == null) { /* AWT can't convert all chars so use 2D path */ return false; diff --git a/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java b/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java index 3d66f4f7e5b..0a7066d4439 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -61,6 +61,7 @@ import javax.swing.RepaintManager; import javax.swing.RootPaneContainer; import javax.swing.SwingUtilities; +import sun.awt.AWTAccessor; import sun.awt.DisplayChangedListener; import sun.awt.LightweightFrame; import sun.security.action.GetPropertyAction; @@ -241,7 +242,6 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan } @Override - @SuppressWarnings("deprecation") public void notifyDisplayChanged(final int scaleFactor) { if (scaleFactor != this.scaleFactor) { if (!copyBufferEnabled) content.paintLock(); @@ -254,18 +254,19 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan } this.scaleFactor = scaleFactor; } - if (getPeer() instanceof DisplayChangedListener) { - ((DisplayChangedListener)getPeer()).displayChanged(); + final Object peer = AWTAccessor.getComponentAccessor().getPeer(this); + if (peer instanceof DisplayChangedListener) { + ((DisplayChangedListener) peer).displayChanged(); } repaint(); } @Override - @SuppressWarnings("deprecation") public void addNotify() { super.addNotify(); - if (getPeer() instanceof DisplayChangedListener) { - ((DisplayChangedListener)getPeer()).displayChanged(); + final Object peer = AWTAccessor.getComponentAccessor().getPeer(this); + if (peer instanceof DisplayChangedListener) { + ((DisplayChangedListener) peer).displayChanged(); } } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java index c3c89c1be87..04948a265b8 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -326,9 +326,8 @@ abstract public class XBaseMenuWindow extends XWindow { * check for adding duplicate items * @param item item to add */ - @SuppressWarnings("deprecation") public void addItem(MenuItem item) { - XMenuItemPeer mp = (XMenuItemPeer)item.getPeer(); + XMenuItemPeer mp = AWTAccessor.getMenuComponentAccessor().getPeer(item); if (mp != null) { mp.setContainer(this); synchronized(getMenuTreeLock()) { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java index 990865990be..b84054ea4ed 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -52,7 +52,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.PaintEvent; import java.awt.event.WindowEvent; -import java.awt.event.InvocationEvent; import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; import java.awt.image.VolatileImage; @@ -63,6 +62,8 @@ import java.security.*; import java.util.Collection; import java.util.Objects; import java.util.Set; + +import sun.awt.AWTAccessor.ComponentAccessor; import sun.util.logging.PlatformLogger; import sun.awt.*; import sun.awt.event.IgnorePaintEvent; @@ -182,7 +183,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } if (container instanceof Window) { - XWindowPeer wpeer = (XWindowPeer)(container.getPeer()); + XWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(container); if (wpeer != null) { return (wpeer.winAttr.visibilityState != XWindowAttributesData.AWT_UNOBSCURED); @@ -319,7 +321,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget if (parentWindow == null) { return rejectFocusRequestHelper("WARNING: Parent window is null"); } - XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer(); + XWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(parentWindow); if (wpeer == null) { return rejectFocusRequestHelper("WARNING: Parent window's peer is null"); } @@ -390,7 +393,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget /** * @see java.awt.peer.ComponentPeer */ - @SuppressWarnings("deprecation") public void setEnabled(final boolean value) { if (enableLog.isLoggable(PlatformLogger.Level.FINE)) { enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this); @@ -399,8 +401,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget // If any of our heavyweight ancestors are disable, we should be too // See 6176875 for more information final Container cp = SunToolkit.getNativeContainer(target); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); if (cp != null) { - status &= ((XComponentPeer) cp.getPeer()).isEnabled(); + status &= acc.getPeer(cp).isEnabled(); } synchronized (getStateLock()) { if (enabled == status) { @@ -412,7 +415,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget if (target instanceof Container) { final Component[] list = ((Container) target).getComponents(); for (final Component child : list) { - final ComponentPeer p = child.getPeer(); + final ComponentPeer p = acc.getPeer(child); if (p != null) { p.setEnabled(status && child.isEnabled()); } @@ -489,7 +492,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } XWindowPeer getParentTopLevel() { - AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); + ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target)); // Search for parent window while (parent != null && !(parent instanceof Window)) { @@ -1327,11 +1330,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } } - @SuppressWarnings("deprecation") private void addTree(Collection order, Set set, Container cont) { for (int i = 0; i < cont.getComponentCount(); i++) { Component comp = cont.getComponent(i); - ComponentPeer peer = comp.getPeer(); + Object peer = AWTAccessor.getComponentAccessor().getPeer(comp); if (peer instanceof XComponentPeer) { Long window = Long.valueOf(((XComponentPeer)peer).getWindow()); if (!set.contains(window)) { @@ -1348,7 +1350,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget /****** DropTargetPeer implementation ********************/ - @SuppressWarnings("deprecation") public void addDropTarget(DropTarget dt) { Component comp = target; while(!(comp == null || comp instanceof Window)) { @@ -1356,14 +1357,13 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } if (comp instanceof Window) { - XWindowPeer wpeer = (XWindowPeer)(comp.getPeer()); + XWindowPeer wpeer = AWTAccessor.getComponentAccessor().getPeer(comp); if (wpeer != null) { wpeer.addDropTarget(); } } } - @SuppressWarnings("deprecation") public void removeDropTarget(DropTarget dt) { Component comp = target; while(!(comp == null || comp instanceof Window)) { @@ -1371,7 +1371,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } if (comp instanceof Window) { - XWindowPeer wpeer = (XWindowPeer)(comp.getPeer()); + XWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(comp); if (wpeer != null) { wpeer.removeDropTarget(); } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java index f37cfbc22e9..966d30a8e81 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java @@ -1226,7 +1226,7 @@ abstract class XDecoratedPeer extends XWindowPeer { Window owner = XWindowPeer.getDecoratedOwner(actualFocusedWindow); if (owner != null && owner == target) { - setActualFocusedWindow((XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(actualFocusedWindow)); + setActualFocusedWindow(AWTAccessor.getComponentAccessor().getPeer(actualFocusedWindow)); } } super.handleWindowFocusOut(oppositeWindow, serial); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java index c2e451785f7..4866da3c718 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java @@ -117,7 +117,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer { try { javaToplevels = XWindowPeer.collectJavaToplevels(); for (Window w : toBlock) { - XWindowPeer wp = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); + XWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w); if (wp != null) { wp.setModalBlocked((Dialog)target, true, javaToplevels); } @@ -139,7 +139,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer { XWindowPeer focusedWindowPeer = null; if (focusedWindow != null) { - focusedWindowPeer = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(focusedWindow); + focusedWindowPeer = AWTAccessor.getComponentAccessor().getPeer(focusedWindow); } else { /* * For the case when a potential blocked window is not yet focused diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java index 75c2daf16d6..24d6322c328 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -110,7 +110,6 @@ public final class XDragSourceContextPeer return theInstance; } - @SuppressWarnings("deprecation") protected void startDrag(Transferable transferable, long[] formats, Map formatMap) { Component component = getTrigger().getComponent(); @@ -121,7 +120,7 @@ public final class XDragSourceContextPeer c = AWTAccessor.getComponentAccessor().getParent(c)); if (c instanceof Window) { - wpeer = (XWindowPeer)c.getPeer(); + wpeer = AWTAccessor.getComponentAccessor().getPeer(c); } if (wpeer == null) { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java index c9fb8474fa7..7a9826ba63b 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -32,6 +32,7 @@ import java.io.IOException; import java.util.Iterator; +import sun.awt.AWTAccessor; import sun.util.logging.PlatformLogger; import sun.awt.AppContext; @@ -188,12 +189,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer { // If source is an XEmbedCanvasPeer, passes the event to it for processing and // return true if the event is forwarded to the XEmbed child. // Otherwise, does nothing and return false. - @SuppressWarnings("deprecation") private boolean processSunDropTargetEvent(SunDropTargetEvent event) { Object source = event.getSource(); if (source instanceof Component) { - ComponentPeer peer = ((Component)source).getPeer(); + Object peer = AWTAccessor.getComponentAccessor() + .getPeer((Component) source); if (peer instanceof XEmbedCanvasPeer) { XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer; /* The native context is the pointer to the XClientMessageEvent diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java index b78a7aa4d77..6bb38b54f24 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -166,7 +166,6 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{ XToolkit.postEvent(XToolkit.targetToAppContext(proxy), event); } - @SuppressWarnings("deprecation") boolean simulateMotifRequestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time) { @@ -174,7 +173,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{ lightweightChild = (Component)proxy; } Component currentOwner = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner(); - if (currentOwner != null && currentOwner.getPeer() == null) { + if (currentOwner != null && !currentOwner.isDisplayable()) { currentOwner = null; } FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner ); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java index 9b9431893cb..33d573afc13 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java @@ -26,8 +26,11 @@ package sun.awt.X11; import java.awt.AWTKeyStroke; +import java.awt.Component; import java.awt.Toolkit; +import java.awt.peer.ComponentPeer; +import sun.awt.AWTAccessor; import sun.awt.EmbeddedFrame; import sun.util.logging.PlatformLogger; @@ -63,10 +66,9 @@ public class XEmbeddedFrame extends EmbeddedFrame { } } - @SuppressWarnings("deprecation") public void addNotify() { - if (getPeer() == null) { + if (!isDisplayable()) { XToolkit toolkit = (XToolkit)Toolkit.getDefaultToolkit(); setPeer(toolkit.createEmbeddedFrame(this)); } @@ -80,9 +82,9 @@ public class XEmbeddedFrame extends EmbeddedFrame { /* * The method shouldn't be called in case of active XEmbed. */ - @SuppressWarnings("deprecation") public boolean traverseIn(boolean direction) { - XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer(); + XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor() + .getPeer(this); if (peer != null) { if (peer.supportsXEmbed() && peer.isXEmbedActive()) { log.fine("The method shouldn't be called when XEmbed is active!"); @@ -93,9 +95,9 @@ public class XEmbeddedFrame extends EmbeddedFrame { return false; } - @SuppressWarnings("deprecation") protected boolean traverseOut(boolean direction) { - XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer(); + XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor() + .getPeer(this); if (direction == FORWARD) { xefp.traverseOutForward(); } @@ -108,9 +110,9 @@ public class XEmbeddedFrame extends EmbeddedFrame { /* * The method shouldn't be called in case of active XEmbed. */ - @SuppressWarnings("deprecation") public void synthesizeWindowActivation(boolean doActivate) { - XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer(); + XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor() + .getPeer(this); if (peer != null) { if (peer.supportsXEmbed() && peer.isXEmbedActive()) { log.fine("The method shouldn't be called when XEmbed is active!"); @@ -120,16 +122,17 @@ public class XEmbeddedFrame extends EmbeddedFrame { } } - @SuppressWarnings("deprecation") public void registerAccelerator(AWTKeyStroke stroke) { - XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer(); + XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor() + .getPeer(this); if (xefp != null) { xefp.registerAccelerator(stroke); } } - @SuppressWarnings("deprecation") + public void unregisterAccelerator(AWTKeyStroke stroke) { - XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer(); + XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor() + .getPeer(this); if (xefp != null) { xefp.unregisterAccelerator(stroke); } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java index d5ebcc8406e..39aa45fdc73 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -28,7 +28,6 @@ package sun.awt.X11; import java.awt.*; import java.util.HashMap; import java.awt.event.KeyEvent; -import java.lang.reflect.*; import sun.awt.AWTAccessor; public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher { @@ -46,13 +45,14 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche XToolkit.removeEventDispatcher(embedder.getWindow(), this); } - @SuppressWarnings("deprecation") void add(long child) { if (checkXEmbed(child)) { Component proxy = createChildProxy(child); ((Container)embedder.getTarget()).add("Center", proxy); - if (proxy.getPeer() != null) { - children.put(Long.valueOf(child), proxy.getPeer()); + XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor() + .getPeer(proxy); + if (peer != null) { + children.put(Long.valueOf(child), peer); } } } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java index 1a862c94729..f88132bf1e9 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -32,15 +32,19 @@ import java.awt.peer.*; import java.io.*; import java.util.Locale; import java.util.Arrays; -import com.sun.java.swing.plaf.motif.*; -import javax.swing.plaf.ComponentUI; import java.security.AccessController; import java.security.PrivilegedAction; + +import sun.awt.AWTAccessor.ComponentAccessor; import sun.util.logging.PlatformLogger; import sun.awt.AWTAccessor; -class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListener, ItemListener, KeyEventDispatcher, XChoicePeerListener { - private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer"); +class XFileDialogPeer extends XDialogPeer + implements FileDialogPeer, ActionListener, ItemListener, + KeyEventDispatcher, XChoicePeerListener { + + private static final PlatformLogger log = + PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer"); FileDialog target; @@ -286,7 +290,8 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe fileDialog.setSize(400, 400); // Update choice's popup width - XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); + XChoicePeer choicePeer = AWTAccessor.getComponentAccessor() + .getPeer(pathChoice); choicePeer.setDrawSelectedItem(false); choicePeer.setAlignUnder(pathField); @@ -642,7 +647,6 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe } } - @SuppressWarnings("deprecation") public boolean dispatchKeyEvent(KeyEvent keyEvent) { int id = keyEvent.getID(); int keyCode = keyEvent.getKeyCode(); @@ -653,13 +657,15 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe while (comp != null) { // Fix for 6240084 Disposing a file dialog when the drop-down is active does not dispose the dropdown menu, on Xtoolkit // See also 6259493 + ComponentAccessor acc = AWTAccessor.getComponentAccessor(); if (comp == pathChoice) { - XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); + XChoicePeer choicePeer = acc.getPeer(pathChoice); if (choicePeer.isUnfurled()){ return false; } } - if (comp.getPeer() == this) { + Object peer = acc.getPeer(comp); + if (peer == this) { handleCancel(); return true; } @@ -796,16 +802,18 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe } super.setVisible(b); + XChoicePeer choicePeer = AWTAccessor.getComponentAccessor() + .getPeer(pathChoice); if (b == true){ // See 6240074 for more information - XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); choicePeer.addXChoicePeerListener(this); - KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); + KeyboardFocusManager.getCurrentKeyboardFocusManager() + .addKeyEventDispatcher(this); }else{ // See 6240074 for more information - XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); choicePeer.removeXChoicePeerListener(); - KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this); + KeyboardFocusManager.getCurrentKeyboardFocusManager() + .removeKeyEventDispatcher(this); } selectionField.requestFocusInWindow(); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java index 1b09d3aed38..ea60094bb2d 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -124,7 +124,8 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { } } else { menubar = mb; - menubarPeer = (XMenuBarPeer) mb.getPeer(); + menubarPeer = AWTAccessor.getMenuComponentAccessor() + .getPeer(mb); if (menubarPeer != null) { menubarPeer.init((Frame)target); } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java index 0622c16e69c..cbc6ad46102 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -31,6 +31,8 @@ import java.awt.Container; import java.awt.Rectangle; import java.awt.im.spi.InputMethodContext; import java.awt.peer.ComponentPeer; + +import sun.awt.AWTAccessor; import sun.awt.X11InputMethod; import sun.util.logging.PlatformLogger; @@ -137,9 +139,10 @@ public class XInputMethod extends X11InputMethod { XToolkit.awtUnlock(); } - @SuppressWarnings("deprecation") long getCurrentParentWindow() { - return ((XWindow)clientComponentWindow.getPeer()).getContentWindow(); + XWindow peer = AWTAccessor.getComponentAccessor() + .getPeer(clientComponentWindow); + return peer.getContentWindow(); } /* diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java index 31548f90a81..dde0b87d64c 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java @@ -70,13 +70,13 @@ public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl { synchronized(this) { if (currentFocusedWindow != null) { - from = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow); + from = AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow); } currentFocusedWindow = win; if (currentFocusedWindow != null) { - to = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow); + to = AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow); } } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java index 22f0e70ab1b..cf6ba6e1025 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -163,9 +163,8 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { postPaintEvent(); } - @SuppressWarnings("deprecation") public void addHelpMenu(Menu m) { - XMenuPeer mp = (XMenuPeer)m.getPeer(); + XMenuPeer mp = AWTAccessor.getMenuComponentAccessor().getPeer(m); synchronized(getMenuTreeLock()) { helpMenu = mp; } @@ -180,10 +179,9 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { /** * called from XFramePeer.setMenuBar */ - @SuppressWarnings("deprecation") public void init(Frame frame) { this.target = frame; - this.framePeer = (XFramePeer)frame.getPeer(); + this.framePeer = AWTAccessor.getComponentAccessor().getPeer(frame); XCreateWindowParams params = getDelayedParams(); params.remove(DELAYED); params.add(PARENT_WINDOW, framePeer.getShell()); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseInfoPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseInfoPeer.java index 5e5c11ac88a..1ff294fd9fd 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseInfoPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseInfoPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -28,10 +28,11 @@ package sun.awt.X11; import java.awt.Point; import java.awt.Window; import java.awt.GraphicsEnvironment; -import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.peer.MouseInfoPeer; +import sun.awt.AWTAccessor; + public class XMouseInfoPeer implements MouseInfoPeer { /** @@ -83,8 +84,8 @@ public class XMouseInfoPeer implements MouseInfoPeer { // java.awt.Component.findUnderMouseInWindow checks that // the peer is non-null by checking that the component // is showing. - - long contentWindow = ((XWindow)w.getPeer()).getContentWindow(); + XWindow peer = AWTAccessor.getComponentAccessor().getPeer(w); + long contentWindow = peer.getContentWindow(); long parent = XlibUtil.getParentWindow(contentWindow); XToolkit.awtLock(); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java index 78a9fbf63d2..9ae9ab2e80a 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -27,6 +27,8 @@ package sun.awt.X11; import java.awt.*; import java.awt.peer.*; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.SunGraphicsCallback; public class XPanelPeer extends XCanvasPeer implements PanelPeer { @@ -76,17 +78,17 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer { } - @SuppressWarnings("deprecation") public void setBackground(Color c) { Component comp; int i; Container cont = (Container) target; + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); synchronized(target.getTreeLock()) { int n = cont.getComponentCount(); for(i=0; i < n; i++) { comp = cont.getComponent(i); - ComponentPeer peer = comp.getPeer(); + ComponentPeer peer = acc.getPeer(comp); if (peer != null) { Color color = comp.getBackground(); if (color == null || color.equals(c)) { @@ -102,15 +104,15 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer { setForegroundForHierarchy((Container) target, c); } - @SuppressWarnings("deprecation") private void setForegroundForHierarchy(Container cont, Color c) { synchronized(target.getTreeLock()) { + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); int n = cont.getComponentCount(); for(int i=0; i < n; i++) { Component comp = cont.getComponent(i); Color color = comp.getForeground(); if (color == null || color.equals(c)) { - ComponentPeer cpeer = comp.getPeer(); + ComponentPeer cpeer = acc.getPeer(comp); if (cpeer != null) { cpeer.setForeground(c); } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java index 6bd05470c75..97a997958ec 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -29,6 +29,7 @@ package sun.awt.X11; import java.awt.Component; import java.awt.Graphics; +import sun.awt.AWTAccessor; import sun.awt.RepaintArea; /** @@ -55,10 +56,10 @@ final class XRepaintArea extends RepaintArea { /** * Calls Component.paint(Graphics) with given Graphics. */ - @SuppressWarnings("deprecation") protected void paintComponent(Component comp, Graphics g) { if (comp != null) { - final XComponentPeer peer = (XComponentPeer) comp.getPeer(); + final XComponentPeer peer = AWTAccessor.getComponentAccessor() + .getPeer(comp); if (peer != null) { peer.paintPeer(g); } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java index 49d4ed93f0f..575d7c02387 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java @@ -1163,12 +1163,6 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { return (Window) xwin.target; } - @Override - @SuppressWarnings("deprecation") - public ComponentPeer getPeer() { - return (ComponentPeer) (xwin); - } - @Override public void updateUI() { ComponentUI ui = new XAWTScrollPaneUI(); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java index df9089ebe49..6841d1546a1 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java @@ -547,71 +547,63 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { implements ActionListener, DocumentListener { private boolean isFocused = false; - private final XComponentPeer peer; + private final XComponentPeer xwin; - XAWTTextField(String text, XComponentPeer peer, Container parent) { + XAWTTextField(String text, XComponentPeer xwin, Container parent) { super(text); - this.peer = peer; + this.xwin = xwin; setDoubleBuffered(true); setFocusable(false); AWTAccessor.getComponentAccessor().setParent(this,parent); - setBackground(peer.getPeerBackground()); - setForeground(peer.getPeerForeground()); - setFont(peer.getPeerFont()); + setBackground(xwin.getPeerBackground()); + setForeground(xwin.getPeerForeground()); + setFont(xwin.getPeerFont()); setCaretPosition(0); addActionListener(this); addNotify(); - } @Override @SuppressWarnings("deprecation") public void actionPerformed( ActionEvent actionEvent ) { - peer.postEvent(new ActionEvent(peer.target, - ActionEvent.ACTION_PERFORMED, - getText(), - actionEvent.getWhen(), - actionEvent.getModifiers())); + xwin.postEvent( + new ActionEvent(xwin.target, ActionEvent.ACTION_PERFORMED, + getText(), actionEvent.getWhen(), + actionEvent.getModifiers())); } @Override public void insertUpdate(DocumentEvent e) { - if (peer != null) { - peer.postEvent(new TextEvent(peer.target, + if (xwin != null) { + xwin.postEvent(new TextEvent(xwin.target, TextEvent.TEXT_VALUE_CHANGED)); } } @Override public void removeUpdate(DocumentEvent e) { - if (peer != null) { - peer.postEvent(new TextEvent(peer.target, + if (xwin != null) { + xwin.postEvent(new TextEvent(xwin.target, TextEvent.TEXT_VALUE_CHANGED)); } } @Override public void changedUpdate(DocumentEvent e) { - if (peer != null) { - peer.postEvent(new TextEvent(peer.target, + if (xwin != null) { + xwin.postEvent(new TextEvent(xwin.target, TextEvent.TEXT_VALUE_CHANGED)); } } - @Override - @SuppressWarnings("deprecation") - public ComponentPeer getPeer() { - return (ComponentPeer) peer; - } - public void repaintNow() { paintImmediately(getBounds()); } @Override public Graphics getGraphics() { - return peer.getGraphics(); + return xwin.getGraphics(); } @Override diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java index 3adbc8d35c5..ac00550afb2 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java @@ -605,7 +605,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { Component owner = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner(); if (owner != null) { - XWindow ownerWindow = (XWindow) AWTAccessor.getComponentAccessor().getPeer(owner); + XWindow ownerWindow = AWTAccessor.getComponentAccessor().getPeer(owner); if (ownerWindow != null) { w = ownerWindow.getContentWindow(); } @@ -2449,17 +2449,17 @@ public final class XToolkit extends UNIXToolkit implements Runnable { awtUnlock(); } } - @SuppressWarnings("deprecation") public void grab(Window w) { - if (w.getPeer() != null) { - ((XWindowPeer)w.getPeer()).setGrab(true); + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((XWindowPeer) peer).setGrab(true); } } - @SuppressWarnings("deprecation") public void ungrab(Window w) { - if (w.getPeer() != null) { - ((XWindowPeer)w.getPeer()).setGrab(false); + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((XWindowPeer) peer).setGrab(false); } } /** diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java index 9cc73f518dd..39940c48e2f 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -30,8 +30,6 @@ import java.awt.event.*; import java.awt.peer.TrayIconPeer; import sun.awt.*; import java.awt.image.*; -import java.text.BreakIterator; -import java.util.concurrent.ArrayBlockingQueue; import java.security.AccessController; import java.security.PrivilegedAction; import java.lang.reflect.InvocationTargetException; @@ -347,7 +345,6 @@ public class XTrayIconPeer implements TrayIconPeer, } // It's synchronized with disposal by EDT. - @SuppressWarnings("deprecation") public void showPopupMenu(int x, int y) { if (isDisposed()) return; @@ -366,7 +363,9 @@ public class XTrayIconPeer implements TrayIconPeer, } if (popup != null) { - Point loc = ((XBaseWindow)eframe.getPeer()).toLocal(new Point(x, y)); + final XBaseWindow peer = AWTAccessor.getComponentAccessor() + .getPeer(eframe); + Point loc = peer.toLocal(new Point(x, y)); popup.show(eframe, loc.x, loc.y); } } @@ -416,9 +415,9 @@ public class XTrayIconPeer implements TrayIconPeer, canvas.addMouseMotionListener(eventProxy); } - @SuppressWarnings("deprecation") long getWindow() { - return ((XEmbeddedFramePeer)eframe.getPeer()).getWindow(); + return AWTAccessor.getComponentAccessor() + .getPeer(eframe).getWindow(); } public boolean isDisposed() { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java index 27da4fee3f2..77d8096cf71 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -34,6 +34,7 @@ import java.lang.ref.WeakReference; import java.lang.reflect.Method; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.util.logging.PlatformLogger; import sun.awt.*; @@ -282,15 +283,15 @@ class XWindow extends XBaseWindow implements X11ComponentPeer { return reparented; } - @SuppressWarnings("deprecation") static long getParentWindowID(Component target) { - ComponentPeer peer = target.getParent().getPeer(); Component temp = target.getParent(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + ComponentPeer peer = acc.getPeer(temp); while (!(peer instanceof XWindow)) { temp = temp.getParent(); - peer = temp.getPeer(); + peer = acc.getPeer(temp); } if (peer != null && peer instanceof XWindow) @@ -299,17 +300,17 @@ class XWindow extends XBaseWindow implements X11ComponentPeer { } - @SuppressWarnings("deprecation") static XWindow getParentXWindowObject(Component target) { if (target == null) return null; Component temp = target.getParent(); if (temp == null) return null; - ComponentPeer peer = temp.getPeer(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + ComponentPeer peer = acc.getPeer(temp); if (peer == null) return null; while ((peer != null) && !(peer instanceof XWindow)) { temp = temp.getParent(); - peer = temp.getPeer(); + peer = acc.getPeer(temp); } if (peer != null && peer instanceof XWindow) return (XWindow) peer; @@ -552,7 +553,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer { int h = xe.get_height(); Component target = getEventSource(); - AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); + ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); if (!compAccessor.getIgnoreRepaint(target) && compAccessor.getWidth(target) != 0 diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java index ad6587e9fb5..585185308df 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java @@ -46,6 +46,7 @@ import java.util.Vector; import java.util.concurrent.atomic.AtomicBoolean; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.util.logging.PlatformLogger; import sun.awt.AWTAccessor; @@ -225,7 +226,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, Window t_window = (Window)target; Window owner = t_window.getOwner(); if (owner != null) { - ownerPeer = (XWindowPeer)owner.getPeer(); + ownerPeer = AWTAccessor.getComponentAccessor().getPeer(owner); if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("Owner is " + owner); focusLog.finer("Owner peer is " + ownerPeer); @@ -401,15 +402,15 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } } - @SuppressWarnings("deprecation") public void recursivelySetIcon(java.util.List icons) { dumpIcons(winAttr.icons); setIconHints(icons); Window target = (Window)this.target; Window[] children = target.getOwnedWindows(); int cnt = children.length; + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); for (int i = 0; i < cnt; i++) { - ComponentPeer childPeer = children[i].getPeer(); + final ComponentPeer childPeer = acc.getPeer(children[i]); if (childPeer != null && childPeer instanceof XWindowPeer) { if (((XWindowPeer)childPeer).winAttr.iconsInherited) { ((XWindowPeer)childPeer).winAttr.icons = icons; @@ -1161,7 +1162,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, if (warningWindow != null) { // We can't use the coordinates stored in the XBaseWindow since // they are zeros for decorated frames. - AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); + ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); int x = compAccessor.getX(target); int y = compAccessor.getY(target); int width = compAccessor.getWidth(target); @@ -1486,7 +1487,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, XToolkit.awtLock(); try { if (isReparented() && delayedModalBlocking) { - addToTransientFors((XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(modalBlocker)); + addToTransientFors(AWTAccessor.getComponentAccessor().getPeer(modalBlocker)); delayedModalBlocking = false; } } finally { @@ -1570,7 +1571,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, try { // State lock should always be after awtLock synchronized(getStateLock()) { - XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d); + XDialogPeer blockerPeer = AWTAccessor.getComponentAccessor().getPeer(d); if (blocked) { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("{0} is blocked by {1}", this, blockerPeer); @@ -1852,7 +1853,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // current chain iterator in the order from next to prev XWindowPeer chainToSplit = prevTransientFor; while (chainToSplit != null) { - XWindowPeer blocker = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker); + XWindowPeer blocker = AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker); if (thisChainBlockers.contains(blocker)) { // add to this dialog's chain setToplevelTransientFor(thisChain, chainToSplit, true, false); @@ -1913,7 +1914,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } focusLog.fine("Parent window is not active"); - XDecoratedPeer wpeer = (XDecoratedPeer)AWTAccessor.getComponentAccessor().getPeer(ownerWindow); + XDecoratedPeer wpeer = AWTAccessor.getComponentAccessor().getPeer(ownerWindow); if (wpeer != null && wpeer.requestWindowFocus(this, time, timeProvided)) { focusLog.fine("Parent window accepted focus request - generating focus for this window"); return true; @@ -2259,7 +2260,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, while (w != null && toplevel != this && !(toplevel instanceof XDialogPeer)) { w = (Window) AWTAccessor.getComponentAccessor().getParent(w); if (w != null) { - toplevel = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(w); + toplevel = AWTAccessor.getComponentAccessor().getPeer(w); } } if (w == null || (w != this.target && w instanceof Dialog)) { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java index 93511617183..b2e9b1119aa 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -326,18 +326,16 @@ public class X11GraphicsDevice return (isFullScreenSupported() && (getFullScreenWindow() != null)); } - @SuppressWarnings("deprecation") private static void enterFullScreenExclusive(Window w) { - X11ComponentPeer peer = (X11ComponentPeer)w.getPeer(); + X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); if (peer != null) { enterFullScreenExclusive(peer.getContentWindow()); peer.setFullScreenExclusiveModeState(true); } } - @SuppressWarnings("deprecation") private static void exitFullScreenExclusive(Window w) { - X11ComponentPeer peer = (X11ComponentPeer)w.getPeer(); + X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); if (peer != null) { peer.setFullScreenExclusiveModeState(false); exitFullScreenExclusive(peer.getContentWindow()); diff --git a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java index 63d80285f03..2a366f1db26 100644 --- a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java +++ b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -31,6 +31,9 @@ import java.awt.Component; import java.awt.GraphicsConfiguration; import java.awt.Transparency; import java.awt.image.ColorModel; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.X11ComponentPeer; import sun.awt.image.SunVolatileImage; import sun.awt.image.VolatileSurfaceManager; @@ -73,12 +76,11 @@ public class GLXVolatileSurfaceManager extends VolatileSurfaceManager { * Create a pbuffer-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig) */ - @SuppressWarnings("deprecation") protected SurfaceData initAcceleratedSurface() { SurfaceData sData; Component comp = vImg.getComponent(); - X11ComponentPeer peer = - (comp != null) ? (X11ComponentPeer)comp.getPeer() : null; + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + X11ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null; try { boolean createVSynced = false; diff --git a/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c b/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c index b68e0ede641..d1c6cee5e59 100644 --- a/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c +++ b/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c @@ -84,12 +84,10 @@ Java_java_awt_Font_initIDs (JNIEnv *env, jclass cls) { #ifndef HEADLESS - /** We call "NoClientCode" methods because they won't invoke client - code on the privileged toolkit thread **/ CHECK_NULL(fontIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J")); CHECK_NULL(fontIDs.style = (*env)->GetFieldID(env, cls, "style", "I")); CHECK_NULL(fontIDs.size = (*env)->GetFieldID(env, cls, "size", "I")); - CHECK_NULL(fontIDs.getPeer = (*env)->GetMethodID(env, cls, "getPeer_NoClientCode", + CHECK_NULL(fontIDs.getPeer = (*env)->GetMethodID(env, cls, "getFontPeer", "()Ljava/awt/peer/FontPeer;")); CHECK_NULL(fontIDs.getFamily = (*env)->GetMethodID(env, cls, "getFamily_NoClientCode", "()Ljava/lang/String;")); diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java b/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java index 4cca665f75a..7235e4c0e24 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -329,7 +329,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements } @Override - @SuppressWarnings("deprecation") public synchronized void setFullScreenWindow(Window w) { Window old = getFullScreenWindow(); if (w == old) { @@ -353,7 +352,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements // entering the fullscreen mode. defaultDisplayMode = null; } - WWindowPeer peer = (WWindowPeer)old.getPeer(); + WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(old); if (peer != null) { peer.setFullScreenExclusiveModeState(false); // we used to destroy the buffers on exiting fs mode, this @@ -372,7 +371,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements defaultDisplayMode = getDisplayMode(); addFSWindowListener(w); // Enter full screen exclusive mode. - WWindowPeer peer = (WWindowPeer)w.getPeer(); + WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); if (peer != null) { synchronized(peer) { enterFullScreenExclusive(screen, peer); @@ -405,7 +404,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements } @Override - @SuppressWarnings("deprecation") public synchronized void setDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { super.setDisplayMode(dm); @@ -419,7 +417,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements } Window w = getFullScreenWindow(); if (w != null) { - WWindowPeer peer = (WWindowPeer)w.getPeer(); + WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(), dm.getBitDepth(), dm.getRefreshRate()); // resize the fullscreen window to the dimensions of the new diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WChoicePeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WChoicePeer.java index adfff709ebb..c49f6dcfc4c 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WChoicePeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WChoicePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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 @@ -30,6 +30,8 @@ import java.awt.event.ItemEvent; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.awt.event.WindowAdapter; + +import sun.awt.AWTAccessor; import sun.awt.SunToolkit; final class WChoicePeer extends WComponentPeer implements ChoicePeer { @@ -94,7 +96,6 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer { native void create(WComponentPeer parent); @Override - @SuppressWarnings("deprecation") void initialize() { Choice opt = (Choice)target; int itemCount = opt.getItemCount(); @@ -111,7 +112,8 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer { Window parentWindow = SunToolkit.getContainingWindow((Component)target); if (parentWindow != null) { - WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer(); + final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(parentWindow); if (wpeer != null) { windowListener = new WindowAdapter() { @Override @@ -130,13 +132,13 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer { } @Override - @SuppressWarnings("deprecation") protected void disposeImpl() { // TODO: we should somehow reset the listener when the choice // is moved to another toplevel without destroying its peer. Window parentWindow = SunToolkit.getContainingWindow((Component)target); if (parentWindow != null) { - WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer(); + final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(parentWindow); if (wpeer != null) { wpeer.removeWindowListener(windowListener); } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java index 1008004aa52..3aa2387495c 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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 @@ -569,7 +569,6 @@ public abstract class WComponentPeer extends WObjectPeer final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); @Override - @SuppressWarnings("deprecation") public Graphics getGraphics() { if (isDisposed()) { return null; @@ -578,8 +577,9 @@ public abstract class WComponentPeer extends WObjectPeer Component target = (Component)getTarget(); Window window = SunToolkit.getContainingWindow(target); if (window != null) { - Graphics g = - ((WWindowPeer)window.getPeer()).getTranslucentGraphics(); + final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(window); + Graphics g = wpeer.getTranslucentGraphics(); // getTranslucentGraphics() returns non-null value for non-opaque windows only if (g != null) { // Non-opaque windows do not support heavyweight children. @@ -685,7 +685,6 @@ public abstract class WComponentPeer extends WObjectPeer // TODO: consider moving it to KeyboardFocusManagerPeerImpl @Override - @SuppressWarnings("deprecation") public boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) @@ -713,7 +712,8 @@ public abstract class WComponentPeer extends WObjectPeer if (parentWindow == null) { return rejectFocusRequestHelper("WARNING: Parent window is null"); } - WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer(); + final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(parentWindow); if (wpeer == null) { return rejectFocusRequestHelper("WARNING: Parent window's peer is null"); } @@ -1104,7 +1104,6 @@ public abstract class WComponentPeer extends WObjectPeer // in the browser on Vista when DWM is enabled. // @return true if the toplevel container is not an EmbeddedFrame or // if this EmbeddedFrame is acceleration capable, false otherwise - @SuppressWarnings("deprecation") private static final boolean isContainingTopLevelAccelCapable(Component c) { while (c != null && !(c instanceof WEmbeddedFrame)) { c = c.getParent(); @@ -1112,7 +1111,9 @@ public abstract class WComponentPeer extends WObjectPeer if (c == null) { return true; } - return ((WEmbeddedFramePeer)c.getPeer()).isAccelCapable(); + final WEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor() + .getPeer(c); + return peer.isAccelCapable(); } /** @@ -1120,7 +1121,6 @@ public abstract class WComponentPeer extends WObjectPeer * @since 1.7 */ @Override - @SuppressWarnings("deprecation") public void applyShape(Region shape) { if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) { shapeLog.finer("*** INFO: Setting shape: PEER: " + this diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WDialogPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WDialogPeer.java index 390ec6e524b..fea3588ffec 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WDialogPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WDialogPeer.java @@ -103,7 +103,7 @@ final class WDialogPeer extends WWindowPeer implements DialogPeer { @Override public void blockWindows(java.util.List toBlock) { for (Window w : toBlock) { - WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); + WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w); if (wp != null) { wp.setModalBlocked((Dialog)target, true); } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java index c3017232054..05769303cc9 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java @@ -30,8 +30,11 @@ import java.awt.*; import java.awt.event.InvocationEvent; import java.awt.peer.ComponentPeer; import java.awt.image.*; + import sun.awt.image.ByteInterleavedRaster; import sun.security.action.GetPropertyAction; + +import java.awt.peer.FramePeer; import java.security.PrivilegedAction; import java.security.AccessController; @@ -80,9 +83,8 @@ public class WEmbeddedFrame extends EmbeddedFrame { } } - @SuppressWarnings("deprecation") public void addNotify() { - if (getPeer() == null) { + if (!isDisplayable()) { WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit(); setPeer(toolkit.createEmbeddedFrame(this)); } @@ -232,16 +234,16 @@ public class WEmbeddedFrame extends EmbeddedFrame { public void activateEmbeddingTopLevel() { } - @SuppressWarnings("deprecation") public void synthesizeWindowActivation(final boolean activate) { + final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this); if (!activate || EventQueue.isDispatchThread()) { - ((WFramePeer)getPeer()).emulateActivation(activate); + peer.emulateActivation(activate); } else { // To avoid focus concurrence b/w IE and EmbeddedFrame // activation is postponed by means of posting it to EDT. Runnable r = new Runnable() { public void run() { - ((WFramePeer)getPeer()).emulateActivation(true); + peer.emulateActivation(true); } }; WToolkit.postEvent(WToolkit.targetToAppContext(this), @@ -249,10 +251,11 @@ public class WEmbeddedFrame extends EmbeddedFrame { } } - @SuppressWarnings("deprecation") public boolean requestFocusToEmbedder() { if (isEmbeddedInIE) { - return ((WEmbeddedFramePeer) getPeer()).requestFocusToEmbedder(); + final WEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor() + .getPeer(this); + return peer.requestFocusToEmbedder(); } return false; } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java index 81a28c6b7d3..4050668c65a 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java @@ -237,7 +237,7 @@ final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { @Override public void blockWindows(java.util.List toBlock) { for (Window w : toBlock) { - WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); + WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w); if (wp != null) { blockWindow(wp); } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java index 24ad835ab99..aaf2df9c5d0 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -40,6 +40,9 @@ import java.util.Collections; import java.util.HashMap; import java.util.Locale; import java.util.Map; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.im.InputMethodAdapter; final class WInputMethod extends InputMethodAdapter @@ -606,18 +609,17 @@ final class WInputMethod extends InputMethodAdapter // java.awt.Toolkit#getNativeContainer() is not available // from this package - @SuppressWarnings("deprecation") private WComponentPeer getNearestNativePeer(Component comp) { if (comp==null) return null; - - ComponentPeer peer = comp.getPeer(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + ComponentPeer peer = acc.getPeer(comp); if (peer==null) return null; while (peer instanceof java.awt.peer.LightweightPeer) { comp = comp.getParent(); if (comp==null) return null; - peer = comp.getPeer(); + peer = acc.getPeer(comp); if (peer==null) return null; } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java index 6a204ab1adb..a475328881a 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -28,6 +28,9 @@ package sun.awt.windows; import java.awt.Window; import java.awt.Component; import java.awt.peer.ComponentPeer; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.KeyboardFocusManagerPeerImpl; import sun.awt.CausedFocusEvent; @@ -46,9 +49,9 @@ final class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl { } @Override - @SuppressWarnings("deprecation") public void setCurrentFocusOwner(Component comp) { - setNativeFocusOwner(comp != null ? comp.getPeer() : null); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + setNativeFocusOwner(comp != null ? acc.getPeer(comp) : null); } @Override diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialog.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialog.java index 877e722e1ae..17e361290e5 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialog.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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,15 +57,13 @@ final class WPageDialog extends WPrintDialog { } @Override - @SuppressWarnings("deprecation") public void addNotify() { synchronized(getTreeLock()) { Container parent = getParent(); - if (parent != null && parent.getPeer() == null) { + if (parent != null && !parent.isDisplayable()) { parent.addNotify(); } - - if (getPeer() == null) { + if (!isDisplayable()) { ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()). createWPageDialog(this); setPeer(peer); diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialog.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialog.java index 9f518311876..42051def152 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialog.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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 @@ -58,15 +58,14 @@ class WPrintDialog extends Dialog { } @Override - @SuppressWarnings("deprecation") public void addNotify() { synchronized(getTreeLock()) { Container parent = getParent(); - if (parent != null && parent.getPeer() == null) { + if (parent != null && !parent.isDisplayable()) { parent.addNotify(); } - if (getPeer() == null) { + if (!isDisplayable()) { ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()). createWPrintDialog(this); setPeer(peer); diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java index 2f728f18899..de4abab4fa3 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java @@ -112,7 +112,7 @@ class WPrintDialogPeer extends WWindowPeer implements DialogPeer { @Override public void blockWindows(java.util.List toBlock) { for (Window w : toBlock) { - WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); + WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w); if (wp != null) { blockWindow(wp); } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java index 8bf7aa1831c..57e3e8bab0f 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -30,13 +30,11 @@ import java.awt.Font; import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; -import java.awt.KeyboardFocusManager; import java.awt.Toolkit; import java.awt.BasicStroke; import java.awt.Button; import java.awt.Component; import java.awt.Dimension; -import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.FileDialog; @@ -62,6 +60,8 @@ import java.io.File; import java.util.MissingResourceException; import java.util.ResourceBundle; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.print.PeekGraphics; import sun.print.PeekMetrics; @@ -2117,7 +2117,6 @@ public final class WPrinterJob extends RasterPrinterJob short xres_quality, short yres); - @SuppressWarnings("deprecation") public PrintRequestAttributeSet showDocumentProperties(Window owner, PrintService service, @@ -2127,7 +2126,8 @@ public final class WPrinterJob extends RasterPrinterJob setNativePrintServiceIfNeeded(service.getName()); } catch (PrinterException e) { } - long hWnd = ((WWindowPeer)(owner.getPeer())).getHWnd(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + long hWnd = acc.getPeer(owner).getHWnd(); DevModeValues info = new DevModeValues(); getDevModeValues(aset, info); boolean ok = diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java index c96007471ad..4b083475db9 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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 @@ -29,6 +29,7 @@ import java.awt.event.AdjustmentEvent; import java.awt.peer.ScrollPanePeer; import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.PeerEvent; import sun.util.logging.PlatformLogger; @@ -199,7 +200,6 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { } @Override - @SuppressWarnings("deprecation") public void run() { if (getScrollChild() == null) { return; @@ -267,8 +267,9 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { // Paint the exposed area right away. To do this - find // the heavyweight ancestor of the scroll child. Component hwAncestor = getScrollChild(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); while (hwAncestor != null - && !(hwAncestor.getPeer() instanceof WComponentPeer)) + && !(acc.getPeer(hwAncestor) instanceof WComponentPeer)) { hwAncestor = hwAncestor.getParent(); } @@ -278,7 +279,7 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { "couldn't find heavyweight ancestor of scroll pane child"); } } - WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer(); + WComponentPeer hwPeer = acc.getPeer(hwAncestor); hwPeer.paintDamagedAreaImmediately(); } } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java index 50207fd0f52..bcdfe2f6c95 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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 @@ -36,6 +36,8 @@ import java.awt.TrayIcon; import java.beans.PropertyChangeListener; import java.security.AccessController; import java.security.PrivilegedAction; + +import sun.awt.AWTAccessor; import sun.awt.AppContext; import sun.awt.AWTAutoShutdown; import sun.awt.AWTPermissions; @@ -438,9 +440,8 @@ public final class WToolkit extends SunToolkit implements Runnable { } @Override - @SuppressWarnings("deprecation") public void disableBackgroundErase(Canvas canvas) { - WCanvasPeer peer = (WCanvasPeer)canvas.getPeer(); + WCanvasPeer peer = AWTAccessor.getComponentAccessor().getPeer(canvas); if (peer == null) { throw new IllegalStateException("Canvas must have a valid peer"); } @@ -1100,18 +1101,18 @@ public final class WToolkit extends SunToolkit implements Runnable { } @Override - @SuppressWarnings("deprecation") public void grab(Window w) { - if (w.getPeer() != null) { - ((WWindowPeer)w.getPeer()).grab(); + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((WWindowPeer) peer).grab(); } } @Override - @SuppressWarnings("deprecation") public void ungrab(Window w) { - if (w.getPeer() != null) { - ((WWindowPeer)w.getPeer()).ungrab(); + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((WWindowPeer) peer).ungrab(); } } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java index 769803e6c34..e88411d6537 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -34,6 +34,8 @@ import java.awt.TrayIcon; import java.awt.Image; import java.awt.peer.TrayIconPeer; import java.awt.image.*; + +import sun.awt.AWTAccessor; import sun.awt.SunToolkit; import sun.awt.image.IntegerComponentRaster; @@ -80,25 +82,23 @@ final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer { if (isDisposed()) return; - SunToolkit.executeOnEventHandlerThread(target, new Runnable() { - @Override - @SuppressWarnings("deprecation") - public void run() { - PopupMenu newPopup = ((TrayIcon)target).getPopupMenu(); - if (popup != newPopup) { - if (popup != null) { - popupParent.remove(popup); - } - if (newPopup != null) { - popupParent.add(newPopup); - } - popup = newPopup; - } - if (popup != null) { - ((WPopupMenuPeer)popup.getPeer()).show(popupParent, new Point(x, y)); - } + SunToolkit.executeOnEventHandlerThread(target, () -> { + PopupMenu newPopup = ((TrayIcon)target).getPopupMenu(); + if (popup != newPopup) { + if (popup != null) { + popupParent.remove(popup); } - }); + if (newPopup != null) { + popupParent.add(newPopup); + } + popup = newPopup; + } + if (popup != null) { + WPopupMenuPeer peer = AWTAccessor.getMenuComponentAccessor() + .getPeer(popup); + peer.show(popupParent, new Point(x, y)); + } + }); } @Override diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java index 51bf8379408..1a8c8de70bb 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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,12 +409,12 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, } @Override - @SuppressWarnings("deprecation") public void setModalBlocked(Dialog dialog, boolean blocked) { synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock { // use WWindowPeer instead of WDialogPeer because of FileDialogs and PrintDialogs - WWindowPeer blockerPeer = (WWindowPeer)dialog.getPeer(); + WWindowPeer blockerPeer = AWTAccessor.getComponentAccessor() + .getPeer(dialog); if (blocked) { modalBlocker = blockerPeer; @@ -609,14 +609,13 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, super.print(g); } - @SuppressWarnings("deprecation") private void replaceSurfaceDataRecursively(Component c) { if (c instanceof Container) { for (Component child : ((Container)c).getComponents()) { replaceSurfaceDataRecursively(child); } } - ComponentPeer cp = c.getPeer(); + final Object cp = AWTAccessor.getComponentAccessor().getPeer(c); if (cp instanceof WComponentPeer) { ((WComponentPeer)cp).replaceSurfaceDataLater(); } @@ -818,7 +817,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, * updates the list of active windows per AppContext, so the latest active * window is always at the end of the list. The list is stored in AppContext. */ - @SuppressWarnings( value = {"deprecation", "unchecked"}) + @SuppressWarnings("unchecked") private static class ActiveWindowListener implements PropertyChangeListener { @Override public void propertyChange(PropertyChangeEvent e) { @@ -828,7 +827,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, } AppContext appContext = SunToolkit.targetToAppContext(w); synchronized (appContext) { - WWindowPeer wp = (WWindowPeer)w.getPeer(); + WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w); // add/move wp to the end of the list List l = (List)appContext.get(ACTIVE_WINDOWS_KEY); if (l != null) { diff --git a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java index f6d8fe3640f..794746c12a9 100644 --- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java +++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -37,6 +37,9 @@ import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.awt.peer.WindowPeer; import java.util.ArrayList; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.Win32GraphicsDevice; import sun.awt.windows.WWindowPeer; import sun.java2d.pipe.hw.ContextCapabilities; @@ -176,11 +179,10 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice { long hwnd); @Override - @SuppressWarnings("deprecation") protected void enterFullScreenExclusive(final int screen, WindowPeer wp) { - final WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer(); - + final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(realFSWindow); D3DRenderQueue rq = D3DRenderQueue.getInstance(); rq.lock(); try { @@ -247,16 +249,15 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice { } @Override - @SuppressWarnings("deprecation") protected void addFSWindowListener(Window w) { // if the window is not a toplevel (has an owner) we have to use the // real toplevel to enter the full-screen mode with (4933099). + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); if (!(w instanceof Frame) && !(w instanceof Dialog) && (realFSWindow = getToplevelOwner(w)) != null) { ownerOrigBounds = realFSWindow.getBounds(); - WWindowPeer fp = (WWindowPeer)realFSWindow.getPeer(); - + WWindowPeer fp = acc.getPeer(realFSWindow); ownerWasVisible = realFSWindow.isVisible(); Rectangle r = w.getBounds(); // we use operations on peer instead of component because calling @@ -268,14 +269,13 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice { } fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop(); - ((WWindowPeer)realFSWindow.getPeer()).setAlwaysOnTop(true); + ((WWindowPeer) acc.getPeer(realFSWindow)).setAlwaysOnTop(true); fsWindowListener = new D3DFSWindowAdapter(); realFSWindow.addWindowListener(fsWindowListener); } @Override - @SuppressWarnings("deprecation") protected void removeFSWindowListener(Window w) { realFSWindow.removeWindowListener(fsWindowListener); fsWindowListener = null; @@ -290,7 +290,8 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice { * its original size (just like the Window is being resized * to its original size in GraphicsDevice). */ - WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer(); + final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(realFSWindow); if (wpeer != null) { if (ownerOrigBounds != null) { // if the window went into fs mode before it was realized it @@ -340,7 +341,6 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice { int bitDepth, int refreshRate); @Override - @SuppressWarnings("deprecation") protected void configDisplayMode(final int screen, final WindowPeer w, final int width, final int height, final int bitDepth, final int refreshRate) @@ -351,8 +351,8 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice { refreshRate); return; } - - final WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer(); + final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() + .getPeer(realFSWindow); // REMIND: we do this before we switch the display mode, so // the dimensions may be exceeding the dimensions of the screen, diff --git a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java index fd4bd592402..54bf7dc2485 100644 --- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java +++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -38,6 +38,7 @@ import java.util.ArrayList; import java.util.HashMap; import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.util.ThreadGroupUtils; import sun.awt.Win32GraphicsConfig; import sun.awt.windows.WComponentPeer; @@ -531,11 +532,11 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager * @param comp component to check for hw children * @return true if Component has heavyweight children */ - @SuppressWarnings("deprecation") private static boolean hasHWChildren(Component comp) { + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); if (comp instanceof Container) { for (Component c : ((Container)comp).getComponents()) { - if (c.getPeer() instanceof WComponentPeer || hasHWChildren(c)) { + if (acc.getPeer(c) instanceof WComponentPeer || hasHWChildren(c)) { return true; } } diff --git a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java index 36f44896c27..c152c44363a 100644 --- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java +++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -30,6 +30,9 @@ import java.awt.GraphicsConfiguration; import java.awt.Image; import java.awt.Transparency; import java.awt.image.ColorModel; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.Win32GraphicsConfig; import sun.awt.image.SunVolatileImage; import sun.awt.image.SurfaceManager; @@ -79,12 +82,11 @@ public class D3DVolatileSurfaceManager * Create a pbuffer-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig). */ - @SuppressWarnings("deprecation") protected SurfaceData initAcceleratedSurface() { SurfaceData sData; Component comp = vImg.getComponent(); - WComponentPeer peer = - (comp != null) ? (WComponentPeer)comp.getPeer() : null; + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + WComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null; try { boolean forceback = false; diff --git a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java index 6a1fc463f72..53f5b04783a 100644 --- a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java +++ b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -31,6 +31,9 @@ import java.awt.Component; import java.awt.GraphicsConfiguration; import java.awt.Transparency; import java.awt.image.ColorModel; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import sun.awt.image.SunVolatileImage; import sun.awt.image.VolatileSurfaceManager; import sun.awt.windows.WComponentPeer; @@ -73,12 +76,11 @@ public class WGLVolatileSurfaceManager * Create a pbuffer-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig). */ - @SuppressWarnings("deprecation") protected SurfaceData initAcceleratedSurface() { SurfaceData sData; Component comp = vImg.getComponent(); - WComponentPeer peer = - (comp != null) ? (WComponentPeer)comp.getPeer() : null; + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + WComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null; try { boolean createVSynced = false; diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp index 572ab9ad5a1..163283f0ef7 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp @@ -985,7 +985,7 @@ extern "C" { JNIEXPORT void JNICALL Java_java_awt_Font_initIDs(JNIEnv *env, jclass cls) { - CHECK_NULL(AwtFont::peerMID = env->GetMethodID(cls, "getPeer", + CHECK_NULL(AwtFont::peerMID = env->GetMethodID(cls, "getFontPeer", "()Ljava/awt/peer/FontPeer;")); CHECK_NULL(AwtFont::pDataID = env->GetFieldID(cls, "pData", "J")); CHECK_NULL(AwtFont::nameID = diff --git a/jdk/test/java/awt/Component/Headless/HeadlessComponent.java b/jdk/test/java/awt/Component/Headless/HeadlessComponent.java index fb25da2b35e..cfd7544e165 100644 --- a/jdk/test/java/awt/Component/Headless/HeadlessComponent.java +++ b/jdk/test/java/awt/Component/Headless/HeadlessComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -52,7 +52,6 @@ public class HeadlessComponent { comp.getName(); comp.setName("goober"); comp.getParent(); - comp.getPeer(); comp.getGraphicsConfiguration(); comp.getTreeLock(); comp.getToolkit(); diff --git a/jdk/test/java/awt/Component/Headless/HeadlessContainer.java b/jdk/test/java/awt/Component/Headless/HeadlessContainer.java index bb4b00d7f0c..b1a1bea9c0a 100644 --- a/jdk/test/java/awt/Component/Headless/HeadlessContainer.java +++ b/jdk/test/java/awt/Component/Headless/HeadlessContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -87,7 +87,6 @@ public class HeadlessContainer { lw.setName("goober"); lw.getName(); lw.getParent(); - lw.getPeer(); lw.getGraphicsConfiguration(); lw.getTreeLock(); lw.getToolkit(); diff --git a/jdk/test/java/awt/Component/Headless/HeadlessPanel.java b/jdk/test/java/awt/Component/Headless/HeadlessPanel.java index 65b809c898d..b6d9da0a297 100644 --- a/jdk/test/java/awt/Component/Headless/HeadlessPanel.java +++ b/jdk/test/java/awt/Component/Headless/HeadlessPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -76,7 +76,6 @@ public class HeadlessPanel { p.setName("goober"); p.getName(); p.getParent(); - p.getPeer(); p.getGraphicsConfiguration(); p.getTreeLock(); p.getToolkit(); diff --git a/jdk/test/java/awt/FontClass/HeadlessFont.java b/jdk/test/java/awt/FontClass/HeadlessFont.java index e9eba8836e9..40747d89616 100644 --- a/jdk/test/java/awt/FontClass/HeadlessFont.java +++ b/jdk/test/java/awt/FontClass/HeadlessFont.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -224,11 +224,6 @@ public class HeadlessFont { f2.hasUniformLineMetrics(); f3.hasUniformLineMetrics(); f4.hasUniformLineMetrics(); - - f1.getPeer(); - f2.getPeer(); - f3.getPeer(); - f4.getPeer(); } } diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java index c74a8e63cf7..5ff316f430a 100644 --- a/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -29,6 +29,8 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import javax.swing.*; + +import sun.awt.AWTAccessor; import sun.awt.EmbeddedFrame; import java.io.*; import test.java.awt.regtesthelpers.Util; @@ -243,8 +245,9 @@ public abstract class OverlappingTestBase { if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) { getWindowMethodName = "getWindow"; } - ComponentPeer peer = embedder.getPeer(); -// System.err.println("Peer: " + peer); + ComponentPeer peer = AWTAccessor.getComponentAccessor() + .getPeer(embedder); + // System.err.println("Peer: " + peer); Method getWindowMethod = peer.getClass().getMethod(getWindowMethodName); frameWindow = (Long) getWindowMethod.invoke(peer); // System.err.println("frame peer ID: " + frameWindow); diff --git a/jdk/test/java/awt/Paint/ButtonRepaint.java b/jdk/test/java/awt/Paint/ButtonRepaint.java index a4dc34224c1..1b13ac323d0 100644 --- a/jdk/test/java/awt/Paint/ButtonRepaint.java +++ b/jdk/test/java/awt/Paint/ButtonRepaint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -23,7 +23,6 @@ import java.awt.*; -import java.awt.peer.ButtonPeer; /** * @test @@ -66,23 +65,16 @@ public final class ButtonRepaint extends Button { setLabel(""); setLabel(null); setLabel(getLabel()); - ((ButtonPeer) getPeer()).setLabel(""); - ((ButtonPeer) getPeer()).setLabel(null); - ((ButtonPeer) getPeer()).setLabel(getLabel()); setFont(null); setFont(getFont()); - getPeer().setFont(getFont()); setBackground(null); setBackground(getBackground()); - getPeer().setBackground(getBackground()); setForeground(null); setForeground(getForeground()); - getPeer().setForeground(getForeground()); setEnabled(isEnabled()); - getPeer().setEnabled(isEnabled()); } } diff --git a/jdk/test/java/awt/Paint/CheckboxRepaint.java b/jdk/test/java/awt/Paint/CheckboxRepaint.java index e7835a463c2..f4d7d99a5c1 100644 --- a/jdk/test/java/awt/Paint/CheckboxRepaint.java +++ b/jdk/test/java/awt/Paint/CheckboxRepaint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -22,7 +22,6 @@ */ import java.awt.*; -import java.awt.peer.CheckboxPeer; /** * @test @@ -63,31 +62,21 @@ public final class CheckboxRepaint extends Checkbox { void test() { setState(getState()); - ((CheckboxPeer) getPeer()).setState(getState()); - setCheckboxGroup(getCheckboxGroup()); - ((CheckboxPeer) getPeer()).setCheckboxGroup(getCheckboxGroup()); setLabel(""); setLabel(null); setLabel(getLabel()); - ((CheckboxPeer) getPeer()).setLabel(""); - ((CheckboxPeer) getPeer()).setLabel(null); - ((CheckboxPeer) getPeer()).setLabel(getLabel()); setFont(null); setFont(getFont()); - getPeer().setFont(getFont()); setBackground(null); setBackground(getBackground()); - getPeer().setBackground(getBackground()); setForeground(null); setForeground(getForeground()); - getPeer().setForeground(getForeground()); setEnabled(isEnabled()); - getPeer().setEnabled(isEnabled()); } } diff --git a/jdk/test/java/awt/Paint/LabelRepaint.java b/jdk/test/java/awt/Paint/LabelRepaint.java index f662f17dbd9..b6325958e2e 100644 --- a/jdk/test/java/awt/Paint/LabelRepaint.java +++ b/jdk/test/java/awt/Paint/LabelRepaint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -25,7 +25,6 @@ import java.awt.EventQueue; import java.awt.Frame; import java.awt.Graphics; import java.awt.Label; -import java.awt.peer.LabelPeer; /** * @test @@ -66,28 +65,20 @@ public final class LabelRepaint extends Label { void test() { setAlignment(getAlignment()); - ((LabelPeer) getPeer()).setAlignment(getAlignment()); setText(""); setText(null); setText(getText()); - ((LabelPeer) getPeer()).setText(""); - ((LabelPeer) getPeer()).setText(null); - ((LabelPeer) getPeer()).setText(getText()); setFont(null); setFont(getFont()); - getPeer().setFont(getFont()); setBackground(null); setBackground(getBackground()); - getPeer().setBackground(getBackground()); setForeground(null); setForeground(getForeground()); - getPeer().setForeground(getForeground()); setEnabled(isEnabled()); - getPeer().setEnabled(isEnabled()); } } diff --git a/jdk/test/java/awt/Paint/ListRepaint.java b/jdk/test/java/awt/Paint/ListRepaint.java index dc473daacab..fd96e7604ca 100644 --- a/jdk/test/java/awt/Paint/ListRepaint.java +++ b/jdk/test/java/awt/Paint/ListRepaint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -25,7 +25,6 @@ import java.awt.EventQueue; import java.awt.Frame; import java.awt.Graphics; import java.awt.List; -import java.awt.peer.ListPeer; /** * @test @@ -71,21 +70,16 @@ public final class ListRepaint extends List { void test() { select(0); - ((ListPeer) getPeer()).select(getSelectedIndex()); setFont(null); setFont(getFont()); - getPeer().setFont(getFont()); setBackground(null); setBackground(getBackground()); - getPeer().setBackground(getBackground()); setForeground(null); setForeground(getForeground()); - getPeer().setForeground(getForeground()); setEnabled(isEnabled()); - getPeer().setEnabled(isEnabled()); } } diff --git a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java index 94f1d911f89..cfa609896fc 100644 --- a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java +++ b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -42,6 +42,9 @@ import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.text.DefaultCaret; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; + public class bug7129742 { @@ -64,7 +67,8 @@ public class bug7129742 { frame.setVisible(true); try { - Class XTextAreaPeerClzz = textArea.getPeer().getClass(); + ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + Class XTextAreaPeerClzz = acc.getPeer(textArea).getClass(); System.out.println(XTextAreaPeerClzz.getName()); if (!XTextAreaPeerClzz.getName().equals("sun.awt.X11.XTextAreaPeer")) { fastreturn = true; @@ -73,7 +77,7 @@ public class bug7129742 { Field jtextField = XTextAreaPeerClzz.getDeclaredField("jtext"); jtextField.setAccessible(true); - JTextArea jtext = (JTextArea)jtextField.get(textArea.getPeer()); + JTextArea jtext = (JTextArea)jtextField.get(acc.getPeer(textArea)); caret = (DefaultCaret) jtext.getCaret(); textArea.requestFocusInWindow(); diff --git a/jdk/test/java/awt/regtesthelpers/UtilInternal.java b/jdk/test/java/awt/regtesthelpers/UtilInternal.java index a4b5a41bca7..ef12684fb10 100644 --- a/jdk/test/java/awt/regtesthelpers/UtilInternal.java +++ b/jdk/test/java/awt/regtesthelpers/UtilInternal.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import java.awt.Toolkit; import java.awt.Frame; +import sun.awt.AWTAccessor; /** @@ -45,7 +46,8 @@ public final class UtilInternal { InstantiationException, InvocationTargetException { Toolkit tk = Toolkit.getDefaultToolkit(); - FramePeer frame_peer = (FramePeer) embedder.getPeer(); + FramePeer frame_peer = AWTAccessor.getComponentAccessor() + .getPeer(embedder); System.out.println("frame's peer = " + frame_peer); if ("sun.awt.windows.WToolkit".equals(tk.getClass().getName())) { Class comp_peer_class = diff --git a/jdk/test/javax/swing/Headless/HeadlessBox.java b/jdk/test/javax/swing/Headless/HeadlessBox.java index ff3de6b83c3..73c789be6bd 100644 --- a/jdk/test/javax/swing/Headless/HeadlessBox.java +++ b/jdk/test/javax/swing/Headless/HeadlessBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -142,7 +142,6 @@ public class HeadlessBox { b.setName("goober"); b.getName(); b.getParent(); - b.getPeer(); b.getGraphicsConfiguration(); b.getTreeLock(); b.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java b/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java index 970148f7c1b..73de17e69eb 100644 --- a/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java +++ b/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -113,7 +113,6 @@ public class HeadlessBox_Filler { bf.setName("goober"); bf.getName(); bf.getParent(); - bf.getPeer(); bf.getGraphicsConfiguration(); bf.getTreeLock(); bf.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java b/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java index 43494535241..b1f0b8bf109 100644 --- a/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -91,7 +91,6 @@ public class HeadlessCellRendererPane { crp.setName("goober"); crp.getName(); crp.getParent(); - crp.getPeer(); crp.getGraphicsConfiguration(); crp.getTreeLock(); crp.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java index efac418a393..e38f905aaaa 100644 --- a/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java +++ b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -116,7 +116,6 @@ public class HeadlessDefaultListCellRenderer { dcr.setName("goober"); dcr.getName(); dcr.getParent(); - dcr.getPeer(); dcr.getGraphicsConfiguration(); dcr.getTreeLock(); dcr.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java index 457a1b0a9a6..29c93bd931e 100644 --- a/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java +++ b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -116,7 +116,6 @@ public class HeadlessDefaultListCellRenderer_UIResource { dcr.setName("goober"); dcr.getName(); dcr.getParent(); - dcr.getPeer(); dcr.getGraphicsConfiguration(); dcr.getTreeLock(); dcr.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJButton.java b/jdk/test/javax/swing/Headless/HeadlessJButton.java index 7f80803f247..08f47072c80 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJButton.java +++ b/jdk/test/javax/swing/Headless/HeadlessJButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -113,7 +113,6 @@ public class HeadlessJButton { b.setName("goober"); b.getName(); b.getParent(); - b.getPeer(); b.getGraphicsConfiguration(); b.getTreeLock(); b.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java b/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java index 9fd98563682..1ab0a6a91b9 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java +++ b/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -116,7 +116,6 @@ public class HeadlessJCheckBox { ch.setName("goober"); ch.getName(); ch.getParent(); - ch.getPeer(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java b/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java index 80673aae532..5550205045d 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java +++ b/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -113,7 +113,6 @@ public class HeadlessJCheckBoxMenuItem { ch.setName("goober"); ch.getName(); ch.getParent(); - ch.getPeer(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java b/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java index a78383c2800..bc160ccb365 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java +++ b/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -113,7 +113,6 @@ public class HeadlessJColorChooser { cc.setName("goober"); cc.getName(); cc.getParent(); - cc.getPeer(); cc.getGraphicsConfiguration(); cc.getTreeLock(); cc.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJComboBox.java b/jdk/test/javax/swing/Headless/HeadlessJComboBox.java index b5160543db2..0e33e878cc1 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJComboBox.java +++ b/jdk/test/javax/swing/Headless/HeadlessJComboBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -113,7 +113,6 @@ public class HeadlessJComboBox { ch.setName("goober"); ch.getName(); ch.getParent(); - ch.getPeer(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJComponent.java b/jdk/test/javax/swing/Headless/HeadlessJComponent.java index 80c10818a31..56bb6c14308 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJComponent.java +++ b/jdk/test/javax/swing/Headless/HeadlessJComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJComponent { ch.setName("goober"); ch.getName(); ch.getParent(); - ch.getPeer(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java b/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java index 2a1d231e3f2..4fea1a6ddb8 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJDesktopPane { ch.setName("goober"); ch.getName(); ch.getParent(); - ch.getPeer(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java b/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java index 1b408b38e4f..31e744e400c 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -115,7 +115,6 @@ public class HeadlessJEditorPane { b.setName("goober"); b.getName(); b.getParent(); - b.getPeer(); b.getGraphicsConfiguration(); b.getTreeLock(); b.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java b/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java index 7acac2baf27..bc30c303fc1 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java +++ b/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJFileChooser { ch.setName("goober"); ch.getName(); ch.getParent(); - ch.getPeer(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java index f642b1a8ccd..4bf70ef3bae 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java +++ b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -135,7 +135,6 @@ public class HeadlessJInternalFrame { intf.setName("goober"); intf.getName(); intf.getParent(); - intf.getPeer(); intf.getGraphicsConfiguration(); intf.getTreeLock(); intf.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java index e6c1cf4e2e8..e8b9321c357 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java +++ b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJInternalFrame_JDesktopIcon { jdi.setName("goober"); jdi.getName(); jdi.getParent(); - jdi.getPeer(); jdi.getGraphicsConfiguration(); jdi.getTreeLock(); jdi.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJLabel.java b/jdk/test/javax/swing/Headless/HeadlessJLabel.java index a61c1fb672c..4e8d0946c64 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJLabel.java +++ b/jdk/test/javax/swing/Headless/HeadlessJLabel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJLabel { l.setName("goober"); l.getName(); l.getParent(); - l.getPeer(); l.getGraphicsConfiguration(); l.getTreeLock(); l.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java b/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java index ce23c2e3f71..f1d9b53a56c 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJLayeredPane { lp.setName("goober"); lp.getName(); lp.getParent(); - lp.getPeer(); lp.getGraphicsConfiguration(); lp.getTreeLock(); lp.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJList.java b/jdk/test/javax/swing/Headless/HeadlessJList.java index 762d34f4576..687b5fe8bd4 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJList.java +++ b/jdk/test/javax/swing/Headless/HeadlessJList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJList { l.setName("goober"); l.getName(); l.getParent(); - l.getPeer(); l.getGraphicsConfiguration(); l.getTreeLock(); l.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJMenu.java b/jdk/test/javax/swing/Headless/HeadlessJMenu.java index 482fca9f74b..8f866d62192 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJMenu.java +++ b/jdk/test/javax/swing/Headless/HeadlessJMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -110,7 +110,6 @@ public class HeadlessJMenu { m.setName("goober"); m.getName(); m.getParent(); - m.getPeer(); m.getGraphicsConfiguration(); m.getTreeLock(); m.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java b/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java index a8880295644..3296cb2ae1a 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java +++ b/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJMenuBar { mb.setName("goober"); mb.getName(); mb.getParent(); - mb.getPeer(); mb.getGraphicsConfiguration(); mb.getTreeLock(); mb.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java b/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java index 67355904e94..67ca4f75db5 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java +++ b/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJMenuItem { mi.setName("goober"); mi.getName(); mi.getParent(); - mi.getPeer(); mi.getGraphicsConfiguration(); mi.getTreeLock(); mi.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java b/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java index 35731e3f23d..bc0913efeb2 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJOptionPane { op.setName("goober"); op.getName(); op.getParent(); - op.getPeer(); op.getGraphicsConfiguration(); op.getTreeLock(); op.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJPanel.java b/jdk/test/javax/swing/Headless/HeadlessJPanel.java index 7447f487262..2233c3ad872 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJPanel.java +++ b/jdk/test/javax/swing/Headless/HeadlessJPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJPanel { p.setName("goober"); p.getName(); p.getParent(); - p.getPeer(); p.getGraphicsConfiguration(); p.getTreeLock(); p.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java index 2337faaf426..6452e043162 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java +++ b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -110,7 +110,6 @@ public class HeadlessJPopupMenu { m.setName("goober"); m.getName(); m.getParent(); - m.getPeer(); m.getGraphicsConfiguration(); m.getTreeLock(); m.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java index c3f102e9365..b429f730fed 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java +++ b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJPopupMenu_Separator { s.setName("goober"); s.getName(); s.getParent(); - s.getPeer(); s.getGraphicsConfiguration(); s.getTreeLock(); s.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java b/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java index fddeb935583..63e0d3f25ca 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java +++ b/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJProgressBar { pb.setName("goober"); pb.getName(); pb.getParent(); - pb.getPeer(); pb.getGraphicsConfiguration(); pb.getTreeLock(); pb.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java b/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java index 1c00ffe353b..08db0fcebb7 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java +++ b/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJRadioButton { rb.setName("goober"); rb.getName(); rb.getParent(); - rb.getPeer(); rb.getGraphicsConfiguration(); rb.getTreeLock(); rb.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java b/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java index b6727cdf76e..827bf4892b0 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java +++ b/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJRadioButtonMenuItem { i.setName("goober"); i.getName(); i.getParent(); - i.getPeer(); i.getGraphicsConfiguration(); i.getTreeLock(); i.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJRootPane.java b/jdk/test/javax/swing/Headless/HeadlessJRootPane.java index b69f0d373fc..da296c9f0ba 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJRootPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJRootPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJRootPane { rp.setName("goober"); rp.getName(); rp.getParent(); - rp.getPeer(); rp.getGraphicsConfiguration(); rp.getTreeLock(); rp.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java b/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java index 4241bc9b47b..6fd50d74422 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java +++ b/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJScrollBar { sb.setName("goober"); sb.getName(); sb.getParent(); - sb.getPeer(); sb.getGraphicsConfiguration(); sb.getTreeLock(); sb.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java b/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java index a14c1d820cc..e1523ceeb80 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJScrollPane { sp.setName("goober"); sp.getName(); sp.getParent(); - sp.getPeer(); sp.getGraphicsConfiguration(); sp.getTreeLock(); sp.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJSeparator.java b/jdk/test/javax/swing/Headless/HeadlessJSeparator.java index 51d7fc67d26..576d0d27a18 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJSeparator.java +++ b/jdk/test/javax/swing/Headless/HeadlessJSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJSeparator { sp.setName("goober"); sp.getName(); sp.getParent(); - sp.getPeer(); sp.getGraphicsConfiguration(); sp.getTreeLock(); sp.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJSlider.java b/jdk/test/javax/swing/Headless/HeadlessJSlider.java index ce9e3c6f23b..631ff170f34 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJSlider.java +++ b/jdk/test/javax/swing/Headless/HeadlessJSlider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJSlider { s.setName("goober"); s.getName(); s.getParent(); - s.getPeer(); s.getGraphicsConfiguration(); s.getTreeLock(); s.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJSpinner.java b/jdk/test/javax/swing/Headless/HeadlessJSpinner.java index 071913e615e..546cbf0b430 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJSpinner.java +++ b/jdk/test/javax/swing/Headless/HeadlessJSpinner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJSpinner { s.setName("goober"); s.getName(); s.getParent(); - s.getPeer(); s.getGraphicsConfiguration(); s.getTreeLock(); s.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java b/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java index 9988df8c366..df6ec354ae5 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -106,7 +106,6 @@ public class HeadlessJSplitPane { s.setName("goober"); s.getName(); s.getParent(); - s.getPeer(); s.getGraphicsConfiguration(); s.getTreeLock(); s.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java b/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java index 12b11619726..c09117c420a 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java +++ b/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJTabbedPane { s.setName("goober"); s.getName(); s.getParent(); - s.getPeer(); s.getGraphicsConfiguration(); s.getTreeLock(); s.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJTable.java b/jdk/test/javax/swing/Headless/HeadlessJTable.java index 3c6ce45ef40..9f0e28f77e7 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJTable.java +++ b/jdk/test/javax/swing/Headless/HeadlessJTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -135,7 +135,6 @@ public class HeadlessJTable { t.setName("goober"); t.getName(); t.getParent(); - t.getPeer(); t.getGraphicsConfiguration(); t.getTreeLock(); t.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJTextArea.java b/jdk/test/javax/swing/Headless/HeadlessJTextArea.java index d7a00d500be..3db0d416772 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJTextArea.java +++ b/jdk/test/javax/swing/Headless/HeadlessJTextArea.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -116,7 +116,6 @@ public class HeadlessJTextArea { t.setName("goober"); t.getName(); t.getParent(); - t.getPeer(); t.getGraphicsConfiguration(); t.getTreeLock(); t.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJTextField.java b/jdk/test/javax/swing/Headless/HeadlessJTextField.java index c6b0c9bdcf2..a9b7e5c2afd 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJTextField.java +++ b/jdk/test/javax/swing/Headless/HeadlessJTextField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -116,7 +116,6 @@ public class HeadlessJTextField { t.setName("goober"); t.getName(); t.getParent(); - t.getPeer(); t.getGraphicsConfiguration(); t.getTreeLock(); t.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java b/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java index df92ca4ec04..4b6436d5b51 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java +++ b/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJToggleButton { tb.setName("goober"); tb.getName(); tb.getParent(); - tb.getPeer(); tb.getGraphicsConfiguration(); tb.getTreeLock(); tb.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJToolBar.java b/jdk/test/javax/swing/Headless/HeadlessJToolBar.java index bbd9d8f5b0a..63de0cda40e 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJToolBar.java +++ b/jdk/test/javax/swing/Headless/HeadlessJToolBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJToolBar { tb.setName("goober"); tb.getName(); tb.getParent(); - tb.getPeer(); tb.getGraphicsConfiguration(); tb.getTreeLock(); tb.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java b/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java index 3a1788b83fa..2b4562e45f5 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java +++ b/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJToolBar_Separator { s.setName("goober"); s.getName(); s.getParent(); - s.getPeer(); s.getGraphicsConfiguration(); s.getTreeLock(); s.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJToolTip.java b/jdk/test/javax/swing/Headless/HeadlessJToolTip.java index 1241ad6ee0c..3c18a854951 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJToolTip.java +++ b/jdk/test/javax/swing/Headless/HeadlessJToolTip.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -112,7 +112,6 @@ public class HeadlessJToolTip { tt.setName("goober"); tt.getName(); tt.getParent(); - tt.getPeer(); tt.getGraphicsConfiguration(); tt.getTreeLock(); tt.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJTree.java b/jdk/test/javax/swing/Headless/HeadlessJTree.java index ba762dfa862..751df31cf21 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJTree.java +++ b/jdk/test/javax/swing/Headless/HeadlessJTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -153,7 +153,6 @@ public class HeadlessJTree { t.setName("goober"); t.getName(); t.getParent(); - t.getPeer(); t.getGraphicsConfiguration(); t.getTreeLock(); t.getToolkit(); diff --git a/jdk/test/javax/swing/Headless/HeadlessJViewport.java b/jdk/test/javax/swing/Headless/HeadlessJViewport.java index 5f315f67026..a5cc18698aa 100644 --- a/jdk/test/javax/swing/Headless/HeadlessJViewport.java +++ b/jdk/test/javax/swing/Headless/HeadlessJViewport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -120,7 +120,6 @@ public class HeadlessJViewport { v.setName("goober"); v.getName(); v.getParent(); - v.getPeer(); v.getGraphicsConfiguration(); v.getTreeLock(); v.getToolkit();