--- old/test/java/awt/Focus/RequestOnCompWithNullParent/RequestOnCompWithNullParent1.java 2015-10-08 22:05:03.369496843 +0300 +++ new/test/java/awt/Focus/RequestOnCompWithNullParent/RequestOnCompWithNullParent1.java 2015-10-08 22:05:03.269446850 +0300 @@ -27,7 +27,6 @@ @author oleg.sukhodolsky: area=awt.focus @library ../../regtesthelpers @modules java.desktop/java.awt.peer - java.desktop/sun.awt @build Util @run main RequestOnCompWithNullParent1 */ @@ -42,10 +41,10 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import sun.awt.AWTAccessor; - public class RequestOnCompWithNullParent1 { + static Field peer_field; + public static void main(final String[] args) throws Exception { Frame frame = new Frame("test for 6418028"); try { @@ -72,6 +71,9 @@ new Robot().waitForIdle(); + peer_field = Component.class.getDeclaredField("peer"); + peer_field.setAccessible(true); + btn2.instrumentPeer(); btn2.requestFocusInWindow(); btn2.restorePeer(); @@ -88,7 +90,7 @@ } public void instrumentPeer() { - origPeer = AWTAccessor.getComponentAccessor().getPeer(this); + origPeer = getPeer(); InvocationHandler handler = new InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) { @@ -117,18 +119,27 @@ setPeer(proxiedPeer); } - private void setPeer(final ComponentPeer newPeer) { + private ButtonPeer getPeer() { try { - Field peer_field = Component.class.getDeclaredField("peer"); - peer_field.setAccessible(true); - peer_field.set(this, newPeer); + return (ButtonPeer) + RequestOnCompWithNullParent1.peer_field.get(this); } catch (IllegalArgumentException ex) { throw new Error("Test error.", ex); } catch (SecurityException ex) { throw new Error("Test error.", ex); } catch (IllegalAccessException ex) { throw new Error("Test error.", ex); - } catch (NoSuchFieldException ex) { + } + } + + private void setPeer(final ComponentPeer newPeer) { + try { + RequestOnCompWithNullParent1.peer_field.set(this, newPeer); + } catch (IllegalArgumentException ex) { + throw new Error("Test error.", ex); + } catch (SecurityException ex) { + throw new Error("Test error.", ex); + } catch (IllegalAccessException ex) { throw new Error("Test error.", ex); } } --- old/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java 2015-10-08 22:05:03.617620825 +0300 +++ new/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java 2015-10-08 22:05:03.517570833 +0300 @@ -22,15 +22,11 @@ */ -import com.sun.awt.AWTUtilities; -import java.awt.Frame; -import java.awt.Panel; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Robot; +import java.awt.*; import java.awt.event.InputEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.lang.reflect.Method; import javax.swing.JButton; import javax.swing.SwingUtilities; import test.java.awt.regtesthelpers.Util; @@ -46,8 +42,7 @@ @bug 6776743 @summary Opaque overlapping test for each AWT component @library ../../regtesthelpers -@modules java.desktop/com.sun.awt - java.desktop/java.awt.peer +@modules java.desktop/java.awt.peer java.desktop/sun.awt @build Util @run main OpaqueOverlapping @@ -132,12 +127,10 @@ // flag value. for (int i = 0; i < 9; ++i) { if (i == 3) { - AWTUtilities.setComponentMixingCutoutShape(light, - new Rectangle()); + setMixingCutoutShape(light, new Rectangle()); } if (i == 6) { - AWTUtilities.setComponentMixingCutoutShape(light, - null); + setMixingCutoutShape(light, null); } robot.mousePress(InputEvent.BUTTON1_MASK); @@ -163,8 +156,24 @@ } // this strange plumbing stuff is required due to "Standard Test Machinery" in base class - public static void main(String args[]) throws InterruptedException { + public static void main(String args[]) throws Exception { + setMixingCutoutShapeMethod = Component.class. + getDeclaredMethod("setMixingCutoutShape", Shape.class); + setMixingCutoutShapeMethod.setAccessible(true); + instance = new OpaqueOverlapping(); OverlappingTestBase.doMain(args); } + + private static Method setMixingCutoutShapeMethod; + + private static void setMixingCutoutShape(Component comp, Shape shape) { + try { + setMixingCutoutShapeMethod.invoke(comp, shape); + } catch (Exception e) { + throw new RuntimeException("Cannot execute setMixingCutoutShape " + + "method"); + } + } + } --- old/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java 2015-10-08 22:05:03.861742808 +0300 +++ new/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java 2015-10-08 22:05:03.765694815 +0300 @@ -25,12 +25,12 @@ import java.awt.event.*; import java.awt.peer.ComponentPeer; import java.lang.reflect.Constructor; +import java.lang.reflect.Field; 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; @@ -74,6 +74,7 @@ * Generic strings array. To be used for population of List based controls. */ protected static final String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Rhynocephalia Granda", "Bear", "Tiger", "Mustang"}; + static Field peerField; // "properties" /** * Tests customization. Set this variable to test only control from java.awt @@ -245,8 +246,7 @@ if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) { getWindowMethodName = "getWindow"; } - ComponentPeer peer = AWTAccessor.getComponentAccessor() - .getPeer(embedder); + ComponentPeer peer = (ComponentPeer) peerField.get(embedder); // System.err.println("Peer: " + peer); Method getWindowMethod = peer.getClass().getMethod(getWindowMethodName); frameWindow = (Long) getWindowMethod.invoke(peer); @@ -568,6 +568,12 @@ * @throws InterruptedException */ public static void doMain(String args[]) throws InterruptedException { + try { + peerField = Component.class.getDeclaredField("peer"); + } catch (NoSuchFieldException e) { + throw new RuntimeException("peer field is not available"); + } + peerField.setAccessible(true); mainThread = Thread.currentThread(); try { init(); --- old/test/java/awt/Mixing/OpaqueTest.java 2015-10-08 22:05:04.105864790 +0300 +++ new/test/java/awt/Mixing/OpaqueTest.java 2015-10-08 22:05:04.009816797 +0300 @@ -27,7 +27,6 @@ @summary Tests whether opaque and non-opaque components mix correctly @author anthony.petrov@...: area=awt.mixing @library ../regtesthelpers - @modules java.desktop/com.sun.awt @build Util @run main OpaqueTest */ @@ -41,9 +40,9 @@ import java.awt.*; import java.awt.event.*; +import java.lang.reflect.Method; import javax.swing.*; import test.java.awt.regtesthelpers.Util; -import com.sun.awt.AWTUtilities; @@ -124,12 +123,10 @@ // flag value. for (int i = 0; i < 9; ++i) { if (i == 3) { - AWTUtilities.setComponentMixingCutoutShape(light, - new Rectangle()); + setMixingCutoutShape(light, new Rectangle()); } if (i == 6) { - AWTUtilities.setComponentMixingCutoutShape(light, - null); + setMixingCutoutShape(light, null); } robot.mousePress(InputEvent.BUTTON1_MASK); @@ -174,8 +171,12 @@ // instantiated in the same VM. Being static (and using // static vars), it aint gonna work. Not worrying about // it for now. - public static void main( String args[] ) throws InterruptedException + public static void main( String args[] ) throws Exception { + setMixingCutoutShapeMethod = Component.class. + getDeclaredMethod("setMixingCutoutShape", Shape.class); + setMixingCutoutShapeMethod.setAccessible(true); + mainThread = Thread.currentThread(); try { @@ -216,6 +217,17 @@ }//main + private static Method setMixingCutoutShapeMethod; + + private static void setMixingCutoutShape(Component comp, Shape shape) { + try { + setMixingCutoutShapeMethod.invoke(comp, shape); + } catch (Exception e) { + throw new RuntimeException("Cannot execute setMixingCutoutShape " + + "method"); + } + } + public static synchronized void setTimeoutTo( int seconds ) { sleepTime = seconds * 1000; --- old/src/java.desktop/share/classes/java/awt/Component.java 2015-10-08 22:05:04.361992772 +0300 +++ new/src/java.desktop/share/classes/java/awt/Component.java 2015-10-08 22:05:04.257940780 +0300 @@ -845,32 +845,7 @@ return new Rectangle(comp.x, comp.y, comp.width, comp.height); } public void setMixingCutoutShape(Component comp, Shape shape) { - Region region = shape == null ? null : - Region.getInstance(shape, null); - - synchronized (comp.getTreeLock()) { - boolean needShowing = false; - boolean needHiding = false; - - if (!comp.isNonOpaqueForMixing()) { - needHiding = true; - } - - comp.mixingCutoutRegion = region; - - if (!comp.isNonOpaqueForMixing()) { - needShowing = true; - } - - if (comp.isMixingNeeded()) { - if (needHiding) { - comp.mixOnHiding(comp.isLightweight()); - } - if (needShowing) { - comp.mixOnShowing(); - } - } - } + comp.setMixingCutoutShape(shape); } public void setGraphicsConfiguration(Component comp, @@ -987,6 +962,35 @@ }); } + private void setMixingCutoutShape(Shape shape) { + Region region = shape == null ? null : + Region.getInstance(shape, null); + + synchronized (getTreeLock()) { + boolean needShowing = false; + boolean needHiding = false; + + if (!isNonOpaqueForMixing()) { + needHiding = true; + } + + mixingCutoutRegion = region; + + if (!isNonOpaqueForMixing()) { + needShowing = true; + } + + if (isMixingNeeded()) { + if (needHiding) { + mixOnHiding(isLightweight()); + } + if (needShowing) { + mixOnShowing(); + } + } + } + } + /** * Constructs a new component. Class Component can be * extended directly to create a lightweight component that does not --- old/test/javax/swing/JTable/6937798/bug6937798.java 2015-10-08 22:05:04.670146750 +0300 +++ new/test/javax/swing/JTable/6937798/bug6937798.java 2015-10-08 22:05:04.566094757 +0300 @@ -25,11 +25,9 @@ @bug 6937798 @summary Nimbus: Issues with JTable grid @author Alexander Potochkin - @modules java.desktop/com.sun.java.swing.plaf.nimbus @run main bug6937798 */ -import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel; import javax.swing.*; import javax.swing.table.AbstractTableModel; @@ -40,7 +38,7 @@ public class bug6937798 { public static void main(String... args) throws Exception { - UIManager.setLookAndFeel(new NimbusLookAndFeel()); + UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); SwingUtilities.invokeAndWait(new Runnable() { public void run() { new bug6937798(); --- old/test/javax/swing/plaf/nimbus/Test6741426.java 2015-10-08 22:05:04.918270732 +0300 +++ new/test/javax/swing/plaf/nimbus/Test6741426.java 2015-10-08 22:05:04.814218740 +0300 @@ -25,11 +25,9 @@ @bug 6741426 @summary Tests reusing Nimbus borders across different components (JComboBox border set on a JTextField) @author Peter Zhelezniakov - @modules java.desktop/com.sun.java.swing.plaf.nimbus @run main Test6741426 */ -import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel; import javax.swing.*; import java.awt.image.BufferedImage; @@ -50,7 +48,7 @@ } public static void main(String[] args) throws Exception { - UIManager.setLookAndFeel(new NimbusLookAndFeel()); + UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); SwingUtilities.invokeAndWait(new Test6741426()); } } --- old/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java 2015-10-08 22:05:05.162392715 +0300 +++ new/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java 2015-10-08 22:05:05.062342722 +0300 @@ -32,8 +32,7 @@ @bug 6994264 @summary Opaque overlapping test for Choice AWT component @library ../../regtesthelpers -@modules java.desktop/com.sun.awt - java.desktop/java.awt.peer +@modules java.desktop/java.awt.peer java.desktop/sun.awt @build Util @run main OpaqueOverlappingChoice