Merge
authorprr
Thu, 19 Jul 2018 10:53:38 -0700
changeset 51168 17148c9457a6
parent 51167 d03b04e7569a (diff)
parent 51163 8b8658b1b7e4 (current diff)
child 51169 0058ffa0a922
child 51901 3f5a55b6bad8
Merge
make/data/symbols/java.base-6.sym.txt
make/data/symbols/java.compiler-6.sym.txt
make/data/symbols/java.desktop-6.sym.txt
make/data/symbols/java.logging-6.sym.txt
make/data/symbols/java.management-6.sym.txt
make/data/symbols/java.rmi-6.sym.txt
make/data/symbols/java.security.jgss-6.sym.txt
make/data/symbols/java.sql-6.sym.txt
make/data/symbols/java.sql.rowset-6.sym.txt
make/data/symbols/java.xml-6.sym.txt
make/data/symbols/java.xml.bind-6.sym.txt
make/data/symbols/java.xml.ws-6.sym.txt
make/data/symbols/java.xml.ws.annotation-6.sym.txt
make/data/symbols/jdk.management-6.sym.txt
make/data/symbols/jdk.sctp-6.sym.txt
make/data/symbols/jdk.security.jgss-6.sym.txt
test/hotspot/jtreg/compiler/graalunit/JttLangMTest.java
test/hotspot/jtreg/compiler/graalunit/JttReflectFTest.java
test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java
test/hotspot/jtreg/runtime/appcds/test-classes/CheckIfShared.java
test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatRateTest.java
test/langtools/tools/javac/TryWithResources/WeirdTwr.out
test/langtools/tools/javac/diags/examples/MethodInvokedWithWrongNumberOfArgs.java
test/langtools/tools/javac/diags/examples/MulticatchNotSupported.java
test/langtools/tools/javac/diags/examples/StringSwitchNotSupported.java
test/langtools/tools/javac/diags/examples/TryResourceNotSupported.java
test/langtools/tools/javac/diags/examples/TryWithoutCatchOrFinally.java
test/langtools/tools/javac/diags/examples/UnsupportedBinaryLiteral.java
test/langtools/tools/javac/diags/examples/UnsupportedUnderscoreLiteral.java
test/langtools/tools/javac/warnings/6594914/T6594914b.out
--- a/src/java.desktop/share/classes/javax/swing/JScrollBar.java	Thu Jul 19 10:17:22 2018 -0700
+++ b/src/java.desktop/share/classes/javax/swing/JScrollBar.java	Thu Jul 19 10:53:38 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -340,17 +340,17 @@
      * given a unit up/down request.  A ScrollBarUI implementation
      * typically calls this method when the user clicks on a scrollbar
      * up/down arrow and uses the result to update the scrollbar's
-     * value.   Subclasses my override this method to compute
-     * a value, e.g. the change required to scroll up or down one
-     * (variable height) line text or one row in a table.
+     * value.   Subclasses may override this method to compute
+     * a value, e.g. the change required to scroll one
+     * (variable height) line of text or one row in a table.
      * <p>
      * The JScrollPane component creates scrollbars (by default)
      * that override this method and delegate to the viewports
      * Scrollable view, if it has one.  The Scrollable interface
      * provides a more specialized version of this method.
      * <p>
-     * Some look and feels implement custom scrolling behavior
-     * and ignore this property.
+     * Some look and feel implementations that provide custom scrolling
+     * behavior ignore this property.
      *
      * @param direction is -1 or 1 for up/down respectively
      * @return the value of the unitIncrement property
@@ -367,10 +367,11 @@
      * Sets the unitIncrement property.
      * <p>
      * Note, that if the argument is equal to the value of Integer.MIN_VALUE,
-     * the most look and feels will not provide the scrolling to the right/down.
+     * then most look and feel implementations will not provide scrolling
+     * to the right/down.
      * <p>
-     * Some look and feels implement custom scrolling behavior
-     * and ignore this property.
+     * Some look and feel implementations that provide custom scrolling
+     * behavior ignore this property.
      *
      * @see #getUnitIncrement
      */
@@ -387,18 +388,18 @@
      * Returns the amount to change the scrollbar's value by,
      * given a block (usually "page") up/down request.  A ScrollBarUI
      * implementation typically calls this method when the user clicks
-     * above or below the scrollbar "knob" to change the value
-     * up or down by large amount.  Subclasses my override this
-     * method to compute a value, e.g. the change required to scroll
-     * up or down one paragraph in a text document.
+     * outside the scrollbar "knob" to scroll up or down by a large amount.
+     * Subclasses may override this method to compute a
+     * value, e.g. the change required to scroll one paragraph
+     * in a text document.
      * <p>
      * The JScrollPane component creates scrollbars (by default)
      * that override this method and delegate to the viewports
      * Scrollable view, if it has one.  The Scrollable interface
      * provides a more specialized version of this method.
      * <p>
-     * Some look and feels implement custom scrolling behavior
-     * and ignore this property.
+     * Some look and feel implementations that provide custom scrolling
+     * behavior ignore this property.
      *
      * @param direction is -1 or 1 for up/down respectively
      * @return the value of the blockIncrement property
@@ -415,10 +416,11 @@
      * Sets the blockIncrement property.
      * <p>
      * Note, that if the argument is equal to the value of Integer.MIN_VALUE,
-     * the most look and feels will not provide the scrolling to the right/down.
+     * then most look and feel implementations will not provide scrolling
+     * to the right/down.
      * <p>
-     * Some look and feels implement custom scrolling behavior
-     * and ignore this property.
+     * Some look and feel implementations that provide custom scrolling
+     * behavior ignore this property.
      *
      * @see #getBlockIncrement()
      */
@@ -642,7 +644,7 @@
      * to a BoundedRangeModels value are considered equivalent.  To change
      * the value of a BoundedRangeModel one just sets its value property,
      * i.e. model.setValue(123).  No information about the origin of the
-     * change, e.g. it's a block decrement, is provided.  We don't try
+     * change, e.g. it's a block decrement, is provided.  We don't try to
      * fabricate the origin of the change here.
      *
      * @param l the AdjustmentLister to add
--- a/test/jdk/java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.html	Thu Jul 19 10:17:22 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<!--
- Copyright (c) 2002, 2016, 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
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<!--  
-  @test 1.2 01/02/10
-  @key headful
-  @bug 4902933
-  @summary Test that selecting the current item sends an ItemEvent
-  @author bchristi : area= Choice
-  @run applet SelectCurrentItemTest.html
-  -->
-<head>
-<title>  </title>
-</head>
-<body>
-
-<h1>SelectCurrentItemTest<br>Bug ID: 9999999 XXX_CHANGE_THIS </h1>
-
-<p> This is an AUTOMATIC test, simply wait for completion </p>
-
-<APPLET CODE="SelectCurrentItemTest.class" WIDTH=200 HEIGHT=200></APPLET>
-</body>
-</html>
-
--- a/test/jdk/java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.java	Thu Jul 19 10:17:22 2018 -0700
+++ b/test/jdk/java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.java	Thu Jul 19 10:53:38 2018 -0700
@@ -21,67 +21,48 @@
  * questions.
  */
 /*
-  test 1.3 02/06/25
-  @bug 4902933
-  @summary Test that selecting the current item sends an ItemEvent
-  @author bchristi : area= Choice
-  @run applet SelectCurrentItemTest.html
+  @test
+  @bug 4902933 8197810
+  @summary Test that selecting the current item doesnot send an ItemEvent
+  @key headful
+  @run main SelectCurrentItemTest
 */
 
-// Note there is no @ in front of test above.  This is so that the
-//  harness will not mistake this file as a test file.  It should
-//  only see the html file as a test file. (the harness runs all
-//  valid test files, so it would run this test twice if this file
-//  were valid as well as the html file.)
-// Also, note the area= after Your Name in the author tag.  Here, you
-//  should put which functional area the test falls in.  See the
-//  AWT-core home page -> test areas and/or -> AWT team  for a list of
-//  areas.
-// Note also the 'SelectCurrentItemTest.html' in the run tag.  This should
-//  be changed to the name of the test.
-
-
-/**
- * SelectCurrentItemTest.java
- *
- * summary:
- */
-
-import java.applet.Applet;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Choice;
+import java.awt.Robot;
+import java.awt.Frame;
+import java.awt.BorderLayout;
+import java.awt.AWTException;
+import java.awt.Point;
+import java.awt.Dimension;
+import java.awt.event.InputEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.WindowListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
-//Automated tests should run as applet tests if possible because they
-// get their environments cleaned up, including AWT threads, any
-// test created threads, and any system resources used by the test
-// such as file descriptors.  (This is normally not a problem as
-// main tests usually run in a separate VM, however on some platforms
-// such as the Mac, separate VMs are not possible and non-applet
-// tests will cause problems).  Also, you don't have to worry about
-// synchronisation stuff in Applet tests they way you do in main
-// tests...
-
-
-public class SelectCurrentItemTest extends Applet implements ItemListener,
- WindowListener, Runnable
-{
+public class SelectCurrentItemTest implements ItemListener, WindowListener {
     //Declare things used in the test, like buttons and labels here
-    Frame frame;
-    Choice theChoice;
-    Robot robot;
+    private Frame frame;
+    private Choice theChoice;
+    private Robot robot;
 
-    Object lock = new Object();
-    boolean passed = false;
+    private CountDownLatch latch = new CountDownLatch(1);
+    private volatile boolean passed = true;
 
-    public void init()
+    private void init()
     {
-        //Create instructions for the user here, as well as set up
-        // the environment -- set the layout manager, add buttons,
-        // etc.
-
-        this.setLayout (new BorderLayout ());
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(500);
+        } catch (AWTException e) {
+            throw new RuntimeException("Unable to create Robot. Test fails.");
+        }
 
         frame = new Frame("SelectCurrentItemTest");
+        frame.setLayout(new BorderLayout());
         theChoice = new Choice();
         for (int i = 0; i < 10; i++) {
             theChoice.add(new String("Choice Item " + i));
@@ -90,49 +71,30 @@
         frame.add(theChoice);
         frame.addWindowListener(this);
 
-        try {
-            robot = new Robot();
-            robot.setAutoDelay(500);
-        }
-        catch (AWTException e) {
-            throw new RuntimeException("Unable to create Robot.  Test fails.");
-        }
-
-    }//End  init()
-
-    public void start ()
-    {
-        //Get things going.  Request focus, set size, et cetera
-        setSize (200,200);
-        setVisible(true);
-        validate();
-
-        //What would normally go into main() will probably go here.
-        //Use System.out.println for diagnostic messages that you want
-        //to read after the test is done.
-        //Use System.out.println for messages you want the tester to read.
-
         frame.setLocation(1,20);
         robot.mouseMove(10, 30);
         frame.pack();
         frame.setVisible(true);
-        synchronized(lock) {
+    }
+
+    public static void main(String... args) {
+        SelectCurrentItemTest test = new SelectCurrentItemTest();
+        test.init();
         try {
-        lock.wait(120000);
-        }
-        catch(InterruptedException e) {}
+            test.latch.await(12000, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException e) {}
+        test.robot.waitForIdle();
+
+        try {
+            if (!test.passed) {
+                throw new RuntimeException("TEST FAILED.");
+            }
+        } finally {
+            test.frame.dispose();
         }
-        robot.waitForIdle();
-        if (!passed) {
-            throw new RuntimeException("TEST FAILED!");
-        }
+    }
 
-        // wait to make sure ItemEvent has been processed
-
-//        try {Thread.sleep(10000);} catch (InterruptedException e){}
-    }// start()
-
-    public void run() {
+    private void run() {
         try {Thread.sleep(1000);} catch (InterruptedException e){}
         // get loc of Choice on screen
         Point loc = theChoice.getLocationOnScreen();
@@ -144,33 +106,29 @@
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        robot.setAutoDelay(1000);
+        robot.delay(1000);
+
         robot.mouseMove(loc.x + size.width / 2, loc.y + size.height + size.height / 2);
-        robot.setAutoDelay(250);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
         robot.waitForIdle();
-        synchronized(lock) {
-            lock.notify();
-        }
+        latch.countDown();
     }
 
-    public void itemStateChanged(ItemEvent e) {
-        System.out.println("ItemEvent received.  Test passes");
-        passed = true;
+    @Override public void itemStateChanged(ItemEvent e) {
+        System.out.println("ItemEvent received.  Test fails");
+        passed = false;
     }
 
-    public void windowOpened(WindowEvent e) {
+    @Override public void windowOpened(WindowEvent e) {
         System.out.println("windowActivated()");
-        Thread testThread = new Thread(this);
-        testThread.start();
-    }
-    public void windowActivated(WindowEvent e) {
+        (new Thread(this::run)).start();
     }
-    public void windowDeactivated(WindowEvent e) {}
-    public void windowClosed(WindowEvent e) {}
-    public void windowClosing(WindowEvent e) {}
-    public void windowIconified(WindowEvent e) {}
-    public void windowDeiconified(WindowEvent e) {}
 
-}// class SelectCurrentItemTest
+    @Override public void windowActivated(WindowEvent e) {}
+    @Override public void windowDeactivated(WindowEvent e) {}
+    @Override public void windowClosed(WindowEvent e) {}
+    @Override public void windowClosing(WindowEvent e) {}
+    @Override public void windowIconified(WindowEvent e) {}
+    @Override public void windowDeiconified(WindowEvent e) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.java	Thu Jul 19 10:53:38 2018 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.TrayIcon;
+import java.awt.SystemTray;
+import java.awt.EventQueue;
+import java.awt.Point;
+import java.awt.AWTException;
+import java.awt.event.MouseEvent;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @bug 6271624 8195991
+ * @key headful
+ * @summary Right clicking on TrayIcon shouldn't trigger ActionEvent when balloon is displayed.
+ * @modules java.desktop/java.awt:open
+ * @library /java/awt/patchlib
+ * @library ../../../../lib/testlibrary ../
+ * @build java.desktop/java.awt.Helper
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main RightClickWhenBalloonDisplayed
+ */
+
+public class RightClickWhenBalloonDisplayed {
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+    int actionPerformedCount = -1;
+
+    public static void main(String[] args) throws Exception {
+        if (!SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("win"))
+                System.err.println("Test can fail if the icon hides to a tray icons pool " +
+                        "in Windows 7/10, which is behavior by default.\n" +
+                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
+                        "\"Always show all icons and notifications on the taskbar\" true " +
+                        "to avoid this problem. Or change behavior only for Java SE " +
+                        "tray icon.");
+            new RightClickWhenBalloonDisplayed().doTest();
+        }
+    }
+
+    RightClickWhenBalloonDisplayed() throws Exception {
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait(this::initializeGUI);
+        robot.waitForIdle(1000);
+    }
+
+    private void initializeGUI() {
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon");
+        icon.addMouseListener(new MouseAdapter() {
+            public void mousePressed(MouseEvent event) {
+                icon.displayMessage("Sample Icon", "This is a test message for the tray icon", TrayIcon.MessageType.INFO);
+            }
+        });
+
+        try {
+            tray.add(icon);
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+
+        icon.getActionCommand();
+        icon.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                actionPerformedCount++;
+            }
+        });
+    }
+
+    void doTest() throws Exception {
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        // Do left click to start displaying the message
+        robot.delay(50);
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.delay(50);
+        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        robot.delay(1000);
+
+        // Do right click
+        robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
+        robot.delay(50);
+        robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);
+        robot.delay(50);
+
+        if (actionPerformedCount > 0)
+            throw new RuntimeException("FAIL: ActionEvent triggered when " +
+                    "the tray icon was right clicked and at the same time the tray icon message is displayed");
+    }
+}