From 89e241569b393b35b6d993097e3076dcd9c08ce9 Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Tue, 8 Jul 2014 16:01:18 +0400 Subject: [PATCH 01/94] 8043126: move awt automated functional tests from AWT_Events/Lw and AWT_Events/AWT to OpenJDK repository Reviewed-by: pchelko --- .../ExtendedModifiersTest.java | 271 +++++++ .../KeyEvent/KeyMaskTest/KeyMaskTest.java | 219 ++++++ .../MouseButtonsAndKeyMasksTest.java | 302 ++++++++ .../MouseButtonsTest/MouseButtonsTest.java | 254 ++++++ .../MultipleMouseButtonsTest.java | 237 ++++++ .../event/helpers/lwcomponents/LWButton.java | 418 ++++++++++ .../helpers/lwcomponents/LWComponent.java | 464 +++++++++++ .../event/helpers/lwcomponents/LWList.java | 726 ++++++++++++++++++ 8 files changed, 2891 insertions(+) create mode 100644 jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java create mode 100644 jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java create mode 100644 jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java create mode 100644 jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java create mode 100644 jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java create mode 100644 jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java create mode 100644 jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java create mode 100644 jdk/test/java/awt/event/helpers/lwcomponents/LWList.java diff --git a/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java b/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java new file mode 100644 index 00000000000..f6b00c4c1cf --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + + +/* + * @test + * @bug 8043126 + * @summary Check whether + * 1. correct extended modifiers are returned + * by KeyEvent.getModifiersEx() + * 2. InputEvent.getModifiersExText() returns + * correct extended modifier keys description + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 ExtendedModifiersTest + */ + + +import java.awt.*; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + + +public class ExtendedModifiersTest implements KeyListener { + + Frame frame; + + Button button; + LWButton buttonLW; + TextField textField; + TextArea textArea; + List list; + LWList listLW; + + private final ExtendedRobot robot; + private final static int robotDelay = 1000; + private final static int waitDelay = 5000; + private final static int keyDelay = 500; + + private final Object lock; + + private boolean keyPressedFlag = false; + + private int modifiersEx = 0; + private String exText = ""; + + + @Override + public void keyTyped(KeyEvent e) {} + + @Override + public void keyPressed(KeyEvent e) { + + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + return; + } + + modifiersEx = e.getModifiersEx(); + exText = InputEvent.getModifiersExText(modifiersEx); + keyPressedFlag = true; + + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void keyReleased(KeyEvent e) {} + + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("ExtendedModifiersTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addKeyListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addKeyListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addKeyListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addKeyListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addKeyListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addKeyListener(this); + frame.add(listLW); + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + public ExtendedModifiersTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + + private void runScenario(int keys[], int refMask) { + + if (keys.length < 1) { return; } + + for (int k = 0; k < keys.length; ++k) { + + keyPressedFlag = false; + robot.keyPress(keys[k]); + robot.delay(keyDelay); + + if (!keyPressedFlag) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + if (!keyPressedFlag) { + robot.keyRelease(keys[k]); + robot.delay(keyDelay); + assertTrue(false, "key press event was not received"); + } + } + + int modEx = modifiersEx & refMask; + + for (int k = keys.length - 1; k >=0; --k) { + robot.keyRelease(keys[k]); + robot.delay(keyDelay); + } + + + assertEQ(modifiersEx, modEx, "invalid extended modifiers"); + + for (int k = 0; k < keys.length; ++k) { + String keyText = KeyEvent.getKeyText(keys[k]).toLowerCase(); + assertTrue(exText.toLowerCase().contains(keyText), "invalid extended modifier keys description"); + } + + System.out.println(exText + " : passed"); + + robot.type(KeyEvent.VK_ESCAPE); + + robot.delay(robotDelay); + } + + private void doTest() throws Exception { + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + String OS = System.getProperty("os.name").toLowerCase(); + System.out.println(OS); + + for (Component c: components) { + + String className = c.getClass().getName(); + System.out.println("component class : " + className); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + // 1. shift + control + runScenario(new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}, + InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 2. alt + shift + control + runScenario(new int[]{KeyEvent.VK_ALT, KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}, + InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 3. shift + runScenario(new int[]{KeyEvent.VK_SHIFT}, + InputEvent.SHIFT_DOWN_MASK); + + // 4. alt + control + runScenario(new int[]{KeyEvent.VK_ALT, KeyEvent.VK_CONTROL}, + InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 5. shift + alt + runScenario(new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_ALT}, + InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK); + + + if (OS.contains("os x") || OS.contains("sunos")) { + // 6. meta + runScenario(new int[]{KeyEvent.VK_META}, InputEvent.META_DOWN_MASK); + + // 7. shift + ctrl + alt + meta + runScenario(new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META}, + InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.META_DOWN_MASK); + + // 8. meta + shift + ctrl + runScenario(new int[]{KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}, + InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 9. meta + shift + alt + runScenario(new int[]{KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_ALT}, + InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK); + + // 10. meta + ctrl + alt + runScenario(new int[]{KeyEvent.VK_META, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT}, + InputEvent.META_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK); + } + } + + robot.waitForIdle(); + frame.dispose(); + } + + public static void main(String[] args) throws Exception { + ExtendedModifiersTest test = new ExtendedModifiersTest(); + test.doTest(); + } +} + diff --git a/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java b/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java new file mode 100644 index 00000000000..3400444ebbd --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + + +/* + * @test + * @bug 8043126 + * @summary Check whether KeyEvent.getModifiers() returns correct modifiers + * when Ctrl, Alt or Shift keys are pressed. + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 KeyMaskTest + */ + + +import java.awt.*; +import java.awt.event.InputEvent; + +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + + + +public class KeyMaskTest extends KeyAdapter { + + Frame frame; + + Button button; + LWButton buttonLW; + TextField textField; + TextArea textArea; + List list; + LWList listLW; + + int buttonPressedNumber; + int buttonReleasedNumber; + + ExtendedRobot robot; + + private final static int robotDelay = 1500; + private final static int waitDelay = 3500; + + final Object lock; + + private boolean keyPressReceived = false; + private int keyCode = -1; + + KeyMaskTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("KeyMaskTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addKeyListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addKeyListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addKeyListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addKeyListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addKeyListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addKeyListener(this); + frame.add(listLW); + + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + @Override + public void keyPressed(KeyEvent e) { + + keyPressReceived = true; + + int code = e.getKeyCode(); + + assertEQ(code, keyCode, "wrong key code"); + + int mask = 0; + + if (code == KeyEvent.VK_SHIFT) { + mask = InputEvent.SHIFT_MASK; + } else if (code == KeyEvent.VK_CONTROL) { + mask = InputEvent.CTRL_MASK; + } else if (code == KeyEvent.VK_ALT) { + mask = InputEvent.ALT_MASK; + } else if (code == KeyEvent.VK_META) { + mask = InputEvent.META_MASK; + } + + int mod = e.getModifiers() & mask; + assertEQ(mod, mask, "invalid key mask"); + + synchronized (lock) { lock.notifyAll(); } + } + + + void doTest() throws Exception { + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + int keys[]; + String OS = System.getProperty("os.name").toLowerCase(); + System.out.println(OS); + if (OS.contains("os x") || OS.contains("sunos")) { + keys = new int[] {KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META}; + } else { + keys = new int[] {KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT}; + } + + for (Component c: components) { + + System.out.print(c.getClass().getName() + ": "); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + for (int k = 0; k < keys.length; ++k) { + + keyPressReceived = false; + + keyCode = keys[k]; + + robot.type(keyCode); + + robot.delay(robotDelay); + + if (!keyPressReceived) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException e) {} + } + } + + assertTrue(keyPressReceived, "key press event was not received"); + } + + System.out.println("passed"); + } + + robot.waitForIdle(); + frame.dispose(); + } + + + public static void main(String[] args) throws Exception { + + KeyMaskTest test = new KeyMaskTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java b/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java new file mode 100644 index 00000000000..850679c6d44 --- /dev/null +++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; + +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; + + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + + +/* + * @test + * @bug 8043126 + * @summary Check whether MouseEvent.getModifiers(), MouseEvent.getModifiersEx() + * and KeyEvent.getModifiers() return correct modifiers when pressing + * keys Ctrl, Alt, Shift, Meta and mouse buttons sequentially + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 MouseButtonsAndKeyMasksTest + */ + +public class MouseButtonsAndKeyMasksTest implements MouseListener, KeyListener { + + Frame frame; + + Button button; + LWButton buttonLW; + TextField textField; + TextArea textArea; + List list; + LWList listLW; + + ExtendedRobot robot; + + private final static int robotDelay = 1500; + private final static int keyDelay = 500; + private final static int waitDelay = 5000; + + int modMouse = 0, modMouseEx = 0, modKey = 0, modAction = 0; + + boolean mousePressFired = false; + boolean keyPressFired = false; + + final Object lock; + + MouseButtonsAndKeyMasksTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("MouseButtonsAndKeysTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addKeyListener(this); + button.addMouseListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addKeyListener(this); + buttonLW.addMouseListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addKeyListener(this); + textField.addMouseListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addKeyListener(this); + textArea.addMouseListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addKeyListener(this); + list.addMouseListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addKeyListener(this); + listLW.addMouseListener(this); + frame.add(listLW); + + + frame.setBackground(Color.gray); + frame.setSize(500, 80); + frame.setVisible(true); + frame.toFront(); + } + + + @Override + public void mouseClicked(MouseEvent e) {} + + @Override + public void mousePressed(MouseEvent e) { + + modMouse = e.getModifiers(); + modMouseEx = e.getModifiersEx(); + mousePressFired = true; + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void mouseReleased(MouseEvent e) {} + @Override + public void mouseEntered(MouseEvent e) {} + @Override + public void mouseExited(MouseEvent e) {} + + + @Override + public void keyTyped(KeyEvent e) {} + + @Override + public void keyPressed(KeyEvent e) { + + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { return; } + + keyPressFired = true; + modKey = e.getModifiers(); + + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void keyReleased(KeyEvent e) {} + + void doTest() throws Exception { + + int buttons[] = new int[]{ + InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, InputEvent.BUTTON3_MASK}; + + int buttonsEx[] = new int[]{ + InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, InputEvent.BUTTON3_DOWN_MASK}; + + String OS = System.getProperty("os.name").toLowerCase(); + System.out.println(OS); + + int keyMods[], keyModsEx[], keys[]; + + + if (OS.contains("linux")) { + keyMods = new int[]{InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK}; + keyModsEx = new int[]{InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}; + } else if (OS.contains("os x")) { + keyMods = new int[]{ + InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK, InputEvent.META_MASK}; + keyModsEx = new int[]{ + InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK, InputEvent.META_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META}; + } else if (OS.contains("sunos")) { + keyMods = new int[]{InputEvent.SHIFT_MASK, InputEvent.META_MASK}; + keyModsEx = new int[]{InputEvent.SHIFT_DOWN_MASK, InputEvent.META_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_META}; + } else { + keyMods = new int[]{ + InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK}; + keyModsEx = new int[]{ + InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT}; + } + + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + for (Component c: components) { + + System.out.println(c.getClass().getName() + ":"); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + for (int b = 0; b < buttons.length; ++b) { + + int btn = buttons[b]; + + for (int k = 0; k < keys.length; ++k) { + + int key = keys[k]; + + System.out.print(KeyEvent.getKeyText(key) + " + button " + (b + 1)); + + robot.delay(robotDelay); + + robot.keyPress(key); + robot.delay(keyDelay); + + if (!keyPressFired) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + if (!keyPressFired) { + robot.keyRelease(key); + assertTrue(false, "key press event was not received"); + } + + robot.mousePress(btn); + robot.delay(robotDelay); + + if (!mousePressFired) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(mousePressFired, "mouse press event was not received"); + + robot.mouseRelease(btn); + robot.delay(robotDelay); + + // do checks + assertEQ(modMouse & btn, btn, "invalid mouse button mask"); + assertEQ(modKey & keyMods[k], keyMods[k], "invalid key mask"); + assertEQ(buttonsEx[b] | keyModsEx[k], modMouseEx, "invalid extended modifiers"); + + mousePressFired = false; + keyPressFired = false; + + robot.keyRelease(key); + robot.delay(keyDelay); + + robot.type(KeyEvent.VK_ESCAPE); + + robot.delay(robotDelay); + + System.out.println(" - passed"); + } + } + } + + robot.waitForIdle(); + frame.dispose(); + } + + + public static void main(String[] args) throws Exception { + + MouseButtonsAndKeyMasksTest test = new MouseButtonsAndKeyMasksTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java b/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java new file mode 100644 index 00000000000..cc36b0c35b8 --- /dev/null +++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; + +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; + +/* + * @test + * @bug 8043126 + * @summary Check whether getButton() returns correct mouse button + * number when the mouse buttons are pressed and getModifiers() + * returns correct modifiers + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 MouseButtonsTest + */ + +public class MouseButtonsTest implements MouseListener { + + private Frame frame; + + private Button button; + private LWButton buttonLW; + private TextField textField; + private TextArea textArea; + private List list; + private LWList listLW; + + private int buttonPressedNumber = 0; + private int buttonReleasedNumber = 0; + private int modifiers = 0; + + + private final ExtendedRobot robot; + + private final static int robotDelay = 1000; + private final static int waitDelay = 3500; + + private boolean released = false; + private boolean pressed = false; + private final Object lock; + + + MouseButtonsTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("MouseButtonsTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addMouseListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addMouseListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addMouseListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addMouseListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addMouseListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addMouseListener(this); + frame.add(listLW); + + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + + @Override + public void mouseClicked(MouseEvent e) {} + + @Override + public void mousePressed(MouseEvent e) { + + assertFalse(e.getButton() == MouseEvent.NOBUTTON, "invalid button"); + + buttonPressedNumber = e.getButton(); + modifiers = e.getModifiers(); + + pressed = true; + + synchronized (lock) { + try { + lock.notifyAll(); + } catch (Exception ex) {} + } + } + + @Override + public void mouseReleased(MouseEvent e) { + + assertFalse(e.getButton() == MouseEvent.NOBUTTON, "invalid button"); + + buttonReleasedNumber = e.getButton(); + modifiers = e.getModifiers(); + + released = true; + + synchronized (lock) { + try { + lock.notifyAll(); + } catch (Exception ex) {} + } + } + + @Override + public void mouseEntered(MouseEvent e) {} + + @Override + public void mouseExited(MouseEvent e) {} + + + void doTest() throws Exception { + + int masks[] = new int[]{ + InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, InputEvent.BUTTON3_MASK}; + + int buttons[] = new int[]{ + MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3}; + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + for (Component c: components) { + + System.out.println(c.getClass().getName() + ":"); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + for (int i = 0; i < masks.length; ++i) { + + pressed = false; + released = false; + + int mask = masks[i]; + robot.mousePress(mask); + robot.delay(robotDelay); + + if (!pressed) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(pressed, "mouse press event was not received"); + assertEQ((modifiers & mask), mask, "invalid mask modifiers"); + + robot.mouseRelease(mask); + robot.delay(robotDelay); + + if (!released) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(released, "mouse release event was not received"); + assertEQ((modifiers & mask), mask, "invalid mask modifiers"); + + assertEquals(buttonPressedNumber, buttons[i]); + assertEquals(buttonReleasedNumber, buttons[i]); + + robot.type(KeyEvent.VK_ESCAPE); + robot.delay(robotDelay); + + System.out.println("button " + buttons[i] + " - passed"); + } + } + + robot.waitForIdle(); + frame.dispose(); + } + + + public static void main(String[] args) throws Exception { + + MouseButtonsTest test = new MouseButtonsTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java b/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java new file mode 100644 index 00000000000..df143b78c05 --- /dev/null +++ b/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; +import java.awt.event.*; +import java.util.ArrayList; + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + +import static jdk.testlibrary.Asserts.*; + +/* + * @test + * @bug 8043126 + * @summary Check whether correct modifiers set when multiple mouse buttons were pressed; + * check number of received events. + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 MultipleMouseButtonsTest + */ + + +public class MultipleMouseButtonsTest implements MouseListener { + + private final static int robotDelay = 1000; + + private final ExtendedRobot robot; + private final Object lock = new Object(); + + private Frame frame; + + private Button button; + private LWButton buttonLW; + private TextField textField; + private TextArea textArea; + private List list; + private LWList listLW; + + private int eventCount; + private int testCount; + private boolean pressed = false; + private int modifiers = 0; + private int modifiersEx = 0; + + private boolean countEvents = false; + + + public void createGUI() { + + frame = new Frame("MultipleMouseButtonTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addMouseListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addMouseListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addMouseListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addMouseListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addMouseListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addMouseListener(this); + frame.add(listLW); + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + @Override + public void mouseClicked(MouseEvent e) {} + @Override + public void mouseEntered(MouseEvent e) {} + @Override + public void mouseExited (MouseEvent e) {} + + @Override + public void mousePressed(MouseEvent e) { + + if (!countEvents) { return; } + + ++eventCount; + + pressed = true; + modifiers = e.getModifiers(); + modifiersEx = e.getModifiersEx(); + + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void mouseReleased(MouseEvent e) { + + if (countEvents) { + ++eventCount; + } + } + + MultipleMouseButtonsTest() throws Exception { + this.robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + void doTest() throws Exception { + + int masks[] = new int[]{InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, InputEvent.BUTTON3_MASK}; + int masksEx[] = new int[]{InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, InputEvent.BUTTON3_DOWN_MASK}; + + robot.waitForIdle(); + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + for (Component c: components) { + + System.out.println(c.getClass().getName() + ": "); + + Point origin = c.getLocationOnScreen(); + + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.mouseMove(origin); + robot.delay(robotDelay); + robot.glide(origin, center); + robot.delay(robotDelay); + robot.click(); + robot.delay(robotDelay); + + testCount = 0; + eventCount = 0; + + for (int i = 0; i < masks.length; ++i) { + + for (int k = 0; k < masks.length; ++k) { + if (k == i) { continue; } + + countEvents = false; + robot.mousePress(masks[i]); + robot.delay(robotDelay); + + countEvents = true; + + pressed = false; + + robot.mousePress(masks[k]); + robot.delay(robotDelay); + ++testCount; + + if (!pressed) { + synchronized (lock) { + try { + lock.wait(3 * robotDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(pressed, "mouse press event was not received"); + + assertEQ(modifiers & masks[k], masks[k], "invalid modifiers"); + assertEQ(modifiersEx & masksEx[i], masksEx[i], "invalid extended modifiers"); + + robot.mouseRelease(masks[k]); + robot.delay(robotDelay); + ++testCount; + + countEvents = false; + + robot.mouseRelease(masks[i]); + robot.delay(robotDelay); + + robot.type(KeyEvent.VK_ESCAPE); + robot.delay(robotDelay); + } //k + } //i + + assertEquals(testCount, eventCount, "different amount of sent and received events"); + System.out.println("passed"); + } //component + + robot.waitForIdle(); + frame.dispose(); + } + + public static void main(String[] args) throws Exception { + + MultipleMouseButtonsTest test = new MultipleMouseButtonsTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java b/jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java new file mode 100644 index 00000000000..866844e1ce7 --- /dev/null +++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java @@ -0,0 +1,418 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +package test.java.awt.event.helpers.lwcomponents; + +import java.awt.*; +import java.awt.event.*; + +/** + * Lightweight Button component with some nice features. This + * component provides the capabilities of Buttons, namely that you it + * displays a label string and, when clicked, causes the + * ActionListener method to be called.

+ * + * The look of the button is a little unusual. There are three + * rectangles drawn at the border that indicate various states + * of the button. These are (listed from outside in)

+ *

    + *
  1. Focus: Indicates that the LWButton has the focus. + *
  2. Mouse Over: Indicates that the mouse is over the component. + *
  3. Mouse Pressed: Indicates that the mouse has been pressed. + *
+ * + * In addition, when the button has been activated (mouse clicked or + * via keyboard activation) the button flashes briefly. + */ + +public class LWButton extends LWComponent { + + /* + * The button's Label. + * If Label is not specified it will default to "". + * @serial + * @see getLabel() + * @see setLabel() + */ + private String label; + private boolean isInClick = false; + + private static final String base = "LWButton"; + private static int nameCounter = 0; + + private transient ActionListener actionListener; + + /* + * The action to be performaed once a button has been + * pressed. + * actionCommand can be null. + * @serial + * @see getActionCommand() + * @see setActionCommand() + */ + String actionCommand; + + Color colMousePressed; + + public LWButton() { this(""); } + + public LWButton(String label) { + this(label, Color.red, Color.green, Color.white); + } + + /** + * Initialize the LWButton, fully specifying all parameters. + * @param label The string to display. + * @param fgnd The color to draw the label in. + * @param bkgnd The color of the button itself. + * @param mousePressed The Color of the MousePressed rectangle. + */ + public LWButton(String label, Color fgnd, Color bkgnd, Color mousePressed) { + super(); + this.label = label; + setBackground(fgnd); + setForeground(bkgnd); + colMousePressed = mousePressed; + setName(makeComponentName()); + + enableEvents( AWTEvent.MOUSE_EVENT_MASK + | AWTEvent.KEY_EVENT_MASK + | AWTEvent.ACTION_EVENT_MASK); + setEnabled(true); + } + + /** + * Make the component flash briefly. + */ + public void flash() { + isInClick = true; + repaint(); + + class unClicker implements Runnable { + @Override + public void run() { + try { Thread.sleep(100); } catch (InterruptedException ee) {} + isInClick = false; + repaint(); + } + } + try { + unClicker uc = new unClicker(); + new Thread(uc).start(); + } catch (Exception e) { + // In case we're in an applet and the security has not been + // turned off (in which case we can't start a new thread) + // we can catch that and set the flag back to how it should be. + isInClick = false; + repaint(); + } + } + + /** + * Set the MousePressed color (the color shown in the MousePressed rectangle + * when the mouse is over the component). + * @param c The color of the MousePressed rectangle. + */ + public void setMousePressedColor(Color c) { colMousePressed = c; } + + /** + * Get the MousePressed color. + * @return The color of the MousePressed rectangle. + */ + public Color getMousePressedColor() { return colMousePressed; } + + /** + * Used to dispatch out the ActionEvent for a corresponding InputEvent. + * @param e The InputEvent that is causing the ActionEvent dispatch. + */ + private void sendActionEvent(InputEvent e) { + + int modifiers = e.getModifiers(); + int aModifiers = 0; + + if ((modifiers & MouseEvent.SHIFT_MASK) != 0) { + aModifiers |= ActionEvent.SHIFT_MASK; + } + if ((modifiers & MouseEvent.CTRL_MASK) != 0) { + aModifiers |= ActionEvent.CTRL_MASK; + } + if ((modifiers & MouseEvent.META_MASK) != 0) { + aModifiers |= ActionEvent.META_MASK; + } + if ((modifiers & MouseEvent.ALT_MASK) != 0) { + aModifiers |= ActionEvent.ALT_MASK; + } + + ActionEvent ae = new ActionEvent(this, + ActionEvent.ACTION_PERFORMED, + actionCommand, + aModifiers); + // XXX: What's the right way to send out the ActionEvent? + // My assumption was to put it into the system event queue + // and the it will be dispatched back into processEvent + // for us. However this doesn't happen...? + if (actionListener != null) { + actionListener.actionPerformed(ae); + } + //Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae); + } + + /** + * Set whether the component is enabled ({@code true}) or not. + * @param enabled If {@code true}, the component is to be enabled. + */ + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + + if (enabled) { + enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } else { + disableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } + repaint(1); + } + + /** + * Indicates that LWButton component can receive focus. + * @return {@code true} if the LWButton component can receive focus + */ + @Override + public boolean isFocusTraversable() { return true; } + + /** + * Construct a name for this component. Called by getName() when the + * name is null. + */ + String makeComponentName() { + synchronized (getClass()) { + return base + nameCounter++; + } + } + + /** + * Handle painting the enabled version of the component. + * + * ASSUMES: g.color may be changed + */ + @Override + public void paint(Graphics g) { + + super.paint(g); + restrictGraphicsToClientArea(g); + + Dimension dim = getClientSize(); + + int s = Math.min(dim.width - 1, dim.height - 1); + + if (isInClick) { + g.setColor(Color.white); + } else { + g.setColor(getBackground()); + } + + // In jdk 1.2 (pre-release) there was a bug using clearRect + // to paint the background of a lightweight. + //g.clearRect(loc.x, loc.y, dim.width, dim.height); + g.fillRect(0, 0, dim.width, dim.height); + + if (mouseB1Pressed) { + g.setColor(colMousePressed); + //LWComponent.traceMsg("paint mousePressed " + this.toString()); + g.drawRect(1, 1, dim.width - 3, dim.height - 3); + } + + Font f = getFont(); + if (f != null) { + FontMetrics fm = getFontMetrics(f); + g.setColor(getForeground()); + g.drawString(label, + s/2 - fm.stringWidth(label)/2, + s/2 + fm.getMaxDescent()); + } + + unrestrictGraphicsFromClientArea(g); + } + + @Override + public Dimension getPreferredSize() { + Font f = getFont(); + if (f != null) { + FontMetrics fm = getFontMetrics(f); + int max = Math.max(fm.stringWidth(label) + 40, fm.getHeight() + 40); + return new Dimension(max, max); + } else { + return new Dimension(100, 100); + } + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + /** + * Get the text displayed in the LWButton. + * @return the text displayed in the LWButton + */ + public String getText() { return label; } + + /** + * Set the text displayed in the LWButton. + * @param s The text to be displayed. + */ + public void setText(String s) { + Font f = getFont(); + int oWidth = 0; + int oHeight = 0; + int nWidth = 0; + int nHeight = 0; + int invalidated = 0; + FontMetrics fm = null; + + if (f != null) { + fm = getFontMetrics(f); + oWidth = fm.stringWidth(label); + oHeight = fm.getHeight(); + } + + this.label = s; + + if (f != null) { + nWidth = fm.stringWidth(label); + nHeight = fm.getHeight(); + + if ((nWidth > oWidth) || (nHeight > oHeight)) { + invalidate(); + invalidated = 1; + } + } + + if (invalidated == 0) { + repaint(); + } + } + + /** + * Set the command name for the action event fired + * by this button. By default this action command is + * set to match the label of the button. + * @param command A string used to set the button's + * action command. + * If the string is null then the action command + * is set to match the label of the button. + * @see java.awt.event.ActionEvent + * @since JDK1.1 + */ + public void setActionCommand(String command) { + actionCommand = command; + } + + /** + * Returns the command name of the action event fired by this button. + * If the command name is {@code null} (default) then this method + * returns the label of the button. + * + * @return the command name of the action event fired by this button + * or the label of the button (in case of {@code null}) + */ + public String getActionCommand() { + return (actionCommand == null? label : actionCommand); + } + + /** + * Add the specified action listener to receive action events from + * this button. Action events occur when a user presses or releases + * the mouse over this button. + * @param l the action listener. + * @see java.awt.event.ActionListener + * @see #removeActionListener + * @since JDK1.1 + */ + public synchronized void addActionListener(ActionListener l) { + actionListener = AWTEventMulticaster.add(actionListener, l); + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + } + + /** + * Remove the specified action listener so that it no longer + * receives action events from this button. Action events occur + * when a user presses or releases the mouse over this button. + * @param l the action listener. + * @see java.awt.event.ActionListener + * @see #addActionListener + * @since JDK1.1 + */ + public synchronized void removeActionListener(ActionListener l) { + actionListener = AWTEventMulticaster.remove(actionListener, l); + } + + @Override + protected void processKeyEvent(KeyEvent e) { + super.processKeyEvent(e); + if (!isEnabled()) { return; } + switch(e.getID()) { + case KeyEvent.KEY_TYPED: + switch (e.getKeyCode()) { + case KeyEvent.VK_ENTER: + case KeyEvent.VK_SPACE: + flash(); + sendActionEvent(e); + break; + } + break; + } + } + + @Override + protected void processMouseEvent(MouseEvent e) { + super.processMouseEvent(e); + if (!isEnabled()) { return; } + switch(e.getID()) { + case MouseEvent.MOUSE_PRESSED: + requestFocus(); + repaint(); + break; + case MouseEvent.MOUSE_RELEASED: + repaint(); + break; + case MouseEvent.MOUSE_CLICKED: + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) { + flash(); + sendActionEvent(e); + } + break; + } + } + + /** + * Returns the parameter string representing the state of this + * button. This string is useful for debugging. + * @return the parameter string of this button. + */ + @Override + protected String paramString() { + return super.paramString() + ", label = " + label; + } + +} diff --git a/jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java b/jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java new file mode 100644 index 00000000000..2209d0c107a --- /dev/null +++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java @@ -0,0 +1,464 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +package test.java.awt.event.helpers.lwcomponents; + +import java.io.*; +import java.awt.*; +import java.awt.event.*; + +/** + * This is experimental - The idea is to subclass all the LW components + * from LWComponent to provide for some common capabilities. The main + * capability to be provided is the status rectangles as done for LWButton. + * In particular the Focus and MouseOver rectangles are generically + * useful, while other rectangles might be useful to other components.

+ * + * To implement that, here is the idea ... borrowed from Win32 ... Each + * of the LW components has both a client and non-client region. We + * call paintNC to paint the non-client region (Focus and MouseOver + * rectangles), and the subclass might be permitted to implement paintNC + * but for now they aren't.

+ * + * Then the paint{Enabled,Disabled} methods are called as appropriate. + * Note that paintDisabled is implemented in LWComponent to call paintEnabled + * then stipple over the top of it.

+ * + * So it is paintEnabled that the component should implement. This method + * needs to know the dimensions of the client area (getClientRegion?) and + * the Graphics needs to have it's clip region set appropriately.

+ * + * KVETCHING: Kvetch is a Yiddish word which means, basically, + * to complain very precisely. The LWComponent family tracks various pieces + * of information over time that are used to check closely for correct behavior + * in some circumstances. The method kvetch is where this code lives + * and is intended to check a broad range of conditions.

+ * + * To turn off specific kvetch's, one simply specifies a System property + * as in this table:

+ * + * + * + * + * + * + * + * + *
Property nameValueDiscussion
javasoft.awtsqe.lw.IGNORE_FOCUS_KVETCHtrue or falseSpecify whether the hasFocus kvetch is checked.

+ * + * XXX To implement - specifying colors. NCBackground, + * FocusRectColor, MouseOverColor are the threee colors. paintNC + * fills the NC region with NCBackground, and then pains the two + * colors as appropriate. There needs to be methods to get/specify + * these colors.

+ * + * XXX To implement - Specifying the component name and toString(). + * The subclass should only give the base class name, and a method + * in LWComponent should construct a name from that. For toString() + * there needs to be a small amount of infrastructure built.

+ */ + +public abstract class LWComponent extends Component { + + protected static Color ncBackgroundColor; + protected static Color focusColor; + protected static Color focusWrongColor; + protected static Color mouseOverColor; + + static { + ncBackgroundColor = Color.white; + focusColor = Color.black; + focusWrongColor = Color.magenta; + mouseOverColor = Color.blue; + } + + /** + * Flag indicating whether our records indicate that the component + * should have focus. + */ + protected boolean _shouldHaveFocus = false; + protected boolean _shouldBeShowing = false; + + protected boolean mouseB1Pressed = false; + protected boolean mouseB2Pressed = false; + protected boolean mouseB3Pressed = false; + protected boolean mouseInside = false; + + protected static boolean tracingOn = false; + protected static PrintStream traceOutput = null; + + // Uncommenting these lines turns on tracing for the package. + // static { + // tracingOn = true; + // traceOutput = System.err; + // } + + public LWComponent() { + enableEvents(AWTEvent.MOUSE_EVENT_MASK + /*| AWTEvent.MOUSE_MOTION_EVENT_MASK*/ + | AWTEvent.FOCUS_EVENT_MASK + | AWTEvent.COMPONENT_EVENT_MASK); + } + + /** + * Print out an error message. + * @param msg the message + */ + public static void errorMsg(String msg) { + System.err.println("ERROR: " + msg); + } + + /** + * Print out a tracing message + * @param msg the message + */ + public static void traceMsg(String msg) { + if (LWComponent.tracingOn) { + LWComponent.traceOutput.println(msg); + } + } + + ///////////////////////////////////////////// + /////// FLAGS FOR IGNORING KVETCH's ///////// + ///////////////////////////////////////////// + + static boolean bIgnFocus = false; + + static { + // Initialize the kvetch ignoring flags here. + String ignFocus = System.getProperty("javasoft.awtsqe.lw.IGNORE_FOCUS_KVETCH", + "false"); + bIgnFocus = ignFocus.trim().toLowerCase().equals("true"); + } + + /** + * Check the shoulds and return a string indicating which + * do not match the components actual state. + * + * @return the string indicating which do not match the components actual state + */ + public String kvetch() { + String ret = this.toString(); + boolean errors = false; + + if (!bIgnFocus) { + if (hasFocus()) { + if (!shouldHaveFocus()) { + ret += "\nERROR: hasFocus indicates we have Focus, when we shouldn't."; + errors = true; + } + } else { + if (shouldHaveFocus()) { + ret += "\nERROR: (see bug#4233658) hasFocus does not indicate we have Focus, when we should."; + errors = true; + } + } + } + + if (errors) { + return ret; + } else { + return null; + } + } + + /** + * Check the shoulds and return a string indicating which + * do not match the components actual state. Prints the output + * to the given PrintStream. + * @param out The PrintStream to print to. + */ + public void kvetch(PrintStream out) { + if (out != null) { + String s = kvetch(); + if (s != null) { + LWComponent.errorMsg(s); + } + } + } + + /** + * Turn on tracing for the LWComponent family. + * @param out the output stream + */ + public static void startTracing(PrintStream out) { + tracingOn = true; + traceOutput = out; + } + + /** + * Turn off tracing for the LWComponent family. + */ + public static void stopTracing() { tracingOn = false; traceOutput = null; } + + /** + * Indicate whether it is believed the component should have focus. + * @return {@code true} if the component should have focus + */ + public boolean shouldHaveFocus() { return _shouldHaveFocus; } + + /** + * Indicate whether it is believed the component should be showing. + * @return {@code true} if the component should be showing + */ + public boolean shouldBeShowing() { return _shouldBeShowing; } + + @Override + protected void processFocusEvent(FocusEvent e) { + super.processFocusEvent(e); + LWComponent.traceMsg("processFocusEvent " + e.toString()); + switch (e.getID()) { + case FocusEvent.FOCUS_GAINED: + _shouldHaveFocus = true; + repaint(); + break; + case FocusEvent.FOCUS_LOST: + _shouldHaveFocus = false; + repaint(); + break; + } + } + + @Override + protected void processComponentEvent(ComponentEvent e) { + super.processComponentEvent(e); + LWComponent.traceMsg("processComponentEvent " + e.toString()); + switch (e.getID()) { + case ComponentEvent.COMPONENT_MOVED: break; + case ComponentEvent.COMPONENT_RESIZED: break; + case ComponentEvent.COMPONENT_SHOWN: _shouldBeShowing = true; break; + case ComponentEvent.COMPONENT_HIDDEN: _shouldBeShowing = false; break; + } + } + + @Override + protected void processMouseEvent(MouseEvent e) { + int mod = e.getModifiers(); + super.processMouseEvent(e); + LWComponent.traceMsg("processMouseEvent " + e.toString()); + switch (e.getID()) { + case MouseEvent.MOUSE_PRESSED: + if ((mod & MouseEvent.BUTTON1_MASK) != 0) { + if (mouseB1Pressed) { + errorMsg("ERROR: MOUSE_PRESSED for B1 when already pressed, on " + + this.toString()); + } + mouseB1Pressed = true; + break; + } + if ((mod & MouseEvent.BUTTON2_MASK) != 0) { + if (mouseB2Pressed) { + errorMsg("ERROR: MOUSE_PRESSED for B2 when already pressed, on " + + this.toString()); + } + mouseB2Pressed = true; + break; + } + if ((mod & MouseEvent.BUTTON3_MASK) != 0) { + if (mouseB3Pressed) { + errorMsg("ERROR: MOUSE_PRESSED for B3 when already pressed, on " + + this.toString()); + } + mouseB3Pressed = true; + break; + } + repaint(); + break; + case MouseEvent.MOUSE_RELEASED: + if ((mod & MouseEvent.BUTTON1_MASK) != 0) { + if (!mouseB1Pressed) { + errorMsg("ERROR: MOUSE_RELEASED for B1 when not pressed, on " + + this.toString()); + } + mouseB1Pressed = false; + break; + } + if ((mod & MouseEvent.BUTTON2_MASK) != 0) { + if (!mouseB2Pressed) { + errorMsg("ERROR: MOUSE_RELEASED for B2 when not pressed, on " + + this.toString()); + } + mouseB2Pressed = false; + break; + } + if ((mod & MouseEvent.BUTTON3_MASK) != 0) { + if (!mouseB3Pressed) { + errorMsg("ERROR: MOUSE_RELEASED for B3 when not pressed, on " + + this.toString()); + } + mouseB3Pressed = false; + break; + } + repaint(); + break; + case MouseEvent.MOUSE_CLICKED: + break; + case MouseEvent.MOUSE_ENTERED: + if (mouseInside) { + errorMsg("ERROR: MOUSE_ENTERED when mouse already inside component, on " + + this.toString()); + } + mouseInside = true; + repaint(); + break; + case MouseEvent.MOUSE_EXITED: + if (!mouseInside) { + errorMsg("ERROR: MOUSE_EXITED when mouse not inside component, on " + + this.toString()); + } + mouseInside = false; + repaint(); + break; + case MouseEvent.MOUSE_MOVED: + break; + case MouseEvent.MOUSE_DRAGGED: + break; + } + } + + public Point getClientLocation() { + return new Point(5, 5); + } + + public Dimension getClientSize() { + Dimension dim = getSize(); + dim.width -= 10; + dim.height -= 10; + return dim; + } + + public Rectangle getClientBounds() { + Dimension dim = getClientSize(); + return new Rectangle(5, 5, dim.width, dim.height); + } + + public int getClientX() { return 5; } + public int getClientY() { return 5; } + + /** + * Set the color used for painting the non-client area of the component. + * The default for this is Color.white. + * + * @param c The new color to use. + */ + public void setNonClientColor(Color c) { + LWComponent.ncBackgroundColor = c; + } + + /** + * Handle painting for the component. + */ + @Override + public void paint(Graphics g) { + Dimension dim = getSize(); + + kvetch(System.err); + + Color saveColor = g.getColor(); + super.paint(g); + + // ------------------- Paint the background ----------------- + + // In jdk 1.2 (pre-release) there was a bug using clearRect + // to paint the background of a lightweight. + //g.clearRect(0, 0, dim.width, dim.height); + g.setColor(getBackground()); + g.fillRect(0, 0, dim.width, dim.height); + + // ------------------- Paint the non-client area ------------ + + g.setColor(ncBackgroundColor); + // x y width height + g.fillRect(0, 0, dim.width, 5); + g.fillRect(0, 5, 5, dim.height - 10); + g.fillRect(dim.width - 5, 5, 5, dim.height - 10); + g.fillRect(0, dim.height - 5, dim.width, 5); + + if (shouldHaveFocus() || hasFocus()) { + g.setColor(shouldHaveFocus() && hasFocus() + ? focusColor + : focusWrongColor); + g.drawRect(1, 1, dim.width - 3, dim.height - 3); + } + + if (mouseInside) { + g.setColor(mouseOverColor); + g.drawRect(3, 3, dim.width - 7, dim.height - 7); + } + + // ------------------- Paint disabledness, if true ----------- + + if (!isEnabled()) { + g.setColor(getBackground()); + Dimension size = getSize(); + int borderThickness = 0; + int startX = borderThickness; + int startY = borderThickness; + int endX = startX + size.width - 2 * borderThickness - 2; + int endY = startY + size.height - 2 * borderThickness - 2; + int x, y; + for (y = startY; y <= endY; y += 1) { + for (x = startX + (y % 2); x <= endX; x += 2) { + g.fillRect(x, y, 1, 1); + } // x + } // y + } + + g.setColor(saveColor); + } + + /** + * Restricts the Graphics to be within the "client area" of the + * component. Recall that the LWComponent series of components has + * a "non-client area" of 5 pixels wide in which it draws two + * status rectangles showing mouse-over and has-focus status.

+ * + * Child classes of LWComponent are to call {@code restrictGraphicsToClientArea} + * at the beginning of their {@code paint} method, and then call + * {@code unrestrictGraphicsFromClientArea} afterwards.

+ * + * In order to make those paint methods as convenient as possible, these + * two methods make it appear as if the Graphics available to the + * component is slightly smaller than it really is, by the amount + * used in the non-client area (5 pixel wide border).

+ * + * @param g The Graphics to restrict. + */ + public void restrictGraphicsToClientArea(Graphics g) { + Dimension dim = getSize(); + g.translate(5, 5); + g.setClip(0, 0, dim.width - 10, dim.height - 10); + } + + /** + * Undo the restriction done in restrictGraphicsToClientArea. + * + * @param g The Graphics to unrestrict. + */ + public void unrestrictGraphicsFromClientArea(Graphics g) { + g.translate(-5, -5); + Dimension dim = getSize(); + g.setClip(0, 0, dim.width, dim.height); + } + +} diff --git a/jdk/test/java/awt/event/helpers/lwcomponents/LWList.java b/jdk/test/java/awt/event/helpers/lwcomponents/LWList.java new file mode 100644 index 00000000000..d08a3141340 --- /dev/null +++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWList.java @@ -0,0 +1,726 @@ +/* + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +package test.java.awt.event.helpers.lwcomponents; + +import java.awt.*; +import java.awt.event.*; +import java.util.Vector; +import java.util.Enumeration; + +/** + * Remarks : Source for LightWeight component - List. + * + * Scroll bar support is not available for this component, so if the + * items exceeds visibility those items will be truncated. Also, here + * double buffering is not used so there will be little bit flickering + * while it repaints. Item listener support is not enabled in this + * component. Listeners handled were Mouse, Key and Focus. + * + * @author R.Govindarajan (govind@siptech.co.in), G.N.V.Sekhar (sekharv@siptech.co.in) + */ + +public class LWList extends LWComponent implements ItemSelectable { + + // Constants used for component size + private final int MIN_WIDTH = 100; + private final int MIN_HEIGHT = 100; + private final int PREF_WIDTH = 100; + private final int PREF_HEIGHT = 100; + + // Constants used for setting color for component + private final Color BACK_COLOR = Color.white; + private final Color FRONT_COLOR = Color.black; + private final Color BORDER_COLOR = Color.darkGray; + private final Color FOCUS_COLOR = Color.blue; + private final Color FOCUS_FORECOLOR = Color.white; + private final Color FOCUS_ENABLED_COLOR = Color.red; + private final int BORDER_WIDTH = 2; + + private Vector stringList; // List of items + private Vector selList; // List of selected items + private int rows; // Visible rows + private int focusIndex, prevfocusIndex; + private Dimension minSize; + private Dimension prefSize; + private boolean pressed, eventOccurred, focusEnabled; + private boolean multipleMode; + + // Listeners handled for this component + private ActionListener actionListener; + private KeyListener keyListener; + private FocusListener focusListener; + private ItemListener itemListener; + + private static int nameCounter = 0; + + /** + * Creates a new list. + */ + public LWList() { + this(0); + } + + /** + * Creates a new list with the specified number of rows; + * multiple selection mode is disabled. + * + * @param i the number of rows + */ + public LWList(int i) { + this(i, false); + } + + /** + * Creates a new list with the specified number of rows and multiple selection mode. + * + * @param rows the number of rows + * @param flag determines whether the list allows multiple selections + */ + public LWList(int rows, boolean flag) { + multipleMode = flag; + this.rows = rows; + minSize = new Dimension(MIN_WIDTH, MIN_HEIGHT); + prefSize = new Dimension(PREF_WIDTH, PREF_HEIGHT); + stringList = new Vector(); + selList = new Vector(); + selList.addElement(0); + focusIndex = -1; + prevfocusIndex = focusIndex; + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + enableEvents(AWTEvent.KEY_EVENT_MASK); + enableEvents(AWTEvent.FOCUS_EVENT_MASK); + enableEvents(AWTEvent.ITEM_EVENT_MASK); + setName(makeComponentName()); // set the name to the component + } + + String makeComponentName() { + String s = "LWList" + nameCounter++; + return s; + } + + /** + * Set whether the component is enabled or not. + * @param enabled if {@code true}, the component is to be enabled + */ + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + + if (enabled) { + enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } else { + disableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } + repaint(1); + } + + /** + * Set the selection mode. + * + * @param flag determines whether the list allows multiple selections + */ + public void setSelectionMode(boolean flag) { + multipleMode = flag; + } + + /** + * Check if the list allows multiple selections. + * + * @return {@code true} if the list allows multiple selections + */ + public boolean isMultipleMode() { + return multipleMode; + } + + /** + * Add the specified item. + * + * @param listItem the item + */ + public void add(String listItem) { + stringList.addElement(listItem); + invalidate(); + repaint(); + } + + /** + * Get minimum dimension for the list. + * + * @return the minimum dimensions for displaying + */ + @Override + public Dimension getMinimumSize() { + return minSize; + } + + /** + * Get the preferred size of the list. + * + * @return the preferred dimensions for displaying + */ + @Override + public Dimension getPreferredSize() { + return prefSize; + } + + /** + * Get the background color for the component. + * + * @return the background color for the component + */ + @Override + public Color getBackground() { + return BACK_COLOR; + } + + /** + * Get the foreground color for the component. + * + * @return the foreground color for the component + */ + @Override + public Color getForeground() { + return FRONT_COLOR; + } + + /** + * Get the border color for the component. + * + * @return the border color for the component + */ + public Color getBorder() { + return BORDER_COLOR; + } + + /** + * Get background color for the selected item. + * + * @return the color for the selected item + */ + public Color getFocusColor() { + return FOCUS_COLOR; + } + + /** + * Get foreground color for the selected item. + * + * @return the foreground color for the selected item + */ + public Color getFocusForeColor() { + return FOCUS_FORECOLOR; + } + + /** + * Get a "focus enabled" color - a small rectangle around the item + * should be drawn when the component got the focus. + * + * @return the "focus enabled" color + */ + public Color getFocusEnabledColor() { + return FOCUS_ENABLED_COLOR; + } + + /** + * Get border width. + * + * @return the border width + */ + public int getBorderWidth() { + return BORDER_WIDTH; + } + + /** + * Get the list item count. + * + * @return the count of items + */ + public int getItemCount() { + return stringList.size(); + } + + /** + * Get the specified item from the list. + * + * @param index the index + * @return the item string + */ + public String getItem(int index) { + return (String)stringList.elementAt(index); + } + + /** + * Get array of items from the list. + * + * @return the array of item strings + */ + public String[] getItems() { + String str[] = new String[getItemCount()]; + int count = 0; + for (Enumeration e = stringList.elements(); e.hasMoreElements(); ) { + str[count++] = (String)e.nextElement(); + } + return str; + } + + /** + * Check whether the component can be a focus owner (explicitly enabled here). + * + * @return {@code true} if the component is focusable + */ + @Override + public boolean isFocusTraversable() { + return true; + } + + /** + * Check whether mouse click point lies within the list of items. + * + * @param pt the click point + * @return {@code true} if the click point lies within the list of items + */ + @Override + public boolean contains(Point pt) { + Rectangle rect = new Rectangle(); + Dimension d = getSize(); + rect.x = getBorderWidth(); + rect.y = getBorderWidth(); + rect.width = d.width - (getBorderWidth() * 2); + rect.height = d.height - (getBorderWidth() * 2); + return rect.contains(pt); + } + + /** + * Given a click point the item that has to be selected is found from the list + * and focusIndex variable is set accordingly. + * + * @param pt the click point + */ + private void findSelectedIndex(Point pt) { + Font f = getFont(); + FontMetrics fm = getFontMetrics(f); + focusIndex = pt.y / fm.getHeight() - 1; + if (multipleMode) { + Integer fi = focusIndex; + if (selList.contains(fi)) { + int i = selList.indexOf(fi); + selList.removeElementAt(i); + } else { + selList.addElement(fi); + } + } + } + + /** + * Set index of the selected item. + * + * @param index the index + */ + public void setSelectedIndex(int index) { + prevfocusIndex = focusIndex; + focusIndex = index; + } + + /** + * Get the selected item index. + * + * @return the selected item index. + */ + public int getSelectedIndex() { + return focusIndex; + } + + /** + * Get an array of the selected Objects. + * + * @return array of the Objects + */ + @Override + public Object[] getSelectedObjects() { + int ai[] = getSelectedIndexes(); + Object aobj[] = new Object[selList.size()]; + for (int i = 0; i < selList.size(); i++) { + aobj[i] = stringList.elementAt(ai[i]); + } + return aobj; + } + + /** + * Get an array of the selected item indices. + * + * @return the array of the indices + */ + public int[] getSelectedIndexes() { + int ai[] = new int[selList.size()]; + for (int i = 0; i < selList.size(); i++) { + ai[i] = ((Integer)selList.elementAt(i)); + } + return ai; + } + + /** + * Add the specified item listener to receive item events from the list. + * + * @param itemlistener the item listener + */ + @Override + public synchronized void addItemListener(ItemListener itemlistener) { + itemListener = AWTEventMulticaster.add(itemListener, itemlistener); + enableEvents(AWTEvent.ITEM_EVENT_MASK); + } + + /** + * Remove the specified item listener so + * that it no longer receives item events from this list. + * + * @param itemlistener the item listener + */ + @Override + public synchronized void removeItemListener(ItemListener itemlistener) { + itemListener = AWTEventMulticaster.remove(itemListener, itemlistener); + } + + /** + * Add the specified action listener to receive action events from this list. + * + * @param listener the action listener + */ + public synchronized void addActionListener(ActionListener listener) { + actionListener = AWTEventMulticaster.add(actionListener, listener); + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + } + + /** + * Remove the specified action listener so + * that it no longer receives action events from this list. + * + * @param listener the action listener + */ + public synchronized void removeActionListener(ActionListener listener) { + actionListener = AWTEventMulticaster.remove(actionListener, listener); + } + + /** + * Add the specified key listener to receive key events from this component. + * + * @param listener the key listener + */ + @Override + public synchronized void addKeyListener(KeyListener listener) { + keyListener = AWTEventMulticaster.add(keyListener, listener); + enableEvents(AWTEvent.KEY_EVENT_MASK); + } + + /** + * Remove the specified key listener so + * that it no longer receives key events from this component. + * + * @param listener the key listener + */ + @Override + public synchronized void removeKeyListener(KeyListener listener) { + keyListener = AWTEventMulticaster.remove(keyListener, listener); + } + + /** + * Add the specified focus listener to receive focus events + * from this component when it gains input focus. + * + * @param listener the focus listener + */ + @Override + public synchronized void addFocusListener(FocusListener listener) { + focusListener = AWTEventMulticaster.add(focusListener, listener); + enableEvents(AWTEvent.FOCUS_EVENT_MASK); + } + + /** + * Remove the specified focus listener so + * that it no longer receives focus events from this component. + * + * @param listener the focus listener + */ + @Override + public synchronized void removeFocusListener(FocusListener listener) { + focusListener = AWTEventMulticaster.remove(focusListener, listener); + } + + @Override + protected void processEvent(AWTEvent awtevent) { + + if (awtevent instanceof FocusEvent) { + processFocusEvent((FocusEvent)awtevent); + } else if (awtevent instanceof ItemEvent) { + processItemEvent((ItemEvent)awtevent); + } else if (awtevent instanceof KeyEvent) { + processKeyEvent((KeyEvent)awtevent); + } else if (awtevent instanceof MouseEvent) { + switch (awtevent.getID()) { + case MouseEvent.MOUSE_CLICKED: + case MouseEvent.MOUSE_PRESSED: + case MouseEvent.MOUSE_RELEASED: + case MouseEvent.MOUSE_ENTERED: + case MouseEvent.MOUSE_EXITED: + processMouseEvent((MouseEvent)awtevent); + break; + + case MouseEvent.MOUSE_MOVED: + case MouseEvent.MOUSE_DRAGGED: + super.processEvent((MouseEvent)awtevent); + break; + } + } else { + if (awtevent instanceof ComponentEvent) + super.processComponentEvent((ComponentEvent)awtevent); + else + super.processEvent(awtevent); + } + } + + protected void processItemEvent(ItemEvent itemevent) { + if (itemListener != null) { + itemListener.itemStateChanged(itemevent); + } + } + + @Override + protected void processFocusEvent(FocusEvent e) { + switch (e.getID()) { + case FocusEvent.FOCUS_GAINED: + if (focusListener != null) { focusListener.focusGained(e); } + if (getSelectedIndex() == -1) { setSelectedIndex(0); } + focusEnabled = true; + repaint(); + break; + case FocusEvent.FOCUS_LOST: + if (focusListener != null) { + focusListener.focusLost(e); + } + focusEnabled = false; + repaint(); + break; + } + super.processFocusEvent(e); + } + + @Override + protected void processKeyEvent(KeyEvent e) { + rows = getItemCount(); + + switch (e.getID()) { + + case KeyEvent.KEY_TYPED: + if (keyListener != null) { + keyListener.keyTyped(e); + } + break; + + case KeyEvent.KEY_PRESSED: + if (keyListener != null) { + keyListener.keyPressed(e); + } + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + prevfocusIndex = focusIndex; + int index = getSelectedIndex() + 1; + if (index > rows) { break; } + setSelectedIndex(index); + processItemEvent(new ItemEvent(this, 0, index, 0)); + eventOccurred = true; + repaint(); + } else if (e.getKeyCode() == KeyEvent.VK_UP) { + int index = getSelectedIndex()-1; + if (index >= 0) { + setSelectedIndex(index); + if (e.getID() != 400) { + processItemEvent(new ItemEvent(this, 0, index, 0)); + } + eventOccurred = true; + repaint(); + } + } + break; + + case KeyEvent.KEY_RELEASED: + if (keyListener != null) { + keyListener.keyReleased(e); + } + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + eventOccurred = true; + + // ActionEvent is fired here + if (actionListener != null) { + actionListener.actionPerformed( new ActionEvent( + this, ActionEvent.ACTION_PERFORMED, null)); + } + repaint(); + } + break; + } // switch + super.processKeyEvent(e); + } + + @Override + protected void processMouseEvent(MouseEvent e) { + switch (e.getID()) { + case MouseEvent.MOUSE_PRESSED: + pressed = true; + if (contains(e.getPoint())) { + findSelectedIndex(e.getPoint()); + processItemEvent(new ItemEvent(this, 0, focusIndex, 0)); + eventOccurred = true; + } + repaint(); + break; + + case MouseEvent.MOUSE_RELEASED: + if (pressed) { requestFocus(); } + + if (contains(e.getPoint())) { + findSelectedIndex(e.getPoint()); + eventOccurred = true; + } + // ActionEvent is fired here + if (actionListener != null) { + actionListener.actionPerformed(new ActionEvent( + this, ActionEvent.ACTION_PERFORMED, null)); + } + + if (pressed) { + pressed = false; + repaint(); + } + break; + } + super.processMouseEvent(e); + } + + @Override + /** + * Paint the list. + * + * @param g the graphics context to be used for testing + */ + public void paint(Graphics g) { + super.paint(g); + restrictGraphicsToClientArea(g); + + Point loc = getClientLocation(); + Dimension dim = getClientSize(); + Color prevColor = g.getColor(); + + // List border is drawn here + g.setColor(getBackground()); + g.fillRect(0, 0, dim.width - 2, dim.height - 2); + g.setColor(getBorder()); + g.drawRect(0, 0, dim.width - 2, dim.height - 2); + + if (getItemCount() > 0) { + Font f = getFont(); + if (f != null) { + String str[] = getItems(); + FontMetrics fm = getFontMetrics(f); + int drawRow = loc.x + getBorderWidth() + fm.getAscent(); + int drawCol = loc.y + getBorderWidth(); + int rectRow = loc.y + getBorderWidth(); + int i = 0; + + // Draw items (if the items exceeds visibility those items will be truncated + // as scrollbar support is not enabled + + for (; + i < str.length && drawRow < (dim.height - getBorderWidth()); + i++) { + if (fm.stringWidth(str[i]) < (dim.width - (getBorderWidth() * 2))) { + drawItem(g, i, drawCol, drawRow, rectRow, fm); + drawRow += fm.getHeight(); + rectRow += fm.getHeight(); + } else { + LWComponent.errorMsg("string width exceeds list width"); + LWComponent.errorMsg("Horizontal scrollbar support is not available"); + } + } // for + + if ( (drawRow > (dim.height - getBorderWidth())) && (str.length > i) ) { + //LWComponent.errorMsg("no of strings exceeds list height"); + //LWComponent.errorMsg("Vertical scrollbar support is not available"); + } + } else { LWComponent.errorMsg("Font not available.."); } + } + + eventOccurred = false; + g.setColor(prevColor); + unrestrictGraphicsFromClientArea(g); + } + + // Draw String items + private void drawItem(Graphics g, int listIndex, int drawCol, + int drawRow, int rectRow, FontMetrics fm) { + Point loc = getClientLocation(); + Dimension dim = getClientSize(); + String str = getItem(listIndex); + if (multipleMode) { + for (int i1 = 0; i1 < selList.size(); i1++) { + if (listIndex == ((Integer)selList.elementAt(i1))) { + g.setColor(getFocusColor()); + g.fillRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + g.setColor(getFocusEnabledColor()); + g.drawRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + } + } // for + } else { + if (listIndex == getSelectedIndex() && !multipleMode) { + g.setColor(getFocusColor()); + g.fillRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + g.setColor(getFocusForeColor()); + } + if ((listIndex == prevfocusIndex) && (prevfocusIndex != getSelectedIndex()) && !multipleMode) { + g.setColor(getBackground()); + g.fillRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + prevfocusIndex = getSelectedIndex(); + } + if (focusEnabled && listIndex == getSelectedIndex() && !multipleMode) { + g.setColor(getFocusEnabledColor()); + g.drawRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + } + } + g.setColor(getForeground()); + g.drawString(str,drawCol,drawRow); + } + +} + From 021ffcfbdf66a374cf51c27d690ee50e46ed768e Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 8 Jul 2014 16:42:23 +0400 Subject: [PATCH 02/94] 8047066: Test test/sun/awt/image/bug8038000.java fails with ClassCastException Reviewed-by: bae, prr --- .../share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java | 3 ++- jdk/test/sun/awt/image/bug8038000.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java index 1bcb05ccbb7..06f4ea6d99b 100644 --- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java +++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java @@ -384,7 +384,8 @@ class LCMSImageLayout { } public static LCMSImageLayout createImageLayout(Raster r) { LCMSImageLayout l = new LCMSImageLayout(); - if (r instanceof ByteComponentRaster) { + if (r instanceof ByteComponentRaster && + r.getSampleModel() instanceof ComponentSampleModel) { ByteComponentRaster br = (ByteComponentRaster)r; ComponentSampleModel csm = (ComponentSampleModel)r.getSampleModel(); diff --git a/jdk/test/sun/awt/image/bug8038000.java b/jdk/test/sun/awt/image/bug8038000.java index 2bfdc27d2b7..20affe806c2 100644 --- a/jdk/test/sun/awt/image/bug8038000.java +++ b/jdk/test/sun/awt/image/bug8038000.java @@ -23,11 +23,13 @@ /** * @test - * @bug 8038000 + * @bug 8038000 8047066 * * @summary Verifies that we could create different type of Rasters with height 1 * and strideline which exceeds raster width. * Also checks that a set of RasterOp work correctly with such kind of Rasters. + * For 8047066 verifies that ColorConvertOp could process + * Raster (ByteBuffer + SinglePixelPackedSampleModel) * * @run main bug8038000 */ From b8db13175e4a9fcf183b450a9f22b9f3a344339a Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Tue, 8 Jul 2014 09:19:29 -0700 Subject: [PATCH 03/94] 8047025: Fix raw and unchecked lint warnings in generated nimbus files Reviewed-by: henryjen, prr --- .../javax/swing/plaf/nimbus/Defaults.template | 14 ++++++++------ .../javax/swing/plaf/nimbus/StateImpl.template | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template index ee10c49bc47..8a27e35b208 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template @@ -398,7 +398,7 @@ ${UI_DEFAULT_INIT} @Override public Object createValue(UIDefaults table) { try { - Class c; + Class c; Object cl; // See if we should use a separate ClassLoader if (table == null || !((cl = table.get("ClassLoader")) @@ -412,7 +412,7 @@ ${UI_DEFAULT_INIT} } c = Class.forName(className, true, (ClassLoader)cl); - Constructor constructor = c.getConstructor( + Constructor constructor = c.getConstructor( AbstractRegionPainter.PaintContext.class, int.class); if (constructor == null) { throw new NullPointerException( @@ -564,7 +564,7 @@ ${UI_DEFAULT_INIT} //if c is not named, and parts[partIndex] has an expected class //type registered, then check to make sure c is of the //right type; - Class clazz = parts[partIndex].c; + Class clazz = parts[partIndex].c; if (clazz != null && clazz.isAssignableFrom(c.getClass())) { //so far so good, recurse return matches(c.getParent(), partIndex - 1); @@ -636,7 +636,7 @@ ${UI_DEFAULT_INIT} private String s; //true if this part represents a component name private boolean named; - private Class c; + private Class c; Part(String s) { named = s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"'; @@ -816,7 +816,7 @@ ${UI_DEFAULT_INIT} private static final class PainterBorder implements Border, UIResource { private Insets insets; - private Painter painter; + private Painter painter; private String painterKey; PainterBorder(String painterKey, Insets insets) { @@ -827,7 +827,9 @@ ${UI_DEFAULT_INIT} @Override public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (painter == null) { - painter = (Painter)UIManager.get(painterKey); + @SuppressWarnings("unchecked") + Painter temp = (Painter)UIManager.get(painterKey); + painter = temp; if (painter == null) return; } diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template b/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template index 3323ab15581..dfff2ea59f5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template @@ -28,7 +28,7 @@ import java.awt.*; import javax.swing.*; -class ${STATE_NAME} extends State { +class ${STATE_NAME} extends State { ${STATE_NAME}() { super("${STATE_KEY}"); } From 2a84acf3dd07edc3fcb3de12a4072f958926a0ca Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Wed, 9 Jul 2014 12:56:03 +0400 Subject: [PATCH 04/94] 8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2 Reviewed-by: pchelko --- .../FocusTransferDWFAppModalTest.java | 49 ++++ .../FocusTransferDWFDocModalTest.java | 49 ++++ .../FocusTransferDWFModelessTest.java | 49 ++++ .../FocusTransferDWFNonModalTest.java | 48 ++++ .../FocusTransferDWFTest.java | 186 ++++++++++++ .../FocusTransferDialogsAppModalTest.java | 50 ++++ .../FocusTransferDialogsDocModalTest.java | 50 ++++ .../FocusTransferDialogsModelessTest.java | 50 ++++ .../FocusTransferDialogsNonModalTest.java | 49 ++++ .../FocusTransferDialogsTest.java | 193 +++++++++++++ .../FocusTransferFDWAppModalTest.java | 49 ++++ .../FocusTransferFDWDocModalTest.java | 49 ++++ .../FocusTransferFDWModelessTest.java | 49 ++++ .../FocusTransferFDWNonModalTest.java | 48 ++++ .../FocusTransferFDWTest.java | 152 ++++++++++ .../FocusTransferFWDAppModal1Test.java | 50 ++++ .../FocusTransferFWDAppModal2Test.java | 50 ++++ .../FocusTransferFWDAppModal3Test.java | 50 ++++ .../FocusTransferFWDAppModal4Test.java | 50 ++++ .../FocusTransferFWDDocModal1Test.java | 50 ++++ .../FocusTransferFWDDocModal2Test.java | 50 ++++ .../FocusTransferFWDDocModal3Test.java | 50 ++++ .../FocusTransferFWDDocModal4Test.java | 50 ++++ .../FocusTransferFWDModeless1Test.java | 50 ++++ .../FocusTransferFWDModeless2Test.java | 50 ++++ .../FocusTransferFWDModeless3Test.java | 50 ++++ .../FocusTransferFWDModeless4Test.java | 50 ++++ .../FocusTransferFWDNonModal1Test.java | 49 ++++ .../FocusTransferFWDNonModal2Test.java | 49 ++++ .../FocusTransferFWDNonModal3Test.java | 49 ++++ .../FocusTransferFWDNonModal4Test.java | 49 ++++ .../FocusTransferFWDTest.java | 201 +++++++++++++ .../FocusTransferWDFAppModal1Test.java | 51 ++++ .../FocusTransferWDFAppModal2Test.java | 52 ++++ .../FocusTransferWDFAppModal3Test.java | 52 ++++ .../FocusTransferWDFDocModal1Test.java | 51 ++++ .../FocusTransferWDFDocModal2Test.java | 52 ++++ .../FocusTransferWDFDocModal3Test.java | 51 ++++ .../FocusTransferWDFModeless1Test.java | 51 ++++ .../FocusTransferWDFModeless2Test.java | 52 ++++ .../FocusTransferWDFModeless3Test.java | 51 ++++ .../FocusTransferWDFNonModal1Test.java | 51 ++++ .../FocusTransferWDFNonModal2Test.java | 52 ++++ .../FocusTransferWDFNonModal3Test.java | 51 ++++ .../FocusTransferWDFTest.java | 272 ++++++++++++++++++ .../ModalitySettingsTest.java | 139 +++++++++ .../NullModalityDialogTest.java | 161 +++++++++++ .../java/awt/Modal/helpers/TestDialog.java | 38 ++- .../java/awt/Modal/helpers/TestFrame.java | 60 ++-- .../java/awt/Modal/helpers/TestWindow.java | 42 ++- 50 files changed, 3390 insertions(+), 56 deletions(-) create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java create mode 100644 jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java create mode 100644 jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java new file mode 100644 index 00000000000..20f15fbe4de --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when the following + * happens: an application modal dialog (D) having null frame owner is shown; + * a window having D as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFAppModalTest + */ + +public class FocusTransferDWFAppModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest( + Dialog.ModalityType.APPLICATION_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java new file mode 100644 index 00000000000..bb70a4fc090 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the + * following happens: a document modal dialog (D) having null frame owner is shown; + * a window having D as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFDocModalTest + */ + +public class FocusTransferDWFDocModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest( + Dialog.ModalityType.DOCUMENT_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java new file mode 100644 index 00000000000..eb2ca1ecd08 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the + * following happens: a modeless dialog (D) having null frame owner is shown; + * a window having D as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFModelessTest + */ + +public class FocusTransferDWFModelessTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest( + Dialog.ModalityType.MODELESS); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java new file mode 100644 index 00000000000..697c5c3d409 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following + * happens: a non-modal dialog (D) having null frame owner is shown; a window having D + * as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFNonModalTest + */ + +public class FocusTransferDWFNonModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest(null); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java new file mode 100644 index 00000000000..c6097b74b92 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; + +import static jdk.testlibrary.Asserts.*; + +// DWF: Dialog -> Window -> Frame +public class FocusTransferDWFTest { + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (window != null) { + window.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomFrame extends TestFrame { + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Dialog d) { + super(d); + } + + @Override + public void doOpenAction() { + if (frame != null) { + frame.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private Dialog.ModalityType modalityType; + + FocusTransferDWFTest(Dialog.ModalityType modType) throws Exception { + + modalityType = modType; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + + dialog = new CustomDialog((Frame) null); + if (modalityType == null) { + modalityType = Dialog.ModalityType.MODELESS; + } else { + dialog.setModalityType(modalityType); + } + dialog.setLocation(250, 50); + + window = new CustomWindow(dialog); + window.setLocation(450, 50); + dialog.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + dialog.checkCloseButtonFocusGained(true); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + window.clickOpenButton(robot); + robot.waitForIdle(delay); + + switch (modalityType) { + case APPLICATION_MODAL: + frame.checkCloseButtonFocusGained(false, 10); + window.checkOpenButtonFocusLost(false, 10); + + frame.closeGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + frame.checkCloseButtonFocusGained(true); + assertFalse(window.isVisible(), "window shouldn't be visible"); + + break; + + case DOCUMENT_MODAL: + case MODELESS: + frame.checkCloseButtonFocusGained(true); + window.checkOpenButtonFocusLost(true); + + window.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(true); + + dialog.openGained.reset(); + window.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog.checkOpenButtonFocusGained(true); + + break; + } + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java new file mode 100644 index 00000000000..900c3889786 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: an application modal dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsAppModalTest + */ + +public class FocusTransferDialogsAppModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest( + Dialog.ModalityType.APPLICATION_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java new file mode 100644 index 00000000000..62e04584dc6 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a document modal dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsDocModalTest + */ + +public class FocusTransferDialogsDocModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest( + Dialog.ModalityType.DOCUMENT_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java new file mode 100644 index 00000000000..2215b5a9b36 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a modeless dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsModelessTest + */ + +public class FocusTransferDialogsModelessTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest( + Dialog.ModalityType.MODELESS); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java new file mode 100644 index 00000000000..dc87c0f4268 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a non-modal dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsNonModalTest + */ + +public class FocusTransferDialogsNonModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest(null); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java new file mode 100644 index 00000000000..322dd6b94d4 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; + + +public class FocusTransferDialogsTest { + + class CustomDialog1 extends TestDialog { + + public CustomDialog1(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (dialog2 != null) { + dialog2.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog2 extends TestDialog { + + public CustomDialog2(Dialog d) { + super(d); + } + + @Override + public void doOpenAction() { + if (dialog3 != null) { + dialog3.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog3 extends TestDialog { + + public CustomDialog3(Frame f) { + super(f); + } + + public CustomDialog3(Dialog d) { + super(d); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + + private TestDialog dialog1, dialog2, dialog3; + private Frame parentFrame; + + private static final int delay = 1000; + private final ExtendedRobot robot; + private Dialog.ModalityType modalityType; + + FocusTransferDialogsTest(Dialog.ModalityType modType) throws Exception { + + modalityType = modType; + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + dialog1 = new CustomDialog1((Frame) null); + dialog1.setTitle("Dialog1"); + dialog1.setLocation(50, 50); + + if (modalityType != null) { + dialog1.setModalityType(modalityType); + } else { + modalityType = Dialog.ModalityType.MODELESS; + } + + dialog2 = new CustomDialog2(dialog1); + dialog2.setTitle("Dialog2"); + dialog2.setLocation(250, 50); + + parentFrame = new Frame(); + dialog3 = new CustomDialog3(parentFrame); + dialog3.setTitle("Dialog3"); + dialog3.setLocation(450, 50); + + dialog1.setVisible(true); + } + + private void closeAll() { + if (dialog1 != null) { dialog1.dispose(); } + if (dialog2 != null) { dialog2.dispose(); } + if (dialog3 != null) { dialog3.dispose(); } + if (parentFrame != null) { parentFrame.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + dialog1.checkCloseButtonFocusGained(true); + + dialog1.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog2.checkCloseButtonFocusGained(true); + dialog1.checkOpenButtonFocusLost(true); + + dialog1.openGained.reset(); + dialog2.clickOpenButton(robot); + robot.waitForIdle(delay); + + switch (modalityType) { + case APPLICATION_MODAL: + + dialog3.checkCloseButtonFocusGained(false, 10); + dialog2.checkOpenButtonFocusLost(true); + + dialog1.checkCloseButtonFocusGained(true); + dialog3.closeGained.reset(); + + dialog1.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog3.checkCloseButtonFocusGained(true); + + break; + + case DOCUMENT_MODAL: + case MODELESS: + + dialog3.checkCloseButtonFocusGained(true); + dialog2.checkOpenButtonFocusLost(true); + + dialog1.openGained.reset(); + + dialog2.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog1.checkOpenButtonFocusGained(true); + + break; + } + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java new file mode 100644 index 00000000000..f3fc961d460 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; an application modal dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWAppModalTest + */ + +public class FocusTransferFDWAppModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest( + Dialog.ModalityType.APPLICATION_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java new file mode 100644 index 00000000000..9a163e47bbc --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; a document modal dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWDocModalTest + */ + +public class FocusTransferFDWDocModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest( + Dialog.ModalityType.DOCUMENT_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java new file mode 100644 index 00000000000..41dce55fea8 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; a modeless dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWModelessTest + */ + +public class FocusTransferFDWModelessTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest( + Dialog.ModalityType.MODELESS); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java new file mode 100644 index 00000000000..32117624ecb --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; a non-modal dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWNonModalTest + */ + +public class FocusTransferFDWNonModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest(null); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java new file mode 100644 index 00000000000..41e2fb086f2 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; + +// FDW: Frame -> Dialog -> Window +public class FocusTransferFDWTest { + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Dialog d) { + super(d); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (window != null) { + window.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private final Dialog.ModalityType modalityType; + + FocusTransferFDWTest(Dialog.ModalityType modType) throws Exception { + + modalityType = modType; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + dialog = new CustomDialog((Frame) null); + if (modalityType != null) { + dialog.setModalityType(modalityType); + } + dialog.setLocation(250, 50); + window = new CustomWindow(dialog); + window.setLocation(450, 50); + frame.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + frame.checkCloseButtonFocusGained(true); + + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.checkCloseButtonFocusGained(true); + + frame.checkOpenButtonFocusLost(true); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + dialog.openGained.reset(); + window.clickCloseButton(robot); + + dialog.checkOpenButtonFocusGained(true); + + frame.openGained.reset(); + dialog.clickCloseButton(robot); + + frame.checkOpenButtonFocusGained(true); + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java new file mode 100644 index 00000000000..121aeb5494f --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal1Test + */ + +public class FocusTransferFWDAppModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java new file mode 100644 index 00000000000..ba1ff589406 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal2Test + */ + +public class FocusTransferFWDAppModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java new file mode 100644 index 00000000000..5098658d7e9 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal3Test + */ + +public class FocusTransferFWDAppModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java new file mode 100644 index 00000000000..f4ae06489aa --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal4Test + */ + +public class FocusTransferFWDAppModal4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java new file mode 100644 index 00000000000..4f3958f98d4 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal1Test + */ + +public class FocusTransferFWDDocModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java new file mode 100644 index 00000000000..f68eb0e3a63 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal2Test + */ + +public class FocusTransferFWDDocModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java new file mode 100644 index 00000000000..7ad9e8e3d4a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal3Test + */ + +public class FocusTransferFWDDocModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java new file mode 100644 index 00000000000..d689b61be83 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal4Test + */ + +public class FocusTransferFWDDocModal4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java new file mode 100644 index 00000000000..bdf00c0ca24 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless1Test + */ + +public class FocusTransferFWDModeless1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java new file mode 100644 index 00000000000..a1d31e4328a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless2Test + */ + +public class FocusTransferFWDModeless2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java new file mode 100644 index 00000000000..6ed6f9eab21 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless3Test + */ + +public class FocusTransferFWDModeless3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java new file mode 100644 index 00000000000..956b69127bb --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless4Test + */ + +public class FocusTransferFWDModeless4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java new file mode 100644 index 00000000000..fd06036bce7 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal1Test + */ + +public class FocusTransferFWDNonModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java new file mode 100644 index 00000000000..82283113c8c --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal2Test + */ + +public class FocusTransferFWDNonModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java new file mode 100644 index 00000000000..4475351ba43 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal3Test + */ + +public class FocusTransferFWDNonModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java new file mode 100644 index 00000000000..6ceed537376 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal4Test + */ + +public class FocusTransferFWDNonModal4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java new file mode 100644 index 00000000000..2d7a37419d1 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; +import static jdk.testlibrary.Asserts.*; + + +// FWD: Frame -> Window -> Dialog +public class FocusTransferFWDTest { + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (window != null) { + window.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + public CustomDialog(Dialog d) { + super(d); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private Frame parentFrame; + private Dialog parentDialog; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private final Dialog.ModalityType modalityType; + + public enum DialogParent {NULL_DIALOG, NULL_FRAME, HIDDEN_DIALOG, HIDDEN_FRAME}; + private DialogParent dialogParent; + + FocusTransferFWDTest(Dialog.ModalityType modType, + DialogParent dlgParent) throws Exception { + + modalityType = modType; + dialogParent = dlgParent; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + + switch (dialogParent) { + case NULL_DIALOG: + dialog = new CustomDialog((Dialog) null); + break; + case NULL_FRAME: + dialog = new CustomDialog((Frame) null); + break; + case HIDDEN_DIALOG: + parentDialog = new Dialog((Frame) null); + dialog = new CustomDialog(parentDialog); + break; + case HIDDEN_FRAME: + parentFrame = new Frame(); + dialog = new CustomDialog(parentFrame); + break; + } + + assertTrue(dialog != null, "error: null dialog"); + + if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + dialog.setLocation(250, 50); + window = new CustomWindow(frame); + window.setLocation(450, 50); + frame.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + + if (parentDialog != null) { parentDialog.dispose(); } + if (parentFrame != null) { parentFrame.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + frame.checkCloseButtonFocusGained(true); + + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(true); + frame.checkOpenButtonFocusLost(true); + + window.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.checkCloseButtonFocusGained(true); + window.checkOpenButtonFocusLost(true); + + window.openGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(true); + + frame.openGained.reset(); + + window.clickCloseButton(robot); + robot.waitForIdle(delay); + + frame.checkOpenButtonFocusGained(true); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java new file mode 100644 index 00000000000..d23593634c1 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * an application modal dialog having a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFAppModal1Test + */ + +public class FocusTransferWDFAppModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java new file mode 100644 index 00000000000..e37420f3cdb --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 8048263 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * an application modal dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFAppModal2Test + */ + +public class FocusTransferWDFAppModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferWDFTest.DialogParent.NULL_DIALOG, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java new file mode 100644 index 00000000000..f75c869272a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * an application modal dialog having F owner is shown; F is shown. + * + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFAppModal3Test + */ + +public class FocusTransferWDFAppModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java new file mode 100644 index 00000000000..cd1e9e8f9d9 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a document modal dialog with a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFDocModal1Test + */ + +public class FocusTransferWDFDocModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java new file mode 100644 index 00000000000..9f3a1f88cc8 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a document modal dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFDocModal2Test + */ + +public class FocusTransferWDFDocModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferWDFTest.DialogParent.NULL_DIALOG, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java new file mode 100644 index 00000000000..2c116b09677 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * a document modal dialog having F owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFDocModal3Test + */ + +public class FocusTransferWDFDocModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java new file mode 100644 index 00000000000..73d36b65bf0 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a modeless dialog having a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFModeless1Test + */ + +public class FocusTransferWDFModeless1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.MODELESS, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java new file mode 100644 index 00000000000..e496e253f58 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a modeless dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFModeless2Test + */ + +public class FocusTransferWDFModeless2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.MODELESS, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java new file mode 100644 index 00000000000..df3ff81dc3d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * a modeless dialog having F owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFModeless3Test + */ + +public class FocusTransferWDFModeless3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.MODELESS, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java new file mode 100644 index 00000000000..c700a054136 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a non-modal dialog having a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFNonModal1Test + */ + +public class FocusTransferWDFNonModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + null, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java new file mode 100644 index 00000000000..5e36b8d50a7 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a non-modal dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFNonModal2Test + */ + +public class FocusTransferWDFNonModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + null, + FocusTransferWDFTest.DialogParent.NULL_DIALOG, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java new file mode 100644 index 00000000000..e0d3ebbb1f2 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * a non-modal dialog having F owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFNonModal3Test + */ + +public class FocusTransferWDFNonModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + null, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java new file mode 100644 index 00000000000..d79e715bfe9 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; +import static jdk.testlibrary.Asserts.*; + +// WDF: Window -> Dialog -> Frame +public class FocusTransferWDFTest { + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + public CustomDialog(Dialog d) { + super(d); + } + + @Override + public void doOpenAction() { + if (frame != null) { + frame.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomFrame extends TestFrame { + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + } + + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private Frame parentFrame; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private Dialog.ModalityType modalityType; + + public enum DialogParent {FRAME, NULL_DIALOG}; + private DialogParent dialogParent; + + public enum WindowParent {FRAME, NEW_FRAME}; + private WindowParent windowParent; + + + FocusTransferWDFTest(Dialog.ModalityType modType, + DialogParent dlgParent, + WindowParent winParent) throws Exception { + + modalityType = modType; + dialogParent = dlgParent; + windowParent = winParent; + + robot = new ExtendedRobot(); + EventQueue.invokeLater( this::createGUI ); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + + switch (dialogParent) { + case FRAME: + dialog = new CustomDialog(frame); + break; + case NULL_DIALOG: + dialog = new CustomDialog((Dialog) null); + break; + } + assertTrue(dialog != null, "error: null dialog"); + + if (modalityType == null) { + modalityType = Dialog.ModalityType.MODELESS; + } else { + dialog.setModalityType(modalityType); + } + + dialog.setLocation(250, 50); + + switch (windowParent) { + case FRAME: + window = new CustomWindow(frame); + break; + case NEW_FRAME: + parentFrame = new Frame(); + window = new CustomWindow(parentFrame); + break; + } + assertTrue(window != null, "error: null window"); + + window.setLocation(450, 50); + window.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + + if (parentFrame != null) { parentFrame.dispose(); } + } + + private void ModalTest() throws Exception { + frame.checkCloseButtonFocusGained(false, 10); + dialog.checkOpenButtonFocusLost(false, 10); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + frame.checkCloseButtonFocusGained(true); + + window.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(false, 10); + + window.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.checkCloseButtonFocusGained(true); + window.checkOpenButtonFocusLost(false, 10); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + switch (modalityType) { + case APPLICATION_MODAL: + ModalTest(); + if (windowParent == WindowParent.FRAME) { + assertFalse(window.isVisible(), + "window shouldn't be visible"); + } else { // WindowParent.NEW_FRAME + window.checkOpenButtonFocusGained(false, 10); + } + + break; + + case DOCUMENT_MODAL: + if (dialogParent == DialogParent.FRAME) { + ModalTest(); + if (windowParent == WindowParent.FRAME) { // 10 + assertFalse(window.isVisible(), + "window shouldn't be visible"); + } else { // WindowParent.NEW_FRAME + window.checkOpenButtonFocusGained(false, 10); + } + } else { // DialogParent.NULL_DIALOG + frame.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + dialog.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog.checkOpenButtonFocusGained(true); + + window.openGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(false, 10); + } + break; + + case MODELESS: + + frame.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + dialog.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + if (dialogParent == DialogParent.NULL_DIALOG) { + dialog.checkOpenButtonFocusGained(true); + + window.openGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(false, 10); + } else { + assertFalse(dialog.isVisible(), + "dialog shouldn't be visible"); + + if (windowParent == WindowParent.FRAME) { + assertFalse(window.isVisible(), + "window shouldn't be visible"); + } + } + + break; + } + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java b/jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java new file mode 100644 index 00000000000..614b32cd090 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; +import static jdk.testlibrary.Asserts.*; + +/* + * @test + * @bug 8047367 + * @summary Check modality settings for Window and Dialog. + * + * @library ../../../../lib/testlibrary/ + * @run main ModalitySettingsTest + */ + + + +public class ModalitySettingsTest { + + private void doTest() throws Exception { + + Window w = new Window(new Frame()); + + boolean unexpectedExc = false; + + try { + Dialog d = new Dialog(w); + } catch (IllegalArgumentException iae) { + } catch (Exception e) { + unexpectedExc = true; + } + + assertFalse(unexpectedExc, "unexpected exception occured when a " + + "Window instance was passed to Dialog constructor"); + + Dialog d = new Dialog((Frame) null); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "the default modality type returned by Dialog " + + "differs from Dialog.ModalityType.MODELESS"); + + Frame f = new Frame(); + assertTrue(f.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "the default modality exclusion type returned by Frame" + + "differs from Dialog.ModalExclusionType.NO_EXCLUDE"); + + w = new Window((Frame) null); + assertTrue(w.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "the default modality exclusion type returned by Window " + + "differs from Dialog.ModalExclusionType.NO_EXCLUDE"); + + d = new Dialog((Frame) null); + assertTrue(d.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "the default modality exclusion type returned by Dialog " + + "differs from Dialog.ModalExclusionType.NO_EXCLUDE"); + + d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL); + assertTrue(d.getModalityType() == Dialog.ModalityType.TOOLKIT_MODAL, + "the modality type returned by Dialog " + + "differs from Dialog.ModalityType.TOOLKIT_MODAL " + + "after setting the modality type to that value"); + + d.setModal(false); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "the modality type returned by Dialog differs from " + + "Dialog.ModalityType.MODELESS after calling setModal(false)"); + + d.setModal(true); + assertTrue(d.getModalityType() == Dialog.ModalityType.APPLICATION_MODAL, + "the modality type returned by Dialog differs from " + + "Dialog.ModalityType.APPLICATION_MODAL after calling setModal(true)"); + + w.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE); + assertTrue(w.getModalExclusionType() == + Dialog.ModalExclusionType.APPLICATION_EXCLUDE, + "getModalExclusionType method for Window did not return " + + "Dialog.ModalExclusionType.APPLICATION_EXCLUDE after " + + "setting it to that value"); + + d = new Dialog((Frame) null); + d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL); + assertTrue(d.isModal(), "method isModal for Dialog " + + "returned false when the Dialog is toolkit modal"); + + d.setModalityType(Dialog.ModalityType.MODELESS); + assertFalse(d.isModal(), "method isModal for Dialog " + + "returned true when the Dialog is MODELESS"); + + d = new Dialog((Frame) null, (Dialog.ModalityType) null); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "The modality type returned for a Dialog constructed " + + "with null modality type differs from MODELESS"); + + d = new Dialog((Frame) null); + d.setModalityType(null); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "the modality type returned for a Dialog set with null " + + "modality type differs from MODELESS"); + + d.setModalExclusionType(null); + assertTrue(d.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "The exlcusion type returned for a Dialog set with null " + + "exclusion type differs from NO_EXCLUDE"); + + try { + Dialog.ModalityType.valueOf("invalid"); + } catch (IllegalArgumentException iae) { + } catch (Exception e) { + unexpectedExc = true; + } + + assertFalse(unexpectedExc, "unexpected exception occured when an " + + "invalid value was passed to ModalityType.valueOf method"); + } + + public static void main(String[] args) throws Exception { + ModalitySettingsTest test = new ModalitySettingsTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java b/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java new file mode 100644 index 00000000000..f8632ff14df --- /dev/null +++ b/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.*; +import java.awt.event.KeyEvent; + +import static jdk.testlibrary.Asserts.*; + + +/* + * @test + * @bug 8047367 + * @summary Check whether a Dialog set with null modality type + * behaves like a modeless dialog + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main NullModalityDialogTest + */ + + +public class NullModalityDialogTest { + + class CustomDialog extends TestDialog { + public CustomDialog(Frame f) { + super(f); + } + @Override + public void doOpenAction() { + if (frame != null) { + frame.setVisible(true); + } + if (window != null) { + window.setVisible(true); + } + } + } + + class CustomFrame extends TestFrame { + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + } + + private TestFrame parent; + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + NullModalityDialogTest() throws Exception { + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + parent = new CustomFrame(); + parent.setTitle("Parent"); + parent.setLocation(50, 50); + + dialog = new CustomDialog(parent); + dialog.setTitle("Dialog"); + dialog.setModalityType((Dialog.ModalityType) null); + dialog.setLocation(250, 50); + + frame = new TestFrame(); + frame.setTitle("Frame"); + frame.setLocation(50, 250); + + window = new TestWindow(frame); + window.setLocation(250, 250); + + parent.setVisible(true); + } + + private void closeAll() { + if (parent != null) { parent.dispose(); } + if (dialog != null) { dialog.dispose(); } + if (frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + parent.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "the 1st button did not gain focus " + + "when the Dialog became visible"); + + assertTrue(dialog.closeButton.hasFocus(), "the 1st button in the Dialog " + + "gained focus but lost it afterwards"); + + dialog.openGained.reset(); + + robot.type(KeyEvent.VK_TAB); + + dialog.openGained.waitForFlagTriggered(); + assertTrue(dialog.openGained.flag(), + "Tab navigation did not happen properly on Dialog. Open button " + + "did not gain focus on tab press when parent frame is visible"); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + frame.activated.waitForFlagTriggered(); + assertTrue(frame.activated.flag(), "Frame did not trigger activated when " + + "made visible. Dialog and its parent frame are visible"); + + frame.checkUnblockedFrame(robot, "Frame is the parent of a visible Dialog."); + window.checkUnblockedWindow(robot, "Frame and its child Dialog are visible."); + + robot.waitForIdle(delay); + + EventQueue.invokeAndWait(this::closeAll); + } + + public static void main(String[] args) throws Exception { + NullModalityDialogTest test = new NullModalityDialogTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/helpers/TestDialog.java b/jdk/test/java/awt/Modal/helpers/TestDialog.java index a3791778bc1..d547886cddc 100644 --- a/jdk/test/java/awt/Modal/helpers/TestDialog.java +++ b/jdk/test/java/awt/Modal/helpers/TestDialog.java @@ -332,35 +332,47 @@ public class TestDialog extends Dialog implements ActionListener, "button did not gain focus. " + message); } - public void checkCloseButtonFocusGained() { - checkCloseButtonFocusGained(Flag.ATTEMPTS); + public void checkCloseButtonFocusGained(boolean refState) { + checkCloseButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkCloseButtonFocusGained(int attempts) { + public void checkCloseButtonFocusGained(boolean refState, int attempts) { try { closeGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(closeGained.flag(), - "dialog Close button did not gain focus"); + + String msg = "dialog Close button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(closeGained.flag() == refState, msg); } - public void checkOpenButtonFocusGained() { + public void checkOpenButtonFocusGained(boolean refState) { try { openGained.waitForFlagTriggered(); } catch (InterruptedException e) {} - assertTrue(openGained.flag(), - "dialog Open button did not gain focus"); + + String msg = "dialog Open button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(openGained.flag() == refState, msg); } - public void checkOpenButtonFocusLost() { - checkOpenButtonFocusLost(Flag.ATTEMPTS); + public void checkOpenButtonFocusLost(boolean refState) { + checkOpenButtonFocusLost(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusLost(int attempts) { + public void checkOpenButtonFocusLost(boolean refState, int attempts) { try { openLost.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openLost.flag(), - "dialog Open button did not lose focus"); + + String msg = "dialog Open button "; + msg += (refState ? "did not lose focus" : + "lost focus when it should not"); + + assertTrue(openLost.flag() == refState, msg); } } diff --git a/jdk/test/java/awt/Modal/helpers/TestFrame.java b/jdk/test/java/awt/Modal/helpers/TestFrame.java index 8b646f82291..7af2a3bf686 100644 --- a/jdk/test/java/awt/Modal/helpers/TestFrame.java +++ b/jdk/test/java/awt/Modal/helpers/TestFrame.java @@ -324,46 +324,50 @@ public class TestFrame extends Frame implements ActionListener, "button did not gain focus on tab press. " + message); } - public void checkCloseButtonFocusGained() { - checkCloseButtonFocusGained(Flag.ATTEMPTS); + public void checkCloseButtonFocusGained(boolean refState) { + checkCloseButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkCloseButtonFocusGained(int attempts) { - + public void checkCloseButtonFocusGained(boolean refState, int attempts) { try { closeGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - if (closeGained.flag()) { - Component focusOwner = - KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - assertTrue(closeButton.equals(focusOwner), - "close button gained focus, but it is not the current focus owner"); - } else { - assertTrue(false, "frame Close button did not gain focus"); - } + String msg = "frame Close button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(closeGained.flag() == refState, msg); } - public void checkOpenButtonFocusGained() { - try { - openGained.waitForFlagTriggered(); - } catch (InterruptedException e) {} - - if (openGained.flag()) { - Component focusOwner = - KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - assertTrue(openButton.equals(focusOwner), - "open button gained focus, but it is not the current focus owner"); - } else { - assertTrue(false, "frame Open button did not gain focus"); - } + public void checkOpenButtonFocusGained(boolean refState) { + checkOpenButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusLost() { + public void checkOpenButtonFocusGained(boolean refState, int attempts) { try { - openLost.waitForFlagTriggered(); + openGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openLost.flag(), "frame Open button did not lose focus"); + String msg = "frame Open button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(openGained.flag() == refState, msg); + } + + public void checkOpenButtonFocusLost(boolean refState) { + checkOpenButtonFocusLost(refState, Flag.ATTEMPTS); + } + + public void checkOpenButtonFocusLost(boolean refState, int attempts) { + try { + openLost.waitForFlagTriggered(attempts); + } catch (InterruptedException e) {} + + String msg = "frame Open button "; + msg += (refState ? "did not lose focus" : + "lost focus when it should not"); + assertTrue(openLost.flag()== refState, msg); } } diff --git a/jdk/test/java/awt/Modal/helpers/TestWindow.java b/jdk/test/java/awt/Modal/helpers/TestWindow.java index c929aefbf73..4e7cdb6fe79 100644 --- a/jdk/test/java/awt/Modal/helpers/TestWindow.java +++ b/jdk/test/java/awt/Modal/helpers/TestWindow.java @@ -295,39 +295,51 @@ public class TestWindow extends Window implements ActionListener, "button did not gain focus on tab press. " + message); } - public void checkCloseButtonFocusGained() { - checkCloseButtonFocusGained(Flag.ATTEMPTS); + public void checkCloseButtonFocusGained(boolean refState) { + checkCloseButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkCloseButtonFocusGained(int attempts) { + public void checkCloseButtonFocusGained(boolean refState, int attempts) { try { closeGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(closeGained.flag(), - "window Close button did not gain focus"); + + String msg = "window Close button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(closeGained.flag() == refState, msg); } - public void checkOpenButtonFocusGained() { - checkOpenButtonFocusGained(Flag.ATTEMPTS); + + public void checkOpenButtonFocusGained(boolean refState) { + checkOpenButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusGained(int attempts) { + public void checkOpenButtonFocusGained(boolean refState, int attempts) { try { openGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openGained.flag(), - "window Open button did not gain focus"); + + String msg = "window Open button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(openGained.flag() == refState, msg); } - public void checkOpenButtonFocusLost() { - checkOpenButtonFocusLost(Flag.ATTEMPTS); + public void checkOpenButtonFocusLost(boolean refState) { + checkOpenButtonFocusLost(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusLost(int attempts) { + public void checkOpenButtonFocusLost(boolean refState, int attempts) { try { openLost.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openLost.flag(), - "window Open button did not lose focus"); + + String msg = "window Open button "; + msg += (refState ? "did not lose focus" : + "lost focus when it should not"); + assertTrue(openLost.flag()== refState, msg); } } From 54e8ddf594b3be09d986973a9dc01a8c96b76a21 Mon Sep 17 00:00:00 2001 From: Steve Sides Date: Wed, 9 Jul 2014 15:14:06 +0400 Subject: [PATCH 05/94] 8046597: fix doclint issues in swing classes, part 4 of 4 Reviewed-by: pchelko --- .../classes/javax/swing/AbstractAction.java | 4 + .../classes/javax/swing/CellRendererPane.java | 27 ++++ .../classes/javax/swing/DebugGraphics.java | 48 ++++-- .../javax/swing/DefaultBoundedRangeModel.java | 6 + .../javax/swing/DefaultDesktopManager.java | 2 +- .../swing/DefaultSingleSelectionModel.java | 1 + .../classes/javax/swing/DesktopManager.java | 141 +++++++++++++----- .../share/classes/javax/swing/GrayFilter.java | 5 +- jdk/src/share/classes/javax/swing/Icon.java | 7 +- .../share/classes/javax/swing/JApplet.java | 11 +- .../share/classes/javax/swing/JComponent.java | 28 ++++ .../classes/javax/swing/JDesktopPane.java | 5 +- .../share/classes/javax/swing/JDialog.java | 6 + jdk/src/share/classes/javax/swing/JLabel.java | 12 ++ .../share/classes/javax/swing/JPopupMenu.java | 8 + .../classes/javax/swing/JScrollPane.java | 7 +- .../share/classes/javax/swing/JSpinner.java | 3 + .../share/classes/javax/swing/JTextField.java | 3 + .../share/classes/javax/swing/JWindow.java | 2 + .../classes/javax/swing/ProgressMonitor.java | 6 + .../classes/javax/swing/SpinnerModel.java | 1 + jdk/src/share/classes/javax/swing/Timer.java | 19 ++- 22 files changed, 290 insertions(+), 62 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/AbstractAction.java b/jdk/src/share/classes/javax/swing/AbstractAction.java index 1f0ef990243..5c8f6e6626f 100644 --- a/jdk/src/share/classes/javax/swing/AbstractAction.java +++ b/jdk/src/share/classes/javax/swing/AbstractAction.java @@ -269,6 +269,10 @@ public abstract class AbstractAction implements Action, Cloneable, Serializable * when a bound property has changed and it will send the appropriate * PropertyChangeEvent to any registered * PropertyChangeListeners. + * + * @param propertyName the name of the property that has changed + * @param oldValue the old value of the property + * @param newValue the new value of the property */ protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (changeSupport == null || diff --git a/jdk/src/share/classes/javax/swing/CellRendererPane.java b/jdk/src/share/classes/javax/swing/CellRendererPane.java index 6050693eeeb..c21a282bf29 100644 --- a/jdk/src/share/classes/javax/swing/CellRendererPane.java +++ b/jdk/src/share/classes/javax/swing/CellRendererPane.java @@ -120,6 +120,18 @@ public class CellRendererPane extends Container implements Accessible * The Container p is the component we're actually drawing on, typically it's * equal to this.getParent(). If shouldValidate is true the component c will be * validated before painted. + * + * @param g the {@code Graphics} object to draw on + * @param c the {@code Component} to draw + * @param p the {@code Container} component actually drawn on + * @param x an int specifying the left side of the area draw in, in pixels, + * measured from the left edge of the graphics context + * @param y an int specifying the top of the area to draw in, in pixels + * measured down from the top edge of the graphics context + * @param w an int specifying the width of the area draw in, in pixels + * @param h an int specifying the height of the area draw in, in pixels + * @param shouldValidate if true, component {@code c} will be validated + * before being painted */ public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate) { if (c == null) { @@ -166,6 +178,16 @@ public class CellRendererPane extends Container implements Accessible /** * Calls this.paintComponent(g, c, p, x, y, w, h, false). + * + * @param g the {@code Graphics} object to draw on + * @param c the {@code Component} to draw + * @param p the {@code Container} component actually drawn on + * @param x an int specifying the left side of the area draw in, in pixels, + * measured from the left edge of the graphics context + * @param y an int specifying the top of the area to draw in, in pixels + * measured down from the top edge of the graphics context + * @param w an int specifying the width of the area draw in, in pixels + * @param h an int specifying the height of the area draw in, in pixels */ public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h) { paintComponent(g, c, p, x, y, w, h, false); @@ -174,6 +196,11 @@ public class CellRendererPane extends Container implements Accessible /** * Calls this.paintComponent() with the rectangles x,y,width,height fields. + * + * @param g the {@code Graphics} object to draw on + * @param c the {@code Component} to draw + * @param p the {@code Container} component actually drawn on + * @param r the {@code Rectangle} to draw in */ public void paintComponent(Graphics g, Component c, Container p, Rectangle r) { paintComponent(g, c, p, r.x, r.y, r.width, r.height); diff --git a/jdk/src/share/classes/javax/swing/DebugGraphics.java b/jdk/src/share/classes/javax/swing/DebugGraphics.java index 99a4f5b07ee..050ce604c69 100644 --- a/jdk/src/share/classes/javax/swing/DebugGraphics.java +++ b/jdk/src/share/classes/javax/swing/DebugGraphics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,6 +139,8 @@ public class DebugGraphics extends Graphics { /** * Sets the Color used to flash drawing operations. + * + * @param flashColor the Color used to flash drawing operations */ public static void setFlashColor(Color flashColor) { info().flashColor = flashColor; @@ -146,6 +148,8 @@ public class DebugGraphics extends Graphics { /** * Returns the Color used to flash drawing operations. + * + * @return the Color used to flash drawing operations * @see #setFlashColor */ public static Color flashColor() { @@ -154,6 +158,8 @@ public class DebugGraphics extends Graphics { /** * Sets the time delay of drawing operation flashing. + * + * @param flashTime the time delay of drawing operation flashing */ public static void setFlashTime(int flashTime) { info().flashTime = flashTime; @@ -161,6 +167,8 @@ public class DebugGraphics extends Graphics { /** * Returns the time delay of drawing operation flashing. + * + * @return the time delay of drawing operation flashing * @see #setFlashTime */ public static int flashTime() { @@ -169,27 +177,38 @@ public class DebugGraphics extends Graphics { /** * Sets the number of times that drawing operations will flash. + * + * @param flashCount number of times that drawing operations will flash */ public static void setFlashCount(int flashCount) { info().flashCount = flashCount; } - /** Returns the number of times that drawing operations will flash. - * @see #setFlashCount - */ + /** + * Returns the number of times that drawing operations will flash. + * + * @return the number of times that drawing operations will flash + * @see #setFlashCount + */ public static int flashCount() { return info().flashCount; } - /** Sets the stream to which the DebugGraphics logs drawing operations. - */ + /** + * Sets the stream to which the DebugGraphics logs drawing operations. + * + * @param stream the stream to which the DebugGraphics logs drawing operations + */ public static void setLogStream(java.io.PrintStream stream) { info().stream = stream; } - /** Returns the stream to which the DebugGraphics logs drawing operations. - * @see #setLogStream - */ + /** + * Returns the stream to which the DebugGraphics logs drawing operations. + * + * @return the stream to which the DebugGraphics logs drawing operations + * @see #setLogStream + */ public static java.io.PrintStream logStream() { return info().stream; } @@ -1337,6 +1356,8 @@ public class DebugGraphics extends Graphics { * creates a new Frame that shows each operation on an * offscreen buffer. The value of options is bitwise OR'd into * the current value. To disable debugging use NONE_OPTION. + * + * @param options indicates how diagnostic information should be displayed */ public void setDebugOptions(int options) { if (options != 0) { @@ -1356,9 +1377,12 @@ public class DebugGraphics extends Graphics { } } - /** Returns the current debugging options for this DebugGraphics. - * @see #setDebugOptions - */ + /** + * Returns the current debugging options for this DebugGraphics. + * + * @return the current debugging options for this DebugGraphics + * @see #setDebugOptions + */ public int getDebugOptions() { return debugOptions; } diff --git a/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java b/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java index b7b989e07fa..20f44a28ea3 100644 --- a/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java +++ b/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java @@ -88,6 +88,11 @@ public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable *

      * min <= value <= value+extent <= max
      * 
+ * + * @param value an int giving the current value + * @param extent the length of the inner range that begins at the model's value + * @param min an int giving the minimum value + * @param max an int giving the maximum value */ public DefaultBoundedRangeModel(int value, int extent, int min, int max) { @@ -403,6 +408,7 @@ public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable * If no such listeners exist, * this method returns an empty array. * + * @param the type of {@code EventListener} class being requested * @param listenerType the type of listeners requested; * this parameter should specify an interface * that descends from java.util.EventListener diff --git a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java index ebee71521d9..49eecf1e77c 100644 --- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java +++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java @@ -71,7 +71,7 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab private transient boolean didDrag; /** Normally this method will not be called. If it is, it - * try to determine the appropriate parent from the desktopIcon of the frame. + * tries to determine the appropriate parent from the desktopIcon of the frame. * Will remove the desktopIcon from its parent if it successfully adds the frame. */ public void openFrame(JInternalFrame f) { diff --git a/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java b/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java index 75c522e79c9..532639c071f 100644 --- a/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java +++ b/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java @@ -155,6 +155,7 @@ Serializable { * If no such listeners exist, * this method returns an empty array. * + * @param the type of {@code EventListener} class being requested * @param listenerType the type of listeners requested; * this parameter should specify an interface * that descends from java.util.EventListener diff --git a/jdk/src/share/classes/javax/swing/DesktopManager.java b/jdk/src/share/classes/javax/swing/DesktopManager.java index edcfaf4fabb..5e08a6f139d 100644 --- a/jdk/src/share/classes/javax/swing/DesktopManager.java +++ b/jdk/src/share/classes/javax/swing/DesktopManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,73 +47,136 @@ package javax.swing; */ public interface DesktopManager { - /** If possible, display this frame in an appropriate location. - * Normally, this is not called, as the creator of the JInternalFrame - * will add the frame to the appropriate parent. - */ + /** + * If possible, display this frame in an appropriate location. + * Normally, this is not called, as the creator of the JInternalFrame + * will add the frame to the appropriate parent. + * + * @param f the {@code JInternalFrame} to be displayed + */ void openFrame(JInternalFrame f); - /** Generally, this call should remove the frame from it's parent. */ + /** + * Generally, this call should remove the frame from its parent. + * + * @param f the {@code JInternalFrame} to be removed + */ void closeFrame(JInternalFrame f); - /** Generally, the frame should be resized to match it's parents bounds. */ + /** + * Generally, the frame should be resized to match its parents bounds. + * + * @param f the {@code JInternalFrame} to be resized + */ void maximizeFrame(JInternalFrame f); - /** Generally, this indicates that the frame should be restored to it's - * size and position prior to a maximizeFrame() call. - */ + + /** + * Generally, this indicates that the frame should be restored to its + * size and position prior to a maximizeFrame() call. + * + * @param f the {@code JInternalFrame} to be restored + */ void minimizeFrame(JInternalFrame f); - /** Generally, remove this frame from it's parent and add an iconic representation. */ + + /** + * Generally, remove this frame from its parent and add an iconic representation. + * + * @param f the {@code JInternalFrame} to be iconified + */ void iconifyFrame(JInternalFrame f); - /** Generally, remove any iconic representation that is present and restore the - * frame to it's original size and location. - */ + + /** + * Generally, remove any iconic representation that is present and restore the + * frame to it's original size and location. + * + * @param f the {@code JInternalFrame} to be de-iconified + */ void deiconifyFrame(JInternalFrame f); /** * Generally, indicate that this frame has focus. This is usually called after * the JInternalFrame's IS_SELECTED_PROPERTY has been set to true. + * + * @param f the {@code JInternalFrame} to be activated */ void activateFrame(JInternalFrame f); /** * Generally, indicate that this frame has lost focus. This is usually called * after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false. + * + * @param f the {@code JInternalFrame} to be deactivated */ void deactivateFrame(JInternalFrame f); - /** This method is normally called when the user has indicated that - * they will begin dragging a component around. This method should be called - * prior to any dragFrame() calls to allow the DesktopManager to prepare any - * necessary state. Normally f will be a JInternalFrame. - */ + /** + * This method is normally called when the user has indicated that + * they will begin dragging a component around. This method should be called + * prior to any dragFrame() calls to allow the DesktopManager to prepare any + * necessary state. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being dragged + */ void beginDraggingFrame(JComponent f); - /** The user has moved the frame. Calls to this method will be preceded by calls - * to beginDraggingFrame(). - * Normally f will be a JInternalFrame. - */ + /** + * The user has moved the frame. Calls to this method will be preceded by calls + * to beginDraggingFrame(). + * Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being dragged + * @param newX the new x-coordinate + * @param newY the new y-coordinate + */ void dragFrame(JComponent f, int newX, int newY); - /** This method signals the end of the dragging session. Any state maintained by - * the DesktopManager can be removed here. Normally f will be a JInternalFrame. - */ + + /** + * This method signals the end of the dragging session. Any state maintained by + * the DesktopManager can be removed here. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being dragged + */ void endDraggingFrame(JComponent f); - /** This methods is normally called when the user has indicated that - * they will begin resizing the frame. This method should be called - * prior to any resizeFrame() calls to allow the DesktopManager to prepare any - * necessary state. Normally f will be a JInternalFrame. - */ + /** + * This method is normally called when the user has indicated that + * they will begin resizing the frame. This method should be called + * prior to any resizeFrame() calls to allow the DesktopManager to prepare any + * necessary state. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being resized + */ void beginResizingFrame(JComponent f, int direction); - /** The user has resized the component. Calls to this method will be preceded by calls - * to beginResizingFrame(). - * Normally f will be a JInternalFrame. - */ + + /** + * The user has resized the component. Calls to this method will be preceded by calls + * to beginResizingFrame(). + * Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being resized + * @param newX the new x-coordinate + * @param newY the new y-coordinate + * @param newWidth the new width + * @param newHeight the new height + */ void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight); - /** This method signals the end of the resize session. Any state maintained by - * the DesktopManager can be removed here. Normally f will be a JInternalFrame. - */ + + /** + * This method signals the end of the resize session. Any state maintained by + * the DesktopManager can be removed here. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being resized + */ void endResizingFrame(JComponent f); - /** This is a primitive reshape method.*/ + /** + * This is a primitive reshape method. + * + * @param f the {@code JComponent} being moved or resized + * @param newX the new x-coordinate + * @param newY the new y-coordinate + * @param newWidth the new width + * @param newHeight the new height + */ void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight); } diff --git a/jdk/src/share/classes/javax/swing/GrayFilter.java b/jdk/src/share/classes/javax/swing/GrayFilter.java index 573edbedb63..af5947e5eec 100644 --- a/jdk/src/share/classes/javax/swing/GrayFilter.java +++ b/jdk/src/share/classes/javax/swing/GrayFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,9 @@ public class GrayFilter extends RGBImageFilter { /** * Creates a disabled image + * + * @param i an {@code Image} to be created as disabled + * @return the new grayscale image created from {@code i} */ public static Image createDisabledImage (Image i) { GrayFilter filter = new GrayFilter(true, 50); diff --git a/jdk/src/share/classes/javax/swing/Icon.java b/jdk/src/share/classes/javax/swing/Icon.java index 87c53684711..4bad4d461d3 100644 --- a/jdk/src/share/classes/javax/swing/Icon.java +++ b/jdk/src/share/classes/javax/swing/Icon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,11 @@ public interface Icon * Draw the icon at the specified location. Icon implementations * may use the Component argument to get properties useful for * painting, e.g. the foreground or background color. + * + * @param c a {@code Component} to get properties useful for painting + * @param g the graphics context + * @param x the X coordinate of the icon's top-left corner + * @param y the Y coordinate of the icon's top-left corner */ void paintIcon(Component c, Graphics g, int x, int y); diff --git a/jdk/src/share/classes/javax/swing/JApplet.java b/jdk/src/share/classes/javax/swing/JApplet.java index 651d004660d..5f857076027 100644 --- a/jdk/src/share/classes/javax/swing/JApplet.java +++ b/jdk/src/share/classes/javax/swing/JApplet.java @@ -157,8 +157,11 @@ public class JApplet extends Applet implements Accessible, enableEvents(AWTEvent.KEY_EVENT_MASK); } - - /** Called by the constructor methods to create the default rootPane. */ + /** + * Called by the constructor methods to create the default rootPane. + * + * @return a new {@code JRootPane} + */ protected JRootPane createRootPane() { JRootPane rp = new JRootPane(); // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there @@ -247,6 +250,7 @@ public class JApplet extends Applet implements Accessible, /** * Returns the menubar set on this applet. * + * @return the menubar set on this applet * @see #setJMenuBar */ public JMenuBar getJMenuBar() { @@ -542,6 +546,9 @@ public class JApplet extends Applet implements Accessible, // Accessibility support //////////////// + /** + * {@code AccessibleContext} associated with this {@code JApplet} + */ protected AccessibleContext accessibleContext = null; /** diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 7d0b876dc9d..765610ebbad 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -496,6 +496,7 @@ public abstract class JComponent extends Container implements Serializable, /** * Returns true if the JPopupMenu should be inherited from the parent. * + * @return true if the JPopupMenu should be inherited from the parent * @see #setComponentPopupMenu * @since 1.5 */ @@ -1302,6 +1303,7 @@ public abstract class JComponent extends Container implements Serializable, * SortingFocusTraversalPolicy from considering descendants * of this JComponent when computing a focus traversal cycle. * + * @return false * @see java.awt.Component#setFocusTraversalKeys * @see SortingFocusTraversalPolicy * @deprecated As of 1.4, replaced by @@ -2213,6 +2215,13 @@ public abstract class JComponent extends Container implements Serializable, * This method is now obsolete, please use a combination of * getActionMap() and getInputMap() for * similar behavior. + * + * @param anAction action to be registered to given keystroke and condition + * @param aKeyStroke a {@code KeyStroke} + * @param aCondition the condition to be associated with given keystroke + * and action + * @see #getActionMap + * @see #getInputMap(int) */ public void registerKeyboardAction(ActionListener anAction,KeyStroke aKeyStroke,int aCondition) { registerKeyboardAction(anAction,null,aKeyStroke,aCondition); @@ -2231,6 +2240,9 @@ public abstract class JComponent extends Container implements Serializable, * Unregisters a keyboard action. * This will remove the binding from the ActionMap * (if it exists) as well as the InputMaps. + * + * @param aKeyStroke the keystroke for which to unregister its + * keyboard action */ public void unregisterKeyboardAction(KeyStroke aKeyStroke) { ActionMap am = getActionMap(false); @@ -2286,6 +2298,8 @@ public abstract class JComponent extends Container implements Serializable, * conditions WHEN_FOCUSED and * WHEN_IN_FOCUSED_WINDOW condition. * + * @param aKeyStroke the keystroke for which to request an + * action-keystroke condition * @return the action-keystroke condition */ public int getConditionForKeyStroke(KeyStroke aKeyStroke) { @@ -2302,6 +2316,7 @@ public abstract class JComponent extends Container implements Serializable, * Returns the object that will perform the action registered for a * given keystroke. * + * @param aKeyStroke the keystroke for which to return a listener * @return the ActionListener * object invoked when the keystroke occurs */ @@ -2610,6 +2625,8 @@ public abstract class JComponent extends Container implements Serializable, * FocusTraversalPolicy of this JComponent's * focus-cycle-root ancestor is used. * + * @return true if this component can request to get the input focus, + * false if it can not * @see java.awt.FocusTraversalPolicy#getDefaultComponent * @deprecated As of 1.4, replaced by * FocusTraversalPolicy.getDefaultComponent(Container).requestFocus() @@ -2821,6 +2838,8 @@ public abstract class JComponent extends Container implements Serializable, * normally override this method if they process some * key events themselves. If the event is processed, * it should be consumed. + * + * @param e the event to be processed */ protected void processComponentKeyEvent(KeyEvent e) { } @@ -3032,6 +3051,10 @@ public abstract class JComponent extends Container implements Serializable, * setToolTipText. If a component provides * more extensive API to support differing tooltips at different locations, * this method should be overridden. + * + * @param event the {@code MouseEvent} that initiated the + * {@code ToolTip} display + * @return a string containing the tooltip */ public String getToolTipText(MouseEvent event) { return getToolTipText(); @@ -3774,6 +3797,10 @@ public abstract class JComponent extends Container implements Serializable, * but not very pretty outside borders in compound border situations. * It's rather arbitrary, but hopefully decent UI programmers will * not create multiple titled borders for the same component. + * + * @param b the {@code Border} for which to retrieve its title + * @return the border's title as a {@code String}, null if it has + * no title */ protected String getBorderTitle(Border b) { String s; @@ -4198,6 +4225,7 @@ public abstract class JComponent extends Container implements Serializable, * Returns true if this component is lightweight, that is, if it doesn't * have a native window system peer. * + * @param c the {@code Component} to be checked * @return true if this component is lightweight */ @SuppressWarnings("deprecation") diff --git a/jdk/src/share/classes/javax/swing/JDesktopPane.java b/jdk/src/share/classes/javax/swing/JDesktopPane.java index 35d53d2d918..54142344e37 100644 --- a/jdk/src/share/classes/javax/swing/JDesktopPane.java +++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java @@ -208,8 +208,11 @@ public class JDesktopPane extends JLayeredPane implements Accessible } /** - * Returns the DesktopManger that handles + * Returns the {@code DesktopManger} that handles * desktop-specific UI actions. + * + * @return the {@code DesktopManger} that handles desktop-specific + * UI actions */ public DesktopManager getDesktopManager() { return desktopManager; diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java index ae0a3519e93..00e8198b03e 100644 --- a/jdk/src/share/classes/javax/swing/JDialog.java +++ b/jdk/src/share/classes/javax/swing/JDialog.java @@ -664,6 +664,8 @@ public class JDialog extends Dialog implements WindowConstants, /** * Called by the constructor methods to create the default * {@code rootPane}. + * + * @return a new {@code JRootPane} */ protected JRootPane createRootPane() { JRootPane rp = new JRootPane(); @@ -854,6 +856,7 @@ public class JDialog extends Dialog implements WindowConstants, /** * Returns the menubar set on this dialog. * + * @return the menubar set on this dialog * @see #setJMenuBar */ public JMenuBar getJMenuBar() { @@ -1225,6 +1228,9 @@ public class JDialog extends Dialog implements WindowConstants, // Accessibility support //////////////// + /** + * {@code AccessibleContext} associated with this {@code JDialog} + */ protected AccessibleContext accessibleContext = null; /** diff --git a/jdk/src/share/classes/javax/swing/JLabel.java b/jdk/src/share/classes/javax/swing/JLabel.java index 2b0be80b1c7..3191f84ccf5 100644 --- a/jdk/src/share/classes/javax/swing/JLabel.java +++ b/jdk/src/share/classes/javax/swing/JLabel.java @@ -128,6 +128,10 @@ public class JLabel extends JComponent implements SwingConstants, Accessible private int horizontalTextPosition = TRAILING; private int iconTextGap = 4; + /** + * The Component this label is for; null if the label + * is not the label for a component + */ protected Component labelFor = null; /** @@ -310,6 +314,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible *

* This is a JavaBeans bound property. * + * @param text the single line of text this component will display * @see #setVerticalTextPosition * @see #setHorizontalTextPosition * @see #setIcon @@ -366,6 +371,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible *

* This is a JavaBeans bound property. * + * @param icon the default icon this component will display * @see #setVerticalTextPosition * @see #setHorizontalTextPosition * @see #getIcon @@ -476,6 +482,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * call the requestFocus method of the component specified by the * labelFor property when the mnemonic is activated. * + * @param key a keycode that indicates a mnemonic key * @see #getLabelFor * @see #setLabelFor * @beaninfo @@ -592,6 +599,8 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param key the property value to check * @param message the IllegalArgumentException detail message + * @return the key value if {@code key} is a a legal value for the + * horizontalAlignment properties * @exception IllegalArgumentException if key isn't LEFT, CENTER, RIGHT, * LEADING or TRAILING. * @see #setHorizontalTextPosition @@ -617,6 +626,8 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param key the property value to check * @param message the IllegalArgumentException detail message + * @return the key value if {@code key} is a legal value for the + * verticalAlignment or verticalTextPosition properties * @exception IllegalArgumentException if key isn't TOP, CENTER, or BOTTOM. * @see #setVerticalAlignment * @see #setVerticalTextPosition @@ -652,6 +663,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible *

* This is a JavaBeans bound property. * + * @param iconTextGap the space between the icon and text properties * @see #getIconTextGap * @beaninfo * bound: true diff --git a/jdk/src/share/classes/javax/swing/JPopupMenu.java b/jdk/src/share/classes/javax/swing/JPopupMenu.java index 3f2a57323a5..ca00144b774 100644 --- a/jdk/src/share/classes/javax/swing/JPopupMenu.java +++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java @@ -298,6 +298,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * it to the end of this menu. * * @param s the string for the menu item to be added + * @return a new {@code JMenuItem} created using {@code s} */ public JMenuItem add(String s) { return add(new JMenuItem(s)); @@ -452,6 +453,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { /** * Returns a properly configured PropertyChangeListener * which updates the control as changes to the Action occur. + * + * @param b the menu item for which to create a listener + * @return a properly configured {@code PropertyChangeListener} */ protected PropertyChangeListener createActionChangeListener(JMenuItem b) { return b.createActionPropertyChangeListener0(b.getAction()); @@ -1530,6 +1534,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { @SuppressWarnings("serial") static public class Separator extends JSeparator { + /** + * Constructs a popup menu-specific Separator. + */ public Separator( ) { super( JSeparator.HORIZONTAL ); @@ -1553,6 +1560,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * Returns true if the MouseEvent is considered a popup trigger * by the JPopupMenu's currently installed UI. * + * @param e a {@code MouseEvent} * @return true if the mouse event is a popup trigger * @since 1.3 */ diff --git a/jdk/src/share/classes/javax/swing/JScrollPane.java b/jdk/src/share/classes/javax/swing/JScrollPane.java index 373523e936e..39700a68429 100644 --- a/jdk/src/share/classes/javax/swing/JScrollPane.java +++ b/jdk/src/share/classes/javax/swing/JScrollPane.java @@ -1102,6 +1102,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * setColumnHeaderView * to add a column header component and its viewport to the scroll pane. * + * @param columnHeader a {@code JViewport} which is the new column header * @see #getColumnHeader * @see #setColumnHeaderView * @@ -1299,6 +1300,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * Indicates whether or not scrolling will take place in response to the * mouse wheel. Wheel scrolling is enabled by default. * + * @return true if mouse wheel scrolling is enabled, false otherwise * @see #setWheelScrollingEnabled * @since 1.4 * @beaninfo @@ -1448,9 +1450,12 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce protected class AccessibleJScrollPane extends AccessibleJComponent implements ChangeListener, PropertyChangeListener { + /** + * this {@code JScrollPane}'s current {@code JViewport} + */ protected JViewport viewPort = null; - /* + /** * Resets the viewport ChangeListener and PropertyChangeListener */ public void resetViewPort() { diff --git a/jdk/src/share/classes/javax/swing/JSpinner.java b/jdk/src/share/classes/javax/swing/JSpinner.java index 1643257dec5..2e51212ff3a 100644 --- a/jdk/src/share/classes/javax/swing/JSpinner.java +++ b/jdk/src/share/classes/javax/swing/JSpinner.java @@ -149,6 +149,7 @@ public class JSpinner extends JComponent implements Accessible * a set of previous/next buttons, and an editor appropriate * for the model. * + * @param model a model for the new spinner * @throws NullPointerException if the model is {@code null} */ public JSpinner(SpinnerModel model) { @@ -328,6 +329,7 @@ public class JSpinner extends JComponent implements Accessible * getModel().getValue() * * + * @return the current value of the model * @see #setValue * @see SpinnerModel#getValue */ @@ -349,6 +351,7 @@ public class JSpinner extends JComponent implements Accessible * getModel().setValue(value) * * + * @param value new value for the spinner * @throws IllegalArgumentException if value isn't allowed * @see #getValue * @see SpinnerModel#setValue diff --git a/jdk/src/share/classes/javax/swing/JTextField.java b/jdk/src/share/classes/javax/swing/JTextField.java index e90740362f5..94290052870 100644 --- a/jdk/src/share/classes/javax/swing/JTextField.java +++ b/jdk/src/share/classes/javax/swing/JTextField.java @@ -675,6 +675,9 @@ public class JTextField extends JTextComponent implements SwingConstants { * that of the Action. * * @param a the textfield's action + * @return a {@code PropertyChangeListener} that is responsible for + * listening for changes from the specified {@code Action} and + * updating the appropriate properties * @since 1.3 * @see Action * @see #setAction diff --git a/jdk/src/share/classes/javax/swing/JWindow.java b/jdk/src/share/classes/javax/swing/JWindow.java index cf95a417fd5..804d4e3edc7 100644 --- a/jdk/src/share/classes/javax/swing/JWindow.java +++ b/jdk/src/share/classes/javax/swing/JWindow.java @@ -272,6 +272,8 @@ public class JWindow extends Window implements Accessible, /** * Called by the constructor methods to create the default * rootPane. + * + * @return a new {@code JRootPane} */ protected JRootPane createRootPane() { JRootPane rp = new JRootPane(); diff --git a/jdk/src/share/classes/javax/swing/ProgressMonitor.java b/jdk/src/share/classes/javax/swing/ProgressMonitor.java index 506b443b4f5..e2af3ee44cd 100644 --- a/jdk/src/share/classes/javax/swing/ProgressMonitor.java +++ b/jdk/src/share/classes/javax/swing/ProgressMonitor.java @@ -369,6 +369,8 @@ public class ProgressMonitor implements Accessible /** * Returns true if the user hits the Cancel button in the progress dialog. + * + * @return true if the user hits the Cancel button in the progress dialog */ public boolean isCanceled() { if (pane == null) return false; @@ -396,6 +398,8 @@ public class ProgressMonitor implements Accessible * Returns the amount of time this object waits before deciding whether * or not to popup a progress monitor. * + * @return the amount of time in milliseconds this object waits before + * deciding whether or not to popup a progress monitor * @see #setMillisToDecideToPopup */ public int getMillisToDecideToPopup() { @@ -419,6 +423,8 @@ public class ProgressMonitor implements Accessible /** * Returns the amount of time it will take for the popup to appear. * + * @return the amont of time in milliseconds it will take for the + * popup to appear * @see #setMillisToPopup */ public int getMillisToPopup() { diff --git a/jdk/src/share/classes/javax/swing/SpinnerModel.java b/jdk/src/share/classes/javax/swing/SpinnerModel.java index 7c060248eac..57af106271f 100644 --- a/jdk/src/share/classes/javax/swing/SpinnerModel.java +++ b/jdk/src/share/classes/javax/swing/SpinnerModel.java @@ -88,6 +88,7 @@ public interface SpinnerModel * that case, model.setValue(new Number(11)) * would throw an exception. * + * @param value new value for the spinner * @throws IllegalArgumentException if value isn't allowed * @see #getValue */ diff --git a/jdk/src/share/classes/javax/swing/Timer.java b/jdk/src/share/classes/javax/swing/Timer.java index 2c25598b88c..6caced7dd8d 100644 --- a/jdk/src/share/classes/javax/swing/Timer.java +++ b/jdk/src/share/classes/javax/swing/Timer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -154,6 +154,9 @@ public class Timer implements Serializable * NOTE: all fields need to be handled in readResolve */ + /** + * The collection of registered listeners + */ protected EventListenerList listenerList = new EventListenerList(); // The following field strives to maintain the following: @@ -335,6 +338,7 @@ public class Timer implements Serializable * If no such listeners exist, * this method returns an empty array. * + * @param the type of {@code EventListener} class being requested * @param listenerType the type of listeners requested; * this parameter should specify an interface * that descends from java.util.EventListener @@ -410,6 +414,7 @@ public class Timer implements Serializable * Returns the delay, in milliseconds, * between firings of action events. * + * @return the delay, in milliseconds, between firings of action events * @see #setDelay * @see #getInitialDelay */ @@ -441,8 +446,9 @@ public class Timer implements Serializable /** - * Returns the Timer's initial delay. + * Returns the {@code Timer}'s initial delay. * + * @return the {@code Timer}'s intial delay, in milliseconds * @see #setInitialDelay * @see #setDelay */ @@ -470,6 +476,8 @@ public class Timer implements Serializable * an action event * to its listeners multiple times. * + * @return true if the {@code Timer} will send an action event to its + * listeners multiple times * @see #setRepeats */ public boolean isRepeats() { @@ -506,9 +514,11 @@ public class Timer implements Serializable /** - * Returns true if the Timer coalesces + * Returns {@code true} if the {@code Timer} coalesces * multiple pending action events. * + * @return true if the {@code Timer} coalesces multiple pending + * action events * @see #setCoalesce */ public boolean isCoalesce() { @@ -555,8 +565,9 @@ public class Timer implements Serializable /** - * Returns true if the Timer is running. + * Returns {@code true} if the {@code Timer} is running. * + * @return true if the {@code Timer} is running, false otherwise * @see #start */ public boolean isRunning() { From 529b1b6422b88a3f590d88bf94d07ea6702cb2f5 Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Wed, 9 Jul 2014 17:11:53 +0400 Subject: [PATCH 06/94] 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7 Reviewed-by: pchelko --- .../swing/plaf/basic/BasicArrowButton.java | 2 + .../swing/plaf/basic/BasicButtonListener.java | 20 +++- .../plaf/basic/BasicCheckBoxMenuItemUI.java | 19 +++- .../swing/plaf/basic/BasicCheckBoxUI.java | 7 ++ .../swing/plaf/basic/BasicColorChooserUI.java | 47 +++++++++- .../swing/plaf/basic/BasicComboBoxEditor.java | 6 ++ .../plaf/basic/BasicComboBoxRenderer.java | 3 + .../swing/plaf/basic/BasicDesktopPaneUI.java | 40 ++++++++ .../swing/plaf/basic/BasicDirectoryModel.java | 43 ++++++++- .../swing/plaf/basic/BasicGraphicsUtils.java | 93 +++++++++++++++++-- .../javax/swing/plaf/basic/BasicHTML.java | 11 +++ .../swing/plaf/basic/BasicIconFactory.java | 40 ++++++++ .../swing/plaf/basic/BasicMenuBarUI.java | 48 +++++++++- .../javax/swing/plaf/basic/BasicMenuUI.java | 51 ++++++++++ .../javax/swing/plaf/basic/BasicPanelUI.java | 18 +++- .../plaf/basic/BasicPopupMenuSeparatorUI.java | 8 +- .../swing/plaf/basic/BasicPopupMenuUI.java | 38 +++++++- .../basic/BasicRadioButtonMenuItemUI.java | 16 +++- .../swing/plaf/basic/BasicRadioButtonUI.java | 24 ++++- .../swing/plaf/basic/BasicRootPaneUI.java | 48 +++++++++- .../swing/plaf/basic/BasicSeparatorUI.java | 39 +++++++- .../swing/plaf/basic/BasicSpinnerUI.java | 2 + .../swing/plaf/basic/BasicTableHeaderUI.java | 28 +++++- .../javax/swing/plaf/basic/BasicTextUI.java | 12 +++ .../swing/plaf/basic/BasicToggleButtonUI.java | 16 +++- .../plaf/basic/BasicToolBarSeparatorUI.java | 8 +- .../swing/plaf/basic/BasicToolTipUI.java | 39 +++++++- .../swing/plaf/basic/BasicViewportUI.java | 18 +++- .../javax/swing/plaf/basic/ComboPopup.java | 4 + .../swing/plaf/basic/DefaultMenuLayout.java | 11 +++ 30 files changed, 714 insertions(+), 45 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java index 750fe60c235..4c1e590779e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java @@ -99,6 +99,8 @@ public class BasicArrowButton extends JButton implements SwingConstants /** * Returns the direction of the arrow. + * + * @return the direction of the arrow */ public int getDirection() { return direction; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java index 1367e0c58a8..3278d33e4a9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,6 +58,11 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener, } + /** + * Constructs a new instance of {@code BasicButtonListener}. + * + * @param b an abstract button + */ public BasicButtonListener(AbstractButton b) { } @@ -76,13 +81,20 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener, } } + /** + * Checks the opacity of the {@code AbstractButton}. + * + * @param b an abstract button + */ protected void checkOpacity(AbstractButton b) { b.setOpaque( b.isContentAreaFilled() ); } /** * Register default key actions: pressing space to "click" a - * button and registring the keyboard mnemonic (if any). + * button and registering the keyboard mnemonic (if any). + * + * @param c a component */ public void installKeyboardActions(JComponent c) { AbstractButton b = (AbstractButton)c; @@ -98,7 +110,9 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener, } /** - * Unregister's default key actions + * Unregister default key actions. + * + * @param c a component */ public void uninstallKeyboardActions(JComponent c) { SwingUtilities.replaceUIInputMap(c, JComponent. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java index 69a28c61723..99ffc834844 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,6 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.plaf.*; -import javax.swing.border.*; -import java.io.Serializable; - /** * BasicCheckboxMenuItem implementation @@ -42,6 +39,12 @@ import java.io.Serializable; */ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI { + /** + * Constructs a new instance of {@code BasicCheckBoxMenuItemUI}. + * + * @param c a component + * @return a new instance of {@code BasicCheckBoxMenuItemUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicCheckBoxMenuItemUI(); } @@ -50,6 +53,14 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI { return "CheckBoxMenuItem"; } + /** + * Invoked when mouse event occurs. + * + * @param item a menu item + * @param e a mouse event + * @param path an array of {@code MenuElement} + * @param manager an instance of {@code MenuSelectionManager} + */ public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) { Point p = e.getPoint(); if(p.x >= 0 && p.x < item.getWidth() && diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java index 256a3afbfcf..d0deeb59ca5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java @@ -59,6 +59,13 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI { // ******************************** // Create PLAF // ******************************** + + /** + * Returns an instance of {@code BasicCheckBoxUI}. + * + * @param b a component + * @return an instance of {@code BasicCheckBoxUI} + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); BasicCheckBoxUI checkboxUI = diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java index 42b9a0b6c8b..7ad582a0792 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java @@ -61,21 +61,45 @@ public class BasicColorChooserUI extends ColorChooserUI boolean isMultiPanel = false; private static TransferHandler defaultTransferHandler = new ColorTransferHandler(); + /** + * The array of default color choosers. + */ protected AbstractColorChooserPanel[] defaultChoosers; + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener previewListener; + + /** + * The instance of {@code PropertyChangeListener}. + */ protected PropertyChangeListener propertyChangeListener; private Handler handler; + /** + * Returns a new instance of {@code BasicColorChooserUI}. + * + * @param c a component + * @return a new instance of {@code BasicColorChooserUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicColorChooserUI(); } + /** + * Returns an array of default color choosers. + * + * @return an array of default color choosers + */ protected AbstractColorChooserPanel[] createDefaultChoosers() { AbstractColorChooserPanel[] panels = ColorChooserComponentFactory.getDefaultChooserPanels(); return panels; } + /** + * Uninstalls default color choosers. + */ protected void uninstallDefaultChoosers() { AbstractColorChooserPanel[] choosers = chooser.getChooserPanels(); for( int i = 0 ; i < choosers.length; i++) { @@ -138,6 +162,9 @@ public class BasicColorChooserUI extends ColorChooserUI handler = null; } + /** + * Installs preview panel. + */ protected void installPreviewPanel() { JComponent previewPanel = this.chooser.getPreviewPanel(); if (previewPanel == null) { @@ -169,6 +196,9 @@ public class BasicColorChooserUI extends ColorChooserUI this.chooser.remove(this.previewPanelHolder); } + /** + * Installs default properties. + */ protected void installDefaults() { LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background", "ColorChooser.foreground", @@ -180,16 +210,21 @@ public class BasicColorChooserUI extends ColorChooserUI } } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { if (chooser.getTransferHandler() instanceof UIResource) { chooser.setTransferHandler(null); } } - + /** + * Registers listeners. + */ protected void installListeners() { propertyChangeListener = createPropertyChangeListener(); - chooser.addPropertyChangeListener( propertyChangeListener ); + chooser.addPropertyChangeListener(propertyChangeListener); previewListener = getHandler(); chooser.getSelectionModel().addChangeListener(previewListener); @@ -202,10 +237,18 @@ public class BasicColorChooserUI extends ColorChooserUI return handler; } + /** + * Returns an instance of {@code PropertyChangeListener}. + * + * @return an instance of {@code PropertyChangeListener} + */ protected PropertyChangeListener createPropertyChangeListener() { return getHandler(); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { chooser.removePropertyChangeListener( propertyChangeListener ); chooser.getSelectionModel().removeChangeListener(previewListener); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java index e9248631d1f..c7534c1e0c1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java @@ -41,9 +41,15 @@ import sun.reflect.misc.MethodUtil; * @author Mark Davidson */ public class BasicComboBoxEditor implements ComboBoxEditor,FocusListener { + /** + * An instance of {@code JTextField}. + */ protected JTextField editor; private Object oldValue; + /** + * Constructs a new instance of {@code BasicComboBoxEditor}. + */ public BasicComboBoxEditor() { editor = createEditorComponent(); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java index 4b596dc4e19..231eced6f52 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java @@ -59,6 +59,9 @@ implements ListCellRenderer, Serializable { protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); private final static Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); + /** + * Constructs a new instance of {@code BasicComboBoxRenderer}. + */ public BasicComboBoxRenderer() { super(); setOpaque(true); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java index 695eb87bded..fe71487bdea 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java @@ -55,7 +55,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { private Handler handler; private PropertyChangeListener pcl; + /** + * The instance of {@code JDesktopPane}. + */ protected JDesktopPane desktop; + + /** + * The instance of {@code DesktopManager}. + */ protected DesktopManager desktopManager; /** @@ -109,10 +116,19 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { @Deprecated protected KeyStroke navigateKey2; + /** + * Constructs a new instance of {@code BasicDesktopPaneUI}. + * + * @param c a component + * @return a new instance of {@code BasicDesktopPaneUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicDesktopPaneUI(); } + /** + * Constructs a new instance of {@code BasicDesktopPaneUI}. + */ public BasicDesktopPaneUI() { } @@ -133,6 +149,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { handler = null; } + /** + * Installs default properties. + */ protected void installDefaults() { if (desktop.getBackground() == null || desktop.getBackground() instanceof UIResource) { @@ -141,6 +160,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { LookAndFeel.installProperty(desktop, "opaque", Boolean.TRUE); } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { } /** @@ -169,6 +191,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { pcl = null; } + /** + * Installs desktop manager. + */ protected void installDesktopManager() { desktopManager = desktop.getDesktopManager(); if(desktopManager == null) { @@ -177,6 +202,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { } } + /** + * Uninstalls desktop manager. + */ protected void uninstallDesktopManager() { if(desktop.getDesktopManager() instanceof UIResource) { desktop.setDesktopManager(null); @@ -184,6 +212,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { desktopManager = null; } + /** + * Installs keyboard actions. + */ protected void installKeyboardActions(){ InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); if (inputMap != null) { @@ -202,9 +233,15 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { registerKeyboardActions(); } + /** + * Registers keyboard actions. + */ protected void registerKeyboardActions(){ } + /** + * Unregisters keyboard actions. + */ protected void unregisterKeyboardActions(){ } @@ -253,6 +290,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { map.put(new Actions(Actions.NAVIGATE_PREVIOUS)); } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions(){ unregisterKeyboardActions(); SwingUtilities.replaceUIInputMap(desktop, JComponent. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java index 6875367c91e..c31332b15aa 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java @@ -55,6 +55,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr private boolean busy = false; + /** + * Constructs a new instance of {@code BasicDirectoryModel}. + * + * @param filechooser an instance of {JFileChooser} + */ public BasicDirectoryModel(JFileChooser filechooser) { this.filechooser = filechooser; validateFileCache(); @@ -93,6 +98,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } + /** + * Returns a list of directories. + * + * @return a list of directories + */ public Vector getDirectories() { synchronized(fileCache) { if (directories != null) { @@ -103,6 +113,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } + /** + * Returns a list of files. + * + * @return a list of files + */ public Vector getFiles() { synchronized(fileCache) { if (files != null) { @@ -126,6 +141,9 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } + /** + * Validates content of file cache. + */ public void validateFileCache() { File currentDirectory = filechooser.getCurrentDirectory(); if (currentDirectory == null) { @@ -163,20 +181,34 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } - + /** + * Invoked when a content is changed. + */ public void fireContentsChanged() { - // System.out.println("BasicDirectoryModel: firecontentschanged"); - fireContentsChanged(this, 0, getSize()-1); + fireContentsChanged(this, 0, getSize() - 1); } public int getSize() { return fileCache.size(); } + /** + * Returns {@code true} if an element {@code o} is in file cache, + * otherwise, returns {@code false}. + * + * @param o an element + * @return {@code true} if an element {@code o} is in file cache + */ public boolean contains(Object o) { return fileCache.contains(o); } + /** + * Returns an index of element {@code o} in file cache. + * + * @param o an element + * @return an index of element {@code o} in file cache + */ public int indexOf(Object o) { return fileCache.indexOf(o); } @@ -197,6 +229,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr public void intervalRemoved(ListDataEvent e) { } + /** + * Sorts a list of files. + * + * @param v a list of files + */ protected void sort(Vector v){ ShellFolder.sort(v); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java index d3e0bb795ec..941f09b28fb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,16 +40,30 @@ import java.awt.event.InputEvent; import sun.swing.SwingUtilities2; -/* +/** + * Convenient util class. + * * @author Hans Muller */ - public class BasicGraphicsUtils { private static final Insets GROOVE_INSETS = new Insets(2, 2, 2, 2); private static final Insets ETCHED_INSETS = new Insets(2, 2, 2, 2); + /** + * Draws an etched rectangle. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color highlighting + * @param lightHighlight a color of light highlighting + */ public static void drawEtchedRect(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight) @@ -89,6 +103,17 @@ public class BasicGraphicsUtils } + /** + * Draws a groove. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param shadow a color of shadow + * @param highlight a color highlighting + */ public static void drawGroove(Graphics g, int x, int y, int w, int h, Color shadow, Color highlight) { @@ -120,6 +145,21 @@ public class BasicGraphicsUtils } + /** + * Draws a bezel. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param isPressed is component pressed + * @param isDefault is default drawing + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color highlighting + * @param lightHighlight a color of light highlighting + */ public static void drawBezel(Graphics g, int x, int y, int w, int h, boolean isPressed, boolean isDefault, Color shadow, Color darkShadow, @@ -176,6 +216,19 @@ public class BasicGraphicsUtils g.setColor(oldColor); } + /** + * Draws a lowered bezel. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color highlighting + * @param lightHighlight a color of light highlighting + */ public static void drawLoweredBezel(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { @@ -197,11 +250,17 @@ public class BasicGraphicsUtils } - /** Draw a string with the graphics g at location (x,y) - * just like g.drawString would. - * The first occurrence of underlineChar - * in text will be underlined. The matching algorithm is - * not case sensitive. + /** + * Draw a string with the graphics {@code g} at location (x,y) + * just like {@code g.drawString} would. The first occurrence + * of {@code underlineChar} in text will be underlined. + * The matching algorithm is not case sensitive. + * + * @param g an instance of {@code Graphics} + * @param text a text + * @param underlinedChar an underlined char + * @param x an X coordinate + * @param y an Y coordinate */ public static void drawString(Graphics g,String text,int underlinedChar,int x,int y) { int index=-1; @@ -244,9 +303,18 @@ public class BasicGraphicsUtils public static void drawStringUnderlineCharAt(Graphics g, String text, int underlinedIndex, int x,int y) { SwingUtilities2.drawStringUnderlineCharAt(null, g, text, - underlinedIndex, x, y); + underlinedIndex, x, y); } + /** + * Draws dashed rectangle. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param width a width of rectangle + * @param height a height of rectangle + */ public static void drawDashedRect(Graphics g,int x,int y,int width,int height) { int vx,vy; @@ -263,6 +331,13 @@ public class BasicGraphicsUtils } } + /** + * Returns the preferred size of the button. + * + * @param b an instance of {@code AbstractButton} + * @param textIconGap a gap between text and icon + * @return the preferred size of the button + */ public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { if(b.getComponentCount() > 0) { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java index 02719839496..0c0559948e5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java @@ -48,6 +48,10 @@ public class BasicHTML { /** * Create an html renderer for the given component and * string of html. + * + * @param c a component + * @param html an HTML string + * @return an HTML renderer */ public static View createHTMLView(JComponent c, String html) { BasicEditorKit kit = getFactory(); @@ -178,6 +182,10 @@ public class BasicHTML { * Check the given string to see if it should trigger the * html rendering logic in a non-text component that supports * html rendering. + * + * @param s a text + * @return {@code true} if the given string should trigger the + * html rendering logic in a non-text component */ public static boolean isHTMLString(String s) { if (s != null) { @@ -198,6 +206,9 @@ public class BasicHTML { * This method is useful for ComponentUI implementations * that are static (i.e. shared) and get their state * entirely from the JComponent. + * + * @param c a component + * @param text a text */ public static void updateRenderer(JComponent c, String text) { View value = null; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java index ec27f18dac1..638885127b2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java @@ -61,6 +61,11 @@ public class BasicIconFactory implements Serializable private static Icon menuItemArrowIcon; private static Icon menuArrowIcon; + /** + * Returns a menu item check icon. + * + * @return a menu item check icon + */ public static Icon getMenuItemCheckIcon() { if (menuItemCheckIcon == null) { menuItemCheckIcon = new MenuItemCheckIcon(); @@ -68,6 +73,11 @@ public class BasicIconFactory implements Serializable return menuItemCheckIcon; } + /** + * Returns a menu item arrow icon. + * + * @return a menu item arrow icon + */ public static Icon getMenuItemArrowIcon() { if (menuItemArrowIcon == null) { menuItemArrowIcon = new MenuItemArrowIcon(); @@ -75,6 +85,11 @@ public class BasicIconFactory implements Serializable return menuItemArrowIcon; } + /** + * Returns a menu arrow icon. + * + * @return a menu arrow icon + */ public static Icon getMenuArrowIcon() { if (menuArrowIcon == null) { menuArrowIcon = new MenuArrowIcon(); @@ -82,6 +97,11 @@ public class BasicIconFactory implements Serializable return menuArrowIcon; } + /** + * Returns a check box icon. + * + * @return a check box icon + */ public static Icon getCheckBoxIcon() { if (checkBoxIcon == null) { checkBoxIcon = new CheckBoxIcon(); @@ -89,6 +109,11 @@ public class BasicIconFactory implements Serializable return checkBoxIcon; } + /** + * Returns a radio button icon. + * + * @return a radio button icon + */ public static Icon getRadioButtonIcon() { if (radioButtonIcon == null) { radioButtonIcon = new RadioButtonIcon(); @@ -96,6 +121,11 @@ public class BasicIconFactory implements Serializable return radioButtonIcon; } + /** + * Returns a check box menu item icon. + * + * @return a check box menu item icon + */ public static Icon getCheckBoxMenuItemIcon() { if (checkBoxMenuItemIcon == null) { checkBoxMenuItemIcon = new CheckBoxMenuItemIcon(); @@ -103,6 +133,11 @@ public class BasicIconFactory implements Serializable return checkBoxMenuItemIcon; } + /** + * Returns a radio button menu item icon. + * + * @return a radio button menu item icon + */ public static Icon getRadioButtonMenuItemIcon() { if (radioButtonMenuItemIcon == null) { radioButtonMenuItemIcon = new RadioButtonMenuItemIcon(); @@ -110,6 +145,11 @@ public class BasicIconFactory implements Serializable return radioButtonMenuItemIcon; } + /** + * Returns an empty frame icon. + * + * @return an empty frame icon + */ public static Icon createEmptyFrameIcon() { if(frame_icon == null) frame_icon = new EmptyFrameIcon(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java index 75b10bef987..2892a49afc7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,11 +54,29 @@ import javax.swing.plaf.*; * @author Arnaud Weber */ public class BasicMenuBarUI extends MenuBarUI { + + /** + * The instance of {@code JMenuBar}. + */ protected JMenuBar menuBar = null; + + /** + * The instance of {@code ContainerListener}. + */ protected ContainerListener containerListener; + + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener changeListener; private Handler handler; + /** + * Returns a new instance of {@code BasicMenuBarUI}. + * + * @param x a component + * @return a new instance of {@code BasicMenuBarUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicMenuBarUI(); } @@ -76,6 +94,9 @@ public class BasicMenuBarUI extends MenuBarUI { } + /** + * Installs default properties. + */ protected void installDefaults() { if (menuBar.getLayout() == null || menuBar.getLayout() instanceof UIResource) { @@ -90,6 +111,9 @@ public class BasicMenuBarUI extends MenuBarUI { "MenuBar.font"); } + /** + * Registers listeners. + */ protected void installListeners() { containerListener = createContainerListener(); changeListener = createChangeListener(); @@ -102,6 +126,9 @@ public class BasicMenuBarUI extends MenuBarUI { menuBar.addContainerListener(containerListener); } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); @@ -131,12 +158,18 @@ public class BasicMenuBarUI extends MenuBarUI { menuBar = null; } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { if (menuBar!=null) { LookAndFeel.uninstallBorder(menuBar); } } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { menuBar.removeContainerListener(containerListener); @@ -151,16 +184,29 @@ public class BasicMenuBarUI extends MenuBarUI { handler = null; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIInputMap(menuBar, JComponent. WHEN_IN_FOCUSED_WINDOW, null); SwingUtilities.replaceUIActionMap(menuBar, null); } + /** + * Returns an instance of {@code ContainerListener}. + * + * @return an instance of {@code ContainerListener} + */ protected ContainerListener createContainerListener() { return getHandler(); } + /** + * Returns an instance of {@code ChangeListener}. + * + * @return an instance of {@code ChangeListener} + */ protected ChangeListener createChangeListener() { return getHandler(); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java index 2ea9fb920ab..7231ae2a570 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java @@ -48,7 +48,14 @@ import java.util.ArrayList; */ public class BasicMenuUI extends BasicMenuItemUI { + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener changeListener; + + /** + * The instance of {@code MenuListener}. + */ protected MenuListener menuListener; private int lastMnemonic = 0; @@ -63,6 +70,12 @@ public class BasicMenuUI extends BasicMenuItemUI private static boolean crossMenuMnemonic = true; + /** + * Constructs a new instance of {@code BasicMenuUI}. + * + * @param x a component + * @return a new instance of {@code BasicMenuUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicMenuUI(); } @@ -152,10 +165,22 @@ public class BasicMenuUI extends BasicMenuItemUI return getHandler(); } + /** + * Returns an instance of {@code MenuListener}. + * + * @param c a component + * @return an instance of {@code MenuListener} + */ protected MenuListener createMenuListener(JComponent c) { return null; } + /** + * Returns an instance of {@code ChangeListener}. + * + * @param c a component + * @return an instance of {@code ChangeListener} + */ protected ChangeListener createChangeListener(JComponent c) { return null; } @@ -208,6 +233,11 @@ public class BasicMenuUI extends BasicMenuItemUI return null; } + /** + * Sets timer to the {@code menu}. + * + * @param menu an instance of {@code JMenu}. + */ protected void setupPostTimer(JMenu menu) { Timer timer = new Timer(menu.getDelay(), new Actions( Actions.SELECT, menu,false)); @@ -388,11 +418,32 @@ public class BasicMenuUI extends BasicMenuItemUI * is now obsolete. KeyBindings are now managed by the popup menu. */ public class ChangeHandler implements ChangeListener { + /** + * The instance of {@code JMenu}. + */ public JMenu menu; + + /** + * The instance of {@code BasicMenuUI}. + */ public BasicMenuUI ui; + + /** + * {@code true} if an item of popup menu is selected. + */ public boolean isSelected = false; + + /** + * The component that was focused. + */ public Component wasFocused; + /** + * Constructs a new instance of {@code ChangeHandler}. + * + * @param m an instance of {@code JMenu} + * @param ui an instance of {@code BasicMenuUI} + */ public ChangeHandler(JMenu m, BasicMenuUI ui) { menu = m; this.ui = ui; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java index 985fae73f4f..46929bcca69 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,12 @@ public class BasicPanelUI extends PanelUI { // Shared UI object private static PanelUI panelUI; + /** + * Returns an instance of {@code BasicPanelUI}. + * + * @param c a component + * @return an instance of {@code BasicPanelUI} + */ public static ComponentUI createUI(JComponent c) { if(panelUI == null) { panelUI = new BasicPanelUI(); @@ -62,6 +68,11 @@ public class BasicPanelUI extends PanelUI { super.uninstallUI(c); } + /** + * Method for installing panel properties. + * + * @param p an instance of {@code JPanel} + */ protected void installDefaults(JPanel p) { LookAndFeel.installColorsAndFont(p, "Panel.background", @@ -71,6 +82,11 @@ public class BasicPanelUI extends PanelUI { LookAndFeel.installProperty(p, "opaque", Boolean.TRUE); } + /** + * Method for uninstalling panel properties. + * + * @param p an instance of {@code JPanel} + */ protected void uninstallDefaults(JPanel p) { LookAndFeel.uninstallBorder(p); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java index ded6ad243d2..9122beae1f0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,12 @@ import javax.swing.plaf.ComponentUI; public class BasicPopupMenuSeparatorUI extends BasicSeparatorUI { + /** + * Returns a new instance of {@code BasicPopupMenuSeparatorUI}. + * + * @param c a component + * @return a new instance of {@code BasicPopupMenuSeparatorUI} + */ public static ComponentUI createUI( JComponent c ) { return new BasicPopupMenuSeparatorUI(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java index 517615ac846..e9d878a2ca2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,6 +66,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { static final StringBuilder MENU_KEYBOARD_HELPER_KEY = new StringBuilder( "javax.swing.plaf.basic.BasicPopupMenuUI.MenuKeyboardHelper"); + /** + * The instance of {@code JPopupMenu}. + */ protected JPopupMenu popupMenu = null; private transient PopupMenuListener popupMenuListener = null; private MenuKeyListener menuKeyListener = null; @@ -73,10 +76,19 @@ public class BasicPopupMenuUI extends PopupMenuUI { private static boolean checkedUnpostPopup; private static boolean unpostPopup; + /** + * Constructs a new instance of {@code BasicPopupMenuUI}. + * + * @param x a component + * @return a new instance of {@code BasicPopupMenuUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicPopupMenuUI(); } + /** + * Constructs a new instance of {@code BasicPopupMenuUI}. + */ public BasicPopupMenuUI() { BasicLookAndFeel.needsEventHelper = true; LookAndFeel laf = UIManager.getLookAndFeel(); @@ -93,6 +105,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { installKeyboardActions(); } + /** + * Installs default properties. + */ public void installDefaults() { if (popupMenu.getLayout() == null || popupMenu.getLayout() instanceof UIResource) @@ -101,11 +116,14 @@ public class BasicPopupMenuUI extends PopupMenuUI { LookAndFeel.installProperty(popupMenu, "opaque", Boolean.TRUE); LookAndFeel.installBorder(popupMenu, "PopupMenu.border"); LookAndFeel.installColorsAndFont(popupMenu, - "PopupMenu.background", - "PopupMenu.foreground", - "PopupMenu.font"); + "PopupMenu.background", + "PopupMenu.foreground", + "PopupMenu.font"); } + /** + * Registers listeners. + */ protected void installListeners() { if (popupMenuListener == null) { popupMenuListener = new BasicPopupMenuListener(); @@ -138,6 +156,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { } } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { } @@ -181,10 +202,16 @@ public class BasicPopupMenuUI extends PopupMenuUI { popupMenu = null; } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(popupMenu); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { if (popupMenuListener != null) { popupMenu.removePopupMenuListener(popupMenuListener); @@ -194,6 +221,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { } } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIActionMap(popupMenu, null); SwingUtilities.replaceUIInputMap(popupMenu, diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java index 99c8e3aaabb..6030aa743e1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,12 @@ import javax.swing.border.*; */ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI { + /** + * Returns a new instance of {@code BasicRadioButtonMenuItemUI}. + * + * @param b a component + * @return a new instance of {@code BasicRadioButtonMenuItemUI} + */ public static ComponentUI createUI(JComponent b) { return new BasicRadioButtonMenuItemUI(); } @@ -47,6 +53,14 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI return "RadioButtonMenuItem"; } + /** + * Invoked when mouse event occurs. + * + * @param item a menu item + * @param e a mouse event + * @param path an array of {@code MenuElement} + * @param manager an instance of {@code MenuSelectionManager} + */ public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) { Point p = e.getPoint(); if(p.x >= 0 && p.x < item.getWidth() && diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java index 47c9b7d75f8..ec9e88defe1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,9 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI { private static final Object BASIC_RADIO_BUTTON_UI_KEY = new Object(); + /** + * The icon. + */ protected Icon icon; private boolean defaults_initialized = false; @@ -53,6 +56,13 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI // ******************************** // Create PLAF // ******************************** + + /** + * Returns an instance of {@code BasicRadioButtonUI}. + * + * @param b a component + * @return an instance of {@code BasicRadioButtonUI} + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); BasicRadioButtonUI radioButtonUI = @@ -87,6 +97,11 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI defaults_initialized = false; } + /** + * Returns the default icon. + * + * @return the default icon + */ public Icon getDefaultIcon() { return icon; } @@ -195,6 +210,13 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI } } + /** + * Paints focused radio button. + * + * @param g an instance of {@code Graphics} + * @param textRect bounds + * @param size the size of radio button + */ protected void paintFocus(Graphics g, Rectangle textRect, Dimension size){ } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java index 5c999e0089d..300e46a2e7b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java @@ -48,6 +48,12 @@ public class BasicRootPaneUI extends RootPaneUI implements PropertyChangeListener { private static RootPaneUI rootPaneUI = new BasicRootPaneUI(); + /** + * Returns a new instance of {@code BasicRootPaneUI}. + * + * @param c a component + * @return a new instance of {@code BasicRootPaneUI} + */ public static ComponentUI createUI(JComponent c) { return rootPaneUI; } @@ -67,17 +73,37 @@ public class BasicRootPaneUI extends RootPaneUI implements uninstallKeyboardActions((JRootPane)c); } + /** + * Installs default properties. + * + * @param c an instance of {@code JRootPane} + */ protected void installDefaults(JRootPane c){ LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); } + /** + * Installs components. + * + * @param root an instance of {@code JRootPane} + */ protected void installComponents(JRootPane root) { } + /** + * Registers listeners. + * + * @param root an instance of {@code JRootPane} + */ protected void installListeners(JRootPane root) { root.addPropertyChangeListener(this); } + /** + * Registers keyboard actions. + * + * @param root an instance of {@code JRootPane} + */ protected void installKeyboardActions(JRootPane root) { InputMap km = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, root); SwingUtilities.replaceUIInputMap(root, @@ -92,19 +118,39 @@ public class BasicRootPaneUI extends RootPaneUI implements updateDefaultButtonBindings(root); } + /** + * Uninstalls default properties. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallDefaults(JRootPane root) { } + /** + * Unregisters components. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallComponents(JRootPane root) { } + /** + * Unregisters listeners. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallListeners(JRootPane root) { root.removePropertyChangeListener(this); } + /** + * Unregisters keyboard actions. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallKeyboardActions(JRootPane root) { SwingUtilities.replaceUIInputMap(root, JComponent. - WHEN_IN_FOCUSED_WINDOW, null); + WHEN_IN_FOCUSED_WINDOW, null); SwingUtilities.replaceUIActionMap(root, null); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java index 0a83867618c..8df41cb647a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,9 +45,22 @@ import javax.swing.plaf.SeparatorUI; public class BasicSeparatorUI extends SeparatorUI { + /** + * The color of the shadow. + */ protected Color shadow; + + /** + * The color of the highlighting. + */ protected Color highlight; + /** + * Returns a new instance of {@code BasicSeparatorUI}. + * + * @param c a component + * @return a new instance of {@code BasicSeparatorUI} + */ public static ComponentUI createUI( JComponent c ) { return new BasicSeparatorUI(); @@ -65,20 +78,40 @@ public class BasicSeparatorUI extends SeparatorUI uninstallListeners( (JSeparator)c ); } + /** + * Installs default properties. + * + * @param s an instance of {@code JSeparator} + */ protected void installDefaults( JSeparator s ) { - LookAndFeel.installColors( s, "Separator.background", "Separator.foreground" ); - LookAndFeel.installProperty( s, "opaque", Boolean.FALSE); + LookAndFeel.installColors(s, "Separator.background", "Separator.foreground"); + LookAndFeel.installProperty(s, "opaque", Boolean.FALSE); } + /** + * Uninstalls default properties. + * + * @param s an instance of {@code JSeparator} + */ protected void uninstallDefaults( JSeparator s ) { } + /** + * Registers listeners. + * + * @param s an instance of {@code JSeparator} + */ protected void installListeners( JSeparator s ) { } + /** + * Unregisters listeners. + * + * @param s an instance of {@code JSeparator} + */ protected void uninstallListeners( JSeparator s ) { } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java index 01c408382cd..ee9cdefbe90 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java @@ -400,6 +400,8 @@ public class BasicSpinnerUI extends SpinnerUI * The implementation of replaceEditor should be coordinated * with the createEditor method. * + * @param oldEditor an old instance of editor + * @param newEditor a new instance of editor * @see #createEditor * @see #createPropertyChangeListener */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java index cdf38579fc8..4c8bb1d94d5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java @@ -49,11 +49,19 @@ public class BasicTableHeaderUI extends TableHeaderUI { // Instance Variables // - /** The JTableHeader that is delegating the painting to this UI. */ + /** + * The {@code JTableHeader} that is delegating the painting to this UI. + */ protected JTableHeader header; + + /** + * The instance of {@code CellRendererPane}. + */ protected CellRendererPane rendererPane; - // Listeners that are attached to the JTable + /** + * Listeners that are attached to the {@code JTable} + */ protected MouseInputListener mouseInputListener; // The column header over which the mouse currently is. @@ -300,7 +308,9 @@ public class BasicTableHeaderUI extends TableHeaderUI { // /** - * Creates the mouse listener for the JTableHeader. + * Creates the mouse listener for the {@code JTableHeader}. + * + * @return the mouse listener for the {@code JTableHeader} */ protected MouseInputListener createMouseInputListener() { return new MouseInputHandler(); @@ -310,6 +320,12 @@ public class BasicTableHeaderUI extends TableHeaderUI { // The installation/uninstall procedures and support // + /** + * Returns a new instance of {@code BasicTableHeaderUI}. + * + * @param h a component. + * @return a new instance of {@code BasicTableHeaderUI} + */ public static ComponentUI createUI(JComponent h) { return new BasicTableHeaderUI(); } @@ -376,8 +392,14 @@ public class BasicTableHeaderUI extends TableHeaderUI { header = null; } + /** + * Uninstalls default properties + */ protected void uninstallDefaults() {} + /** + * Unregisters listeners. + */ protected void uninstallListeners() { header.removeMouseListener(mouseInputListener); header.removeMouseMotionListener(mouseInputListener); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 0965c77789f..2b23f9c0a0e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -443,6 +443,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { protected void uninstallListeners() { } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { // backward compatibility support... keymaps for the UI // are now installed in the more friendly input map. @@ -637,6 +640,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { return map; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { editor.setKeymap(null); SwingUtilities.replaceUIInputMap(editor, JComponent. @@ -1280,8 +1286,14 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { return null; } + /** + * Default implementation of the interface {@code Caret}. + */ public static class BasicCaret extends DefaultCaret implements UIResource {} + /** + * Default implementation of the interface {@code Highlighter}. + */ public static class BasicHighlighter extends DefaultHighlighter implements UIResource {} static class BasicCursor extends Cursor implements UIResource { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java index 163a5cd2b46..5f394dbbefb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,13 @@ public class BasicToggleButtonUI extends BasicButtonUI { // ******************************** // Create PLAF // ******************************** + + /** + * Returns an instance of {@code BasicToggleButtonUI}. + * + * @param b a component + * @return an instance of {@code BasicToggleButtonUI} + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); BasicToggleButtonUI toggleButtonUI = @@ -127,6 +134,13 @@ public class BasicToggleButtonUI extends BasicButtonUI { } } + /** + * Paints an icon in the specified location. + * + * @param g an instance of {@code Graphics} + * @param b an instance of {@code Button} + * @param iconRect bounds of an icon + */ protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect) { ButtonModel model = b.getModel(); Icon icon = null; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java index 1f2aac7e597..4a5dd209df0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,12 @@ import javax.swing.plaf.basic.BasicSeparatorUI; public class BasicToolBarSeparatorUI extends BasicSeparatorUI { + /** + * Returns a new instance of {@code BasicToolBarSeparatorUI}. + * + * @param c a component + * @return a new instance of {@code BasicToolBarSeparatorUI} + */ public static ComponentUI createUI( JComponent c ) { return new BasicToolBarSeparatorUI(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java index 95a951cc6f9..8f79c7566fe 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,10 +55,19 @@ public class BasicToolTipUI extends ToolTipUI private PropertyChangeListener propertyChangeListener; + /** + * Returns the instance of {@code BasicToolTipUI}. + * + * @param c a component + * @return the instance of {@code BasicToolTipUI} + */ public static ComponentUI createUI(JComponent c) { return sharedInstance; } + /** + * Constructs a new instance of {@code BasicToolTipUI}. + */ public BasicToolTipUI() { super(); } @@ -76,22 +85,32 @@ public class BasicToolTipUI extends ToolTipUI uninstallListeners(c); } + /** + * Installs default properties. + * + * @param c a component + */ protected void installDefaults(JComponent c){ LookAndFeel.installColorsAndFont(c, "ToolTip.background", - "ToolTip.foreground", - "ToolTip.font"); + "ToolTip.foreground", + "ToolTip.font"); LookAndFeel.installProperty(c, "opaque", Boolean.TRUE); componentChanged(c); } - protected void uninstallDefaults(JComponent c){ + /** + * Uninstalls default properties. + * + * @param c a component + */ + protected void uninstallDefaults(JComponent c){ LookAndFeel.uninstallBorder(c); } /* Unfortunately this has to remain private until we can make API additions. */ private void installComponents(JComponent c){ - BasicHTML.updateRenderer(c, ((JToolTip)c).getTipText()); + BasicHTML.updateRenderer(c, ((JToolTip) c).getTipText()); } /* Unfortunately this has to remain private until we can make API additions. @@ -100,12 +119,22 @@ public class BasicToolTipUI extends ToolTipUI BasicHTML.updateRenderer(c, ""); } + /** + * Registers listeners. + * + * @param c a component + */ protected void installListeners(JComponent c) { propertyChangeListener = createPropertyChangeListener(c); c.addPropertyChangeListener(propertyChangeListener); } + /** + * Unregisters listeners. + * + * @param c a component + */ protected void uninstallListeners(JComponent c) { c.removePropertyChangeListener(propertyChangeListener); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java index 70dad3c3c0d..3620bdbcff8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,12 @@ public class BasicViewportUI extends ViewportUI { // Shared UI object private static ViewportUI viewportUI; + /** + * Returns an instance of {@code BasicViewportUI}. + * + * @param c a component + * @return an instance of {@code BasicViewportUI} + */ public static ComponentUI createUI(JComponent c) { if(viewportUI == null) { viewportUI = new BasicViewportUI(); @@ -60,6 +66,11 @@ public class BasicViewportUI extends ViewportUI { super.uninstallUI(c); } + /** + * Installs view port properties. + * + * @param c a component + */ protected void installDefaults(JComponent c) { LookAndFeel.installColorsAndFont(c, "Viewport.background", @@ -68,6 +79,11 @@ public class BasicViewportUI extends ViewportUI { LookAndFeel.installProperty(c, "opaque", Boolean.TRUE); } + /** + * Uninstall view port properties. + * + * @param c a component + */ protected void uninstallDefaults(JComponent c) { } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java b/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java index bd520c6e38e..f9c260d0653 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java @@ -69,6 +69,8 @@ public interface ComboPopup { * Returns the list that is being used to draw the items in the combo box. * This method is highly implementation specific and should not be used * for general list manipulation. + * + * @return the list that is being used to draw the items in the combo box */ public JList getList(); @@ -91,6 +93,8 @@ public interface ComboPopup { /** * Returns a key listener that will be added to the combo box or null. * If this method returns null then it will not be added to the combo box. + * + * @return a key listener that will be added to the combo box or null */ public KeyListener getKeyListener(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java index 627c3702a73..730897a93d8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java @@ -41,6 +41,17 @@ import java.awt.Dimension; */ @SuppressWarnings("serial") // Superclass is not serializable across versions public class DefaultMenuLayout extends BoxLayout implements UIResource { + + /** + * Constructs a new instance of {@code DefaultMenuLayout}. + * + * @param target the container that needs to be laid out + * @param axis the axis to lay out components along. Can be one of: + * {@code BoxLayout.X_AXIS}, + * {@code BoxLayout.Y_AXIS}, + * {@code BoxLayout.LINE_AXIS} or + * {@code BoxLayout.PAGE_AXIS} + */ public DefaultMenuLayout(Container target, int axis) { super(target, axis); } From 91a46ed171d2db67765dca7dabee2042a3acbcb5 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Fri, 27 Jun 2014 10:29:08 -0700 Subject: [PATCH 07/94] 8044862: Fix raw and unchecked lint warnings in macosx specific code Reviewed-by: darcy, pchelko --- .../classes/apple/security/KeychainStore.java | 32 +++++++-------- .../com/apple/eawt/_AppDockIconHandler.java | 2 +- .../classes/com/apple/laf/AquaBorder.java | 2 +- .../com/apple/laf/AquaComboBoxButton.java | 11 +++-- .../com/apple/laf/AquaComboBoxPopup.java | 8 ++-- .../com/apple/laf/AquaComboBoxRenderer.java | 4 +- .../laf/AquaComboBoxRendererInternal.java | 11 +++-- .../classes/com/apple/laf/AquaComboBoxUI.java | 29 ++++++------- .../com/apple/laf/AquaFileChooserUI.java | 41 +++++++++++-------- .../com/apple/laf/AquaFocusHandler.java | 4 +- .../classes/com/apple/laf/AquaListUI.java | 6 +-- .../laf/AquaTabbedPaneCopyFromBasicUI.java | 2 +- .../com/apple/laf/AquaTableHeaderUI.java | 1 + .../com/apple/laf/AquaUtilControlSize.java | 2 +- .../classes/com/apple/laf/AquaUtils.java | 6 ++- .../apple/laf/ClientPropertyApplicator.java | 1 + .../classes/com/apple/laf/ScreenMenuBar.java | 1 + .../lwawt/macosx/CDragSourceContextPeer.java | 6 +-- .../sun/lwawt/macosx/CInputMethod.java | 13 +++--- .../lwawt/macosx/CInputMethodDescriptor.java | 4 +- .../sun/lwawt/macosx/CPlatformWindow.java | 2 +- .../classes/sun/lwawt/macosx/LWCToolkit.java | 4 +- 22 files changed, 107 insertions(+), 85 deletions(-) diff --git a/jdk/src/macosx/classes/apple/security/KeychainStore.java b/jdk/src/macosx/classes/apple/security/KeychainStore.java index 8df45d7bea7..8d04ee976f6 100644 --- a/jdk/src/macosx/classes/apple/security/KeychainStore.java +++ b/jdk/src/macosx/classes/apple/security/KeychainStore.java @@ -74,19 +74,19 @@ public final class KeychainStore extends KeyStoreSpi { * Entries that have been deleted. When something calls engineStore we'll * remove them from the keychain. */ - private Hashtable deletedEntries = new Hashtable(); + private Hashtable deletedEntries = new Hashtable<>(); /** * Entries that have been added. When something calls engineStore we'll * add them to the keychain. */ - private Hashtable addedEntries = new Hashtable(); + private Hashtable addedEntries = new Hashtable<>(); /** * Private keys and certificates are stored in a hashtable. * Hash entries are keyed by alias names. */ - private Hashtable entries = new Hashtable(); + private Hashtable entries = new Hashtable<>(); /** * Algorithm identifiers and corresponding OIDs for the contents of the PKCS12 bag we get from the Keychain. @@ -471,7 +471,7 @@ public final class KeychainStore extends KeyStoreSpi { // This will be slow, but necessary. Enumerate the values and then see if the cert matches the one in the trusted cert entry. // Security framework doesn't support the same certificate twice in a keychain. - Collection allValues = entries.values(); + Collection allValues = entries.values(); for (Object value : allValues) { if (value instanceof TrustedCertEntry) { @@ -517,7 +517,7 @@ public final class KeychainStore extends KeyStoreSpi { * * @return enumeration of the alias names */ - public Enumeration engineAliases() { + public Enumeration engineAliases() { permissionCheck(); return entries.keys(); } @@ -598,8 +598,8 @@ public final class KeychainStore extends KeyStoreSpi { permissionCheck(); Certificate certElem; - for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = entries.get(alias); if (entry instanceof TrustedCertEntry) { certElem = ((TrustedCertEntry)entry).cert; @@ -634,8 +634,8 @@ public final class KeychainStore extends KeyStoreSpi { permissionCheck(); // Delete items that do have a keychain item ref. - for (Enumeration e = deletedEntries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = deletedEntries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = deletedEntries.get(alias); if (entry instanceof TrustedCertEntry) { if (((TrustedCertEntry)entry).certRef != 0) { @@ -664,8 +664,8 @@ public final class KeychainStore extends KeyStoreSpi { // Add all of the certs or keys in the added entries. // No need to check for 0 refs, as they are in the added list. - for (Enumeration e = addedEntries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = addedEntries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = addedEntries.get(alias); if (entry instanceof TrustedCertEntry) { TrustedCertEntry tce = (TrustedCertEntry)entry; @@ -730,8 +730,8 @@ public final class KeychainStore extends KeyStoreSpi { // Release any stray keychain references before clearing out the entries. synchronized(entries) { - for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = entries.get(alias); if (entry instanceof TrustedCertEntry) { if (((TrustedCertEntry)entry).certRef != 0) { @@ -816,7 +816,7 @@ public final class KeychainStore extends KeyStoreSpi { // Next, create X.509 Certificate objects from the raw data. This is complicated // because a certificate's public key may be too long for Java's default encryption strength. - List createdCerts = new ArrayList(); + List createdCerts = new ArrayList<>(); try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); @@ -842,12 +842,12 @@ public final class KeychainStore extends KeyStoreSpi { // We have our certificates in the List, so now extract them into an array of // Certificates and SecCertificateRefs. - Object[] objArray = createdCerts.toArray(); + CertKeychainItemPair[] objArray = createdCerts.toArray(new CertKeychainItemPair[0]); Certificate[] certArray = new Certificate[objArray.length]; long[] certRefArray = new long[objArray.length]; for (int i = 0; i < objArray.length; i++) { - CertKeychainItemPair addedItem = (CertKeychainItemPair)objArray[i]; + CertKeychainItemPair addedItem = objArray[i]; certArray[i] = addedItem.mCert; certRefArray[i] = addedItem.mCertificateRef; } diff --git a/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java b/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java index e91efeaa009..76dea3a7ed3 100644 --- a/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java +++ b/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java @@ -95,7 +95,7 @@ class _AppDockIconHandler { static Creator getCImageCreator() { try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); + final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); getCreatorMethod.setAccessible(true); return (Creator)getCreatorMethod.invoke(null, new Object[] {}); } catch (final Throwable e) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java b/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java index dfb6fddd5ce..e9eda68094c 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java @@ -75,7 +75,7 @@ public abstract class AquaBorder implements Border, UIResource { protected AquaBorder deriveBorderForSize(final Size size) { try { final Class clazz = getClass(); - final AquaBorder border = clazz.getConstructor(new Class[] { clazz }).newInstance(new Object[] { this }); + final AquaBorder border = clazz.getConstructor(new Class[] { clazz }).newInstance(new Object[] { this }); border.setSize(size); return border; } catch (final Throwable e) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java index 2867245ee1e..c87bcb78c04 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java @@ -35,8 +35,8 @@ import apple.laf.JRSUIConstants.*; @SuppressWarnings("serial") // Superclass is not serializable across versions class AquaComboBoxButton extends JButton { - final protected JComboBox comboBox; - final protected JList list; + final protected JComboBox comboBox; + final protected JList list; final protected CellRendererPane rendererPane; final protected AquaComboBoxUI ui; @@ -45,7 +45,10 @@ class AquaComboBoxButton extends JButton { boolean isSquare; @SuppressWarnings("serial") // anonymous class - protected AquaComboBoxButton(final AquaComboBoxUI ui, final JComboBox comboBox, final CellRendererPane rendererPane, final JList list) { + protected AquaComboBoxButton(final AquaComboBoxUI ui, + final JComboBox comboBox, + final CellRendererPane rendererPane, + final JList list) { super(""); putClientProperty("JButton.buttonType", "comboboxInternal"); @@ -163,7 +166,7 @@ class AquaComboBoxButton extends JButton { } protected void doRendererPaint(final Graphics g, final ButtonModel buttonModel, final boolean editable, final Insets insets, int left, int top, int width, int height) { - final ListCellRenderer renderer = comboBox.getRenderer(); + final ListCellRenderer renderer = comboBox.getRenderer(); // fake it out! not renderPressed final Component c = renderer.getListCellRendererComponent(list, comboBox.getSelectedItem(), -1, false, false); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java index dde9b1be337..0f466e188e6 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java @@ -43,7 +43,7 @@ class AquaComboBoxPopup extends BasicComboPopup { protected Component bottomStrut; protected boolean isPopDown = false; - public AquaComboBoxPopup(final JComboBox cBox) { + public AquaComboBoxPopup(final JComboBox cBox) { super(cBox); } @@ -93,7 +93,7 @@ class AquaComboBoxPopup extends BasicComboPopup { final int rowCount = Math.min(maxRowCount, currentElementCount); final Dimension popupSize = new Dimension(); - final ListCellRenderer renderer = list.getCellRenderer(); + final ListCellRenderer renderer = list.getCellRenderer(); for (int i = 0; i < rowCount; i++) { final Object value = list.getModel().getElementAt(i); @@ -149,8 +149,8 @@ class AquaComboBoxPopup extends BasicComboPopup { @Override @SuppressWarnings("serial") // anonymous class - protected JList createList() { - return new JList(comboBox.getModel()) { + protected JList createList() { + return new JList(comboBox.getModel()) { @Override public void processMouseEvent(MouseEvent e) { if (e.isMetaDown()) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java index 6161eb6447c..f4d4225efe0 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java @@ -29,8 +29,8 @@ import javax.swing.*; import javax.swing.plaf.UIResource; @SuppressWarnings("serial") // Superclass is not serializable across versions -class AquaComboBoxRenderer extends AquaComboBoxRendererInternal implements UIResource { - public AquaComboBoxRenderer(final JComboBox comboBox) { +class AquaComboBoxRenderer extends AquaComboBoxRendererInternal implements UIResource { + public AquaComboBoxRenderer(final JComboBox comboBox) { super(comboBox); } } diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java index 2ed6dcfcf70..cf1025f6a85 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java @@ -31,8 +31,8 @@ import javax.swing.*; import java.awt.*; @SuppressWarnings("serial") // Superclass is not serializable across versions -class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { - final JComboBox fComboBox; +class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { + final JComboBox fComboBox; boolean fSelected; boolean fChecked; boolean fInList; @@ -40,7 +40,7 @@ class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { boolean fDrawCheckedItem = true; // Provides space for a checkbox, and is translucent - public AquaComboBoxRendererInternal(final JComboBox comboBox) { + public AquaComboBoxRendererInternal(final JComboBox comboBox) { super(); fComboBox = comboBox; } @@ -72,7 +72,10 @@ class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { } // Really means is the one with the mouse over it - public Component getListCellRendererComponent(final JList list, final Object value, int index, final boolean isSelected, final boolean cellHasFocus) { + public Component getListCellRendererComponent(final JList list, + final E value, int index, + final boolean isSelected, + final boolean cellHasFocus) { fInList = (index >= 0); // When the button wants the item painted, it passes in -1 fSelected = isSelected; if (index < 0) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java index 75c7babb58a..80ca6ff5b49 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java @@ -102,13 +102,13 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { if (now - 1000 < lastBlink) return; lastBlink = now; - final JList itemList = popup.getList(); + final JList itemList = popup.getList(); final ListUI listUI = itemList.getUI(); if (!(listUI instanceof AquaListUI)) return; final AquaListUI aquaListUI = (AquaListUI)listUI; final int selectedIndex = comboBox.getSelectedIndex(); - final ListModel dataModel = itemList.getModel(); + final ListModel dataModel = itemList.getModel(); if (dataModel == null) return; final Object value = dataModel.getElementAt(selectedIndex); @@ -125,7 +125,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { // this space intentionally left blank } - protected ListCellRenderer createRenderer() { + protected ListCellRenderer createRenderer() { return new AquaComboBoxRenderer(comboBox); } @@ -185,7 +185,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { final Object text = editor.getText(); - final ListModel model = listBox.getModel(); + final ListModel model = listBox.getModel(); final int items = model.getSize(); for (int i = 0; i < items; i++) { final Object element = model.getElementAt(i); @@ -423,7 +423,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { return; } - final JComboBox cb = (JComboBox)parent; + final JComboBox cb = (JComboBox) parent; final int width = cb.getWidth(); final int height = cb.getHeight(); @@ -450,11 +450,11 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { return Boolean.TRUE.equals(c.getClientProperty(AquaComboBoxUI.IS_TABLE_CELL_EDITOR)); } - protected static boolean isPopdown(final JComboBox c) { + protected static boolean isPopdown(final JComboBox c) { return c.isEditable() || Boolean.TRUE.equals(c.getClientProperty(AquaComboBoxUI.POPDOWN_CLIENT_PROPERTY_KEY)); } - protected static void triggerSelectionEvent(final JComboBox comboBox, final ActionEvent e) { + protected static void triggerSelectionEvent(final JComboBox comboBox, final ActionEvent e) { if (!comboBox.isEnabled()) return; final AquaComboBoxUI aquaUi = (AquaComboBoxUI)comboBox.getUI(); @@ -505,7 +505,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { @SuppressWarnings("serial") // anonymous class private static final Action toggleSelectionAction = new AbstractAction() { public void actionPerformed(final ActionEvent e) { - final JComboBox comboBox = (JComboBox)e.getSource(); + final JComboBox comboBox = (JComboBox) e.getSource(); if (!comboBox.isEnabled()) return; if (comboBox.isEditable()) return; @@ -525,7 +525,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { private final Action hideAction = new AbstractAction() { @Override public void actionPerformed(final ActionEvent e) { - final JComboBox comboBox = (JComboBox)e.getSource(); + final JComboBox comboBox = (JComboBox) e.getSource(); comboBox.firePopupMenuCanceled(); comboBox.setPopupVisible(false); } @@ -588,10 +588,11 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { } @SuppressWarnings("unchecked") - static final RecyclableSingleton> APPLICATOR = new RecyclableSingleton>() { + static final RecyclableSingleton, AquaComboBoxUI>> APPLICATOR = new + RecyclableSingleton, AquaComboBoxUI>>() { @Override - protected ClientPropertyApplicator getInstance() { - return new ClientPropertyApplicator( + protected ClientPropertyApplicator, AquaComboBoxUI> getInstance() { + return new ClientPropertyApplicator, AquaComboBoxUI>( new Property(AquaFocusHandler.FRAME_ACTIVE_PROPERTY) { public void applyProperty(final AquaComboBoxUI target, final Object value) { if (Boolean.FALSE.equals(value)) { @@ -633,7 +634,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { } } ) { - public AquaComboBoxUI convertJComponentToTarget(final JComboBox combo) { + public AquaComboBoxUI convertJComponentToTarget(final JComboBox combo) { final ComboBoxUI comboUI = combo.getUI(); if (comboUI instanceof AquaComboBoxUI) return (AquaComboBoxUI)comboUI; return null; @@ -641,7 +642,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { }; } }; - static ClientPropertyApplicator getApplicator() { + static ClientPropertyApplicator, AquaComboBoxUI> getApplicator() { return APPLICATOR.get(); } } diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java index 3fae5e20310..ebb3b4b6433 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java @@ -724,6 +724,7 @@ public class AquaFileChooserUI extends FileChooserUI { final Transferable transferable = dtde.getTransferable(); try { + @SuppressWarnings("unchecked") final java.util.List fileList = (java.util.List)transferable.getTransferData(DataFlavor.javaFileListFlavor); dropFiles(fileList.toArray(new File[fileList.size()])); dtde.dropComplete(true); @@ -1144,11 +1145,14 @@ public class AquaFileChooserUI extends FileChooserUI { } @SuppressWarnings("serial") // anonymous class - protected ListCellRenderer createDirectoryComboBoxRenderer(final JFileChooser fc) { - return new AquaComboBoxRendererInternal(directoryComboBox) { - public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - final File directory = (File)value; + protected ListCellRenderer createDirectoryComboBoxRenderer(final JFileChooser fc) { + return new AquaComboBoxRendererInternal(directoryComboBox) { + public Component getListCellRendererComponent(final JList list, + final File directory, + final int index, + final boolean isSelected, + final boolean cellHasFocus) { + super.getListCellRendererComponent(list, directory, index, isSelected, cellHasFocus); if (directory == null) { setText(""); return this; @@ -1173,7 +1177,7 @@ public class AquaFileChooserUI extends FileChooserUI { * Data model for a type-face selection combo-box. */ @SuppressWarnings("serial") // Superclass is not serializable across versions - protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel { + protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel { Vector fDirectories = new Vector(); int topIndex = -1; int fPathCount = 0; @@ -1248,7 +1252,7 @@ public class AquaFileChooserUI extends FileChooserUI { return fDirectories.size(); } - public Object getElementAt(final int index) { + public File getElementAt(final int index) { return fDirectories.elementAt(index); } } @@ -1257,11 +1261,14 @@ public class AquaFileChooserUI extends FileChooserUI { // Renderer for Types ComboBox // @SuppressWarnings("serial") // anonymous class - protected ListCellRenderer createFilterComboBoxRenderer() { - return new AquaComboBoxRendererInternal(filterComboBox) { - public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - final FileFilter filter = (FileFilter)value; + protected ListCellRenderer createFilterComboBoxRenderer() { + return new AquaComboBoxRendererInternal(filterComboBox) { + public Component getListCellRendererComponent(final JList list, + final FileFilter filter, + final int index, + final boolean isSelected, + final boolean cellHasFocus) { + super.getListCellRendererComponent(list, filter, index, isSelected, cellHasFocus); if (filter != null) setText(filter.getDescription()); return this; } @@ -1356,7 +1363,7 @@ public class AquaFileChooserUI extends FileChooserUI { } public void actionPerformed(final ActionEvent e) { - getFileChooser().setFileFilter((FileFilter)filterComboBox.getSelectedItem()); + getFileChooser().setFileFilter((FileFilter) filterComboBox.getSelectedItem()); } } @@ -1503,7 +1510,7 @@ public class AquaFileChooserUI extends FileChooserUI { fTextfieldPanel.add(tPanel, BorderLayout.CENTER); // DirectoryComboBox, left-justified, 200x20 not including drop shadow - directoryComboBox = new JComboBox(); + directoryComboBox = new JComboBox<>(); directoryComboBox.putClientProperty("JComboBox.lightweightKeyboardNavigation", "Lightweight"); fDirectoryComboBoxModel = createDirectoryComboBoxModel(fc); directoryComboBox.setModel(fDirectoryComboBoxModel); @@ -1551,7 +1558,7 @@ public class AquaFileChooserUI extends FileChooserUI { // Combobox filterComboBoxModel = createFilterComboBoxModel(); fc.addPropertyChangeListener(filterComboBoxModel); - filterComboBox = new JComboBox(filterComboBoxModel); + filterComboBox = new JComboBox<>(filterComboBoxModel); formatLabel.setLabelFor(filterComboBox); filterComboBox.setRenderer(createFilterComboBoxRenderer()); d = new Dimension(220, (int)filterComboBox.getMinimumSize().getHeight()); @@ -1788,7 +1795,7 @@ public class AquaFileChooserUI extends FileChooserUI { } } - JComboBox directoryComboBox; + JComboBox directoryComboBox; DirectoryComboBoxModel fDirectoryComboBoxModel; private final Action directoryComboBoxAction = new DirectoryComboBoxAction(); @@ -1797,7 +1804,7 @@ public class AquaFileChooserUI extends FileChooserUI { JTableExtension fFileList; private FilterComboBoxModel filterComboBoxModel; - JComboBox filterComboBox; + JComboBox filterComboBox; private final Action filterComboBoxAction = new FilterComboBoxAction(); private static final Dimension hstrut10 = new Dimension(10, 1); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java b/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java index d5fec4e292c..1438d2c118c 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java @@ -131,7 +131,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener { c.setSelectionBackground(UIManager.getColor(bgName)); } - static void swapSelectionColors(final String prefix, final JList c, final Object value) { + static void swapSelectionColors(final String prefix, final JList c, final Object value) { if (!isComponentValid(c)) return; final Color bg = c.getSelectionBackground(); @@ -149,7 +149,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener { } } - static void setSelectionColors(final JList c, final String fgName, final String bgName) { + static void setSelectionColors(final JList c, final String fgName, final String bgName) { c.setSelectionForeground(UIManager.getColor(fgName)); c.setSelectionBackground(UIManager.getColor(bgName)); } diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java index 85d06468912..24217af311c 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java @@ -79,7 +79,7 @@ public class AquaListUI extends BasicListUI { * For a Home action, scrolls to the top. Otherwise, scroll to the end. */ public void actionPerformed(final ActionEvent e) { - final JList list = (JList)e.getSource(); + final JList list = (JList)e.getSource(); if (fHomeAction) { list.ensureIndexIsVisible(0); @@ -135,7 +135,7 @@ public class AquaListUI extends BasicListUI { }*/ } - JList getComponent() { + JList getComponent() { return list; } @@ -144,7 +144,7 @@ public class AquaListUI extends BasicListUI { final Rectangle rowBounds = getCellBounds(list, selectedIndex, selectedIndex); if (rowBounds == null) return; - final ListCellRenderer renderer = list.getCellRenderer(); + final ListCellRenderer renderer = list.getCellRenderer(); if (renderer == null) return; final Component rendererComponent = renderer.getListCellRendererComponent(list, value, selectedIndex, selected, true); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java index dd65433283f..8dd4fa60d2d 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java @@ -3820,7 +3820,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing _loader = null; final Class klass = (Class)loader; try { - final java.lang.reflect.Method method = klass.getDeclaredMethod("loadActionMap", new Class[] { LazyActionMap.class }); + final java.lang.reflect.Method method = klass.getDeclaredMethod("loadActionMap", new Class[] { LazyActionMap.class }); method.invoke(klass, new Object[] { this }); } catch (final NoSuchMethodException nsme) { assert false : "LazyActionMap unable to load actions " + klass; diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java index 5d847e98ef2..dbc8c8c86ad 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java @@ -69,6 +69,7 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI { final static RecyclableSingleton> TABLE_HEADER_APPLICATORS = new RecyclableSingleton>() { @Override + @SuppressWarnings("unchecked") protected ClientPropertyApplicator getInstance() { return new ClientPropertyApplicator( new Property("JTableHeader.selectedColumn") { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java b/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java index b64595f4245..17b372af858 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java @@ -121,7 +121,7 @@ public class AquaUtilControlSize { try { // see if this component has a "getUI" method final Class clazz = c.getClass(); - final Method getUIMethod = clazz.getMethod("getUI", new Class[0]); + final Method getUIMethod = clazz.getMethod("getUI", new Class[0]); // see if that UI is one of ours that understands sizing final Object ui = getUIMethod.invoke(c, new Object[0]); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java index 078435b161b..faa670345c7 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java @@ -82,7 +82,8 @@ final class AquaUtils { @Override public Creator run() { try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); + final Method getCreatorMethod = CImage.class.getDeclaredMethod( + "getCreator", new Class[] {}); getCreatorMethod.setAccessible(true); return (Creator)getCreatorMethod.invoke(null, new Object[] {}); } catch (final Exception ignored) { @@ -383,7 +384,8 @@ final class AquaUtils { @Override public Method run() { try { - final Method method = JComponent.class.getDeclaredMethod("getFlag", new Class[] { int.class }); + final Method method = JComponent.class.getDeclaredMethod( + "getFlag", new Class[] { int.class }); method.setAccessible(true); return method; } catch (final Throwable ignored) { diff --git a/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java b/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java index 665c9319cc1..908c63c2c3e 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java +++ b/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java @@ -33,6 +33,7 @@ import javax.swing.JComponent; public class ClientPropertyApplicator implements PropertyChangeListener { private final Map> properties = new HashMap>(); + @SuppressWarnings("unchecked") public ClientPropertyApplicator(final Property... propertyList) { for (final Property p : propertyList) { properties.put(p.name, p); diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java index 1735b444ea5..f4c0aaf4ee8 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java +++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java @@ -273,6 +273,7 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM try { if (stolenFields == null) return m; + @SuppressWarnings("unchecked") final Vector menus = (Vector)stolenFields[0].get(this); menus.insertElementAt(m, index); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java index 67570c18a6f..c6c75bc82c6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java @@ -88,7 +88,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { super.startDrag(dsc, cursor, dragImage, dragImageOffset); } - protected void startDrag(Transferable transferable, long[] formats, Map formatMap) { + protected void startDrag(Transferable transferable, long[] formats, Map formatMap) { DragGestureEvent trigger = getTrigger(); InputEvent triggerEvent = trigger.getTriggerEvent(); @@ -311,7 +311,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { } } - private void setDefaultDragImage(JList component) { + private void setDefaultDragImage(JList component) { Rectangle selectedOutline = null; // This code actually works, even under the (non-existant) multiple-selections, because we only draw a union outline @@ -485,7 +485,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable, InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp, long nsDragImagePtr, int dragImageOffsetX, int dragImageOffsetY, - int sourceActions, long[] formats, Map formatMap); + int sourceActions, long[] formats, Map formatMap); private native void doDragging(long nativeDragSource); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java index eef5284175b..077b156d806 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java @@ -44,13 +44,14 @@ import sun.lwawt.*; public class CInputMethod extends InputMethodAdapter { private InputMethodContext fIMContext; private Component fAwtFocussedComponent; - private LWComponentPeer fAwtFocussedComponentPeer; + private LWComponentPeer fAwtFocussedComponentPeer; private boolean isActive; private static Map[] sHighlightStyles; // Intitalize highlight mapping table and its mapper. static { + @SuppressWarnings({"rawtypes", "unchecked"}) Map styles[] = new Map[4]; HashMap map; @@ -242,7 +243,7 @@ public class CInputMethod extends InputMethodAdapter { public void hideWindows() { } - long getNativeViewPtr(LWComponentPeer peer) { + long getNativeViewPtr(LWComponentPeer peer) { if (peer.getPlatformWindow() instanceof CPlatformWindow) { CPlatformWindow platformWindow = (CPlatformWindow) peer.getPlatformWindow(); CPlatformView platformView = platformWindow.getContentView(); @@ -272,7 +273,7 @@ public class CInputMethod extends InputMethodAdapter { * to talk to when responding to key events. */ protected void setAWTFocussedComponent(Component component) { - LWComponentPeer peer = null; + LWComponentPeer peer = null; long modelPtr = 0; CInputMethod imInstance = this; @@ -305,7 +306,7 @@ public class CInputMethod extends InputMethodAdapter { /** * @see java.awt.Toolkit#mapInputMethodHighlight */ - public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { int index; int state = highlight.getState(); if (state == InputMethodHighlight.RAW_TEXT) { @@ -384,7 +385,7 @@ public class CInputMethod extends InputMethodAdapter { // java.awt.Toolkit#getNativeContainer() is not available // from this package - private LWComponentPeer getNearestNativePeer(Component comp) { + private LWComponentPeer getNearestNativePeer(Component comp) { if (comp==null) return null; @@ -796,7 +797,7 @@ public class CInputMethod extends InputMethodAdapter { // these calls will be ignored. private native void nativeNotifyPeer(long nativePeer, CInputMethod imInstance); private native void nativeEndComposition(long nativePeer); - private native void nativeHandleEvent(LWComponentPeer peer, AWTEvent event); + private native void nativeHandleEvent(LWComponentPeer peer, AWTEvent event); // Returns the locale of the active input method. static native Locale getNativeLocale(); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java index d922d029b33..3deba1e33f9 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java @@ -57,7 +57,7 @@ public class CInputMethodDescriptor implements InputMethodDescriptor { } static Object[] getAvailableLocalesInternal() { - List workList = nativeGetAvailableLocales(); + List workList = nativeGetAvailableLocales(); if (workList != null) { return workList.toArray(); @@ -119,5 +119,5 @@ public class CInputMethodDescriptor implements InputMethodDescriptor { } private static native void nativeInit(); - private static native List nativeGetAvailableLocales(); + private static native List nativeGetAvailableLocales(); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 534cf0dd744..5af2cdfe1d0 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -151,7 +151,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo return (bits & mask) != 0; } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) static ClientPropertyApplicator CLIENT_PROPERTY_APPLICATOR = new ClientPropertyApplicator(new Property[] { new Property(WINDOW_DOCUMENT_MODIFIED) { public void applyProperty(final CPlatformWindow c, final Object value) { c.setStyleBits(DOCUMENT_MODIFIED, value == null ? false : Boolean.parseBoolean(value.toString())); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index edbebbacb67..e2cafca01b6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -32,6 +32,7 @@ import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.event.InputEvent; import java.awt.event.InvocationEvent; import java.awt.event.KeyEvent; +import java.awt.font.TextAttribute; import java.awt.im.InputMethodHighlight; import java.awt.im.spi.InputMethodDescriptor; import java.awt.peer.*; @@ -691,6 +692,7 @@ public final class LWCToolkit extends LWToolkit { } @Override + @SuppressWarnings("unchecked") public T createDragGestureRecognizer( Class abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl) { @@ -743,7 +745,7 @@ public final class LWCToolkit extends LWToolkit { * @since 1.3 */ @Override - public Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public Map mapInputMethodHighlight(InputMethodHighlight highlight) { return CInputMethod.mapInputMethodHighlight(highlight); } From 61b92329697c34a6f0e13a70ffb6e651e5b89c1b Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Thu, 10 Jul 2014 12:21:29 +0400 Subject: [PATCH 08/94] 8049704: Fix doclint warnings from javax.swing.plaf.basic package, 2 of 7 Reviewed-by: pchelko --- .../javax/swing/plaf/basic/BasicButtonUI.java | 104 +++++++++++++++- .../swing/plaf/basic/BasicComboBoxUI.java | 66 ++++++++-- .../swing/plaf/basic/BasicComboPopup.java | 52 ++++++++ .../swing/plaf/basic/BasicDesktopIconUI.java | 61 ++++++++- .../javax/swing/plaf/basic/BasicLabelUI.java | 82 +++++++++++-- .../swing/plaf/basic/BasicScrollPaneUI.java | 116 +++++++++++++++--- .../plaf/basic/BasicSplitPaneDivider.java | 85 ++++++++++--- .../javax/swing/plaf/basic/BasicTableUI.java | 46 ++++++- 8 files changed, 556 insertions(+), 56 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java index 34595149b95..0e1aa403fac 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,6 +49,9 @@ public class BasicButtonUI extends ButtonUI{ // Visual constants // NOTE: This is not used or set any where. Were we allowed to remove // fields, this would be removed. + /** + * The default gap between a text and an icon. + */ protected int defaultTextIconGap; // Amount to offset text, the value of this comes from @@ -56,6 +59,9 @@ public class BasicButtonUI extends ButtonUI{ private int shiftOffset = 0; // Value that is set in shiftOffset once setTextShiftOffset has been // invoked. The value of this comes from the defaults table. + /** + * The default offset of a text. + */ protected int defaultTextShiftOffset; private final static String propertyPrefix = "Button" + "."; @@ -65,6 +71,12 @@ public class BasicButtonUI extends ButtonUI{ // ******************************** // Create PLAF // ******************************** + /** + * Returns an instance of {@code BasicButtonUI}. + * + * @param c a component + * @return an instance of {@code BasicButtonUI} + */ public static ComponentUI createUI(JComponent c) { AppContext appContext = AppContext.getAppContext(); BasicButtonUI buttonUI = @@ -76,6 +88,11 @@ public class BasicButtonUI extends ButtonUI{ return buttonUI; } + /** + * Returns the property prefix. + * + * @return the property prefix + */ protected String getPropertyPrefix() { return propertyPrefix; } @@ -91,6 +108,11 @@ public class BasicButtonUI extends ButtonUI{ BasicHTML.updateRenderer(c, ((AbstractButton) c).getText()); } + /** + * Installs default properties. + * + * @param b an abstract button + */ protected void installDefaults(AbstractButton b) { // load shared instance defaults String pp = getPropertyPrefix(); @@ -120,6 +142,11 @@ public class BasicButtonUI extends ButtonUI{ LookAndFeel.installProperty(b, "iconTextGap", Integer.valueOf(4)); } + /** + * Registers listeners. + * + * @param b an abstract button + */ protected void installListeners(AbstractButton b) { BasicButtonListener listener = createButtonListener(b); if(listener != null) { @@ -131,6 +158,11 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Registers keyboard actions. + * + * @param b an abstract button + */ protected void installKeyboardActions(AbstractButton b){ BasicButtonListener listener = getButtonListener(b); @@ -150,6 +182,11 @@ public class BasicButtonUI extends ButtonUI{ BasicHTML.updateRenderer(c, ""); } + /** + * Unregisters keyboard actions. + * + * @param b an abstract button + */ protected void uninstallKeyboardActions(AbstractButton b) { BasicButtonListener listener = getButtonListener(b); if(listener != null) { @@ -157,6 +194,11 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Unregisters listeners. + * + * @param b an abstract button + */ protected void uninstallListeners(AbstractButton b) { BasicButtonListener listener = getButtonListener(b); if(listener != null) { @@ -168,6 +210,11 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Uninstalls default properties. + * + * @param b an abstract button + */ protected void uninstallDefaults(AbstractButton b) { LookAndFeel.uninstallBorder(b); } @@ -175,10 +222,22 @@ public class BasicButtonUI extends ButtonUI{ // ******************************** // Create Listeners // ******************************** + /** + * Returns a new instance of {@code BasicButtonListener}. + * + * @param b an abstract button + * @return a new instance of {@code BasicButtonListener} + */ protected BasicButtonListener createButtonListener(AbstractButton b) { return new BasicButtonListener(b); } + /** + * Returns the default gap between a text and an icon. + * + * @param b an abstract button + * @return the default gap between text and an icon + */ public int getDefaultTextIconGap(AbstractButton b) { return defaultTextIconGap; } @@ -231,6 +290,13 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Paints an icon of the current button. + * + * @param g an instance of {@code Graphics} + * @param c a component + * @param iconRect a bounding rectangle to render the icon + */ protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect){ AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); @@ -295,8 +361,15 @@ public class BasicButtonUI extends ButtonUI{ } /** + * Method which renders the text of the current button. + * * As of Java 2 platform v 1.4 this method should not be used or overriden. * Use the paintText method which takes the AbstractButton argument. + * + * @param g an instance of {@code Graphics} + * @param c a component + * @param textRect a bounding rectangle to render the text + * @param text a string to render */ protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) { AbstractButton b = (AbstractButton) c; @@ -328,7 +401,7 @@ public class BasicButtonUI extends ButtonUI{ * * @param g Graphics context * @param b Current button to render - * @param textRect Bounding rectangle to render the text. + * @param textRect Bounding rectangle to render the text * @param text String to render * @since 1.4 */ @@ -338,23 +411,48 @@ public class BasicButtonUI extends ButtonUI{ // Method signature defined here overriden in subclasses. // Perhaps this class should be abstract? + /** + * Paints a focused button. + * + * @param g an instance of {@code Graphics} + * @param b an abstract button + * @param viewRect a bounding rectangle to render the button + * @param textRect a bounding rectangle to render the text + * @param iconRect a bounding rectangle to render the icon + */ protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect){ } - + /** + * Paints a pressed button. + * + * @param g an instance of {@code Graphics} + * @param b an abstract button + */ protected void paintButtonPressed(Graphics g, AbstractButton b){ } + /** + * Clears the offset of the text. + */ protected void clearTextShiftOffset(){ this.shiftOffset = 0; } + /** + * Sets the offset of the text. + */ protected void setTextShiftOffset(){ this.shiftOffset = defaultTextShiftOffset; } + /** + * Returns the offset of the text. + * + * @return the offset of the text + */ protected int getTextShiftOffset() { return shiftOffset; } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java index de26e386efd..a144ce120e7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -61,6 +61,10 @@ import sun.swing.UIAction; * @author Mark Davidson */ public class BasicComboBoxUI extends ComboBoxUI { + + /** + * The instance of {@code JComboBox}. + */ protected JComboBox comboBox; /** * This protected field is implementation specific. Do not access directly @@ -73,20 +77,30 @@ public class BasicComboBoxUI extends ComboBoxUI { private boolean isTableCellEditor = false; private static final String IS_TABLE_CELL_EDITOR = "JComboBox.isTableCellEditor"; - // This list is for drawing the current item in the combo box. + /** + * This list is for drawing the current item in the combo box. + */ protected JList listBox; - // Used to render the currently selected item in the combo box. - // It doesn't have anything to do with the popup's rendering. + /** + * Used to render the currently selected item in the combo box. + * It doesn't have anything to do with the popup's rendering. + */ protected CellRendererPane currentValuePane = new CellRendererPane(); - // The implementation of ComboPopup that is used to show the popup. + /** + * The implementation of {@code ComboPopup} that is used to show the popup. + */ protected ComboPopup popup; - // The Component that the ComboBoxEditor uses for editing + /** + * The Component that the @{code ComboBoxEditor} uses for editing. + */ protected Component editor; - // The arrow button that invokes the popup. + /** + * The arrow button that invokes the popup. + */ protected JButton arrowButton; // Listeners that are attached to the JComboBox @@ -121,8 +135,19 @@ public class BasicComboBoxUI extends ComboBoxUI { protected ItemListener itemListener; // Listeners that the ComboPopup produces. + /** + * The {@code MouseListener} listens to events. + */ protected MouseListener popupMouseListener; + + /** + * The {@code MouseMotionListener} listens to events. + */ protected MouseMotionListener popupMouseMotionListener; + + /** + * The {@code KeyListener} listens to events. + */ protected KeyListener popupKeyListener; // This is used for knowing when to cache the minimum preferred size. @@ -160,10 +185,14 @@ public class BasicComboBoxUI extends ComboBoxUI { */ JComboBox.KeySelectionManager keySelectionManager; - // Flag for recalculating the minimum preferred size. + /** + * The flag for recalculating the minimum preferred size. + */ protected boolean isMinimumSizeDirty = true; - // Cached minimum preferred size. + /** + * The cached minimum preferred size. + */ protected Dimension cachedMinimumSize = new Dimension( 0, 0 ); // Flag for calculating the display size @@ -238,6 +267,12 @@ public class BasicComboBoxUI extends ComboBoxUI { // begin UI Initialization // + /** + * Constructs a new instance of {@code BasicComboBoxUI}. + * + * @param c a component + * @return a new instance of {@code BasicComboBoxUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicComboBoxUI(); } @@ -1090,6 +1125,9 @@ public class BasicComboBoxUI extends ComboBoxUI { * navigation. This is used for optimizing key input by only passing non- * navigation keys to the type-ahead mechanism. Subclasses should override this * if they change the navigation keys. + * + * @param keyCode a key code + * @return {@code true} if the supplied {@code keyCode} maps to a navigation key */ protected boolean isNavigationKey( int keyCode ) { return keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN || @@ -1167,6 +1205,8 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Returns the area that is reserved for drawing the currently selected item. + * + * @return the area that is reserved for drawing the currently selected item */ protected Rectangle rectangleForCurrentValue() { int width = comboBox.getWidth(); @@ -1190,6 +1230,8 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Gets the insets from the JComboBox. + * + * @return the insets */ protected Insets getInsets() { return comboBox.getInsets(); @@ -1206,6 +1248,10 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Paints the currently selected item. + * + * @param g an instance of {@code Graphics} + * @param bounds a bounding rectangle to render to + * @param hasFocus is focused */ public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) { ListCellRenderer renderer = comboBox.getRenderer(); @@ -1263,6 +1309,10 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Paints the background of the currently selected item. + * + * @param g an instance of {@code Graphics} + * @param bounds a bounding rectangle to render to + * @param hasFocus is focused */ public void paintCurrentValueBackground(Graphics g,Rectangle bounds,boolean hasFocus) { Color t = g.getColor(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java index 2f0cd03923d..9e06857d4b3 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java @@ -75,6 +75,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { private static Border LIST_BORDER = new LineBorder(Color.BLACK, 1); + /** + * The instance of {@code JComboBox}. + */ protected JComboBox comboBox; /** * This protected field is implementation specific. Do not access directly @@ -186,11 +189,30 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { * or override. */ protected Timer autoscrollTimer; + + /** + * {@code true} if the mouse cursor is in the popup. + */ protected boolean hasEntered = false; + + /** + * If {@code true} the auto-scrolling is enabled. + */ protected boolean isAutoScrolling = false; + + /** + * The direction of scrolling. + */ protected int scrollDirection = SCROLL_UP; + /** + * The direction of scrolling up. + */ protected static final int SCROLL_UP = 0; + + /** + * The direction of scrolling down. + */ protected static final int SCROLL_DOWN = 1; @@ -309,6 +331,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { } } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { // XXX - shouldn't call this method // comboBox.unregisterKeyboardAction( KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0 ) ); @@ -319,6 +344,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { //=================================================================== // begin Initialization routines // + + /** + * Constructs a new instance of {@code BasicComboPopup}. + * + * @param combo an instance of {@code JComboBox} + */ public BasicComboPopup( JComboBox combo ) { super(); setName("ComboPopup.popup"); @@ -555,6 +586,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * Creates the scroll pane which houses the scrollable list. + * + * @return the scroll pane which houses the scrollable list */ protected JScrollPane createScroller() { JScrollPane sp = new JScrollPane( list, @@ -616,6 +649,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { } } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { /* XXX - shouldn't call this method. take it out for testing. @@ -1007,6 +1043,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * This protected method is implementation specific and should be private. * do not call or override. + * + * @param direction the direction of scrolling */ protected void startAutoScrolling( int direction ) { // XXX - should be a private method within InvocationMouseMotionHandler @@ -1107,6 +1145,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { * send the focus when the popup is brought up. The standard implementation * delegates the focus to the editor (if the combo box is editable) or to * the JComboBox if it is not editable. + * + * @param e a mouse event */ protected void delegateFocus( MouseEvent e ) { if ( comboBox.isEditable() ) { @@ -1150,6 +1190,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { } } + /** + * Converts mouse event. + * + * @param e a mouse event + * @return converted mouse event + */ protected MouseEvent convertMouseEvent( MouseEvent e ) { Point convertedPoint = SwingUtilities.convertPoint( (Component)e.getSource(), e.getPoint(), list ); @@ -1171,6 +1217,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * Retrieves the height of the popup based on the current * ListCellRenderer and the maximum row count. + * + * @param maxRowCount the row count + * @return the height of the popup */ protected int getPopupHeightForRowCount(int maxRowCount) { // Set the cached value of the minimum row count @@ -1272,6 +1321,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * A utility method used by the event listeners. Given a mouse event, it changes * the list selection to the list item below the mouse. + * + * @param anEvent a mouse event + * @param shouldScroll if {@code true} list should be scrolled. */ protected void updateListBoxSelectionForEvent(MouseEvent anEvent,boolean shouldScroll) { // XXX - only seems to be called from this class. shouldScroll flag is diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java index 8d68668af6a..262f36ee7d8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,14 @@ import java.beans.*; */ public class BasicDesktopIconUI extends DesktopIconUI { + /** + * The instance of {@code JInternalFrame.JDesktopIcon}. + */ protected JInternalFrame.JDesktopIcon desktopIcon; + + /** + * The instance of {@code JInternalFrame}. + */ protected JInternalFrame frame; /** @@ -53,12 +60,19 @@ public class BasicDesktopIconUI extends DesktopIconUI { protected JComponent iconPane; MouseInputListener mouseInputListener; - - + /** + * Constructs a new instance of {@code BasicDesktopIconUI}. + * + * @param c a component + * @return a new instance of {@code BasicDesktopIconUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicDesktopIconUI(); } + /** + * Constructs a new instance of {@code BasicDesktopIconUI}. + */ public BasicDesktopIconUI() { } @@ -108,39 +122,62 @@ public class BasicDesktopIconUI extends DesktopIconUI { desktopIcon = null; } + /** + * Registers components. + */ protected void installComponents() { iconPane = new BasicInternalFrameTitlePane(frame); desktopIcon.setLayout(new BorderLayout()); desktopIcon.add(iconPane, BorderLayout.CENTER); } + /** + * Unregisters components. + */ protected void uninstallComponents() { desktopIcon.remove(iconPane); desktopIcon.setLayout(null); iconPane = null; } + /** + * Registers listeners. + */ protected void installListeners() { mouseInputListener = createMouseInputListener(); desktopIcon.addMouseMotionListener(mouseInputListener); desktopIcon.addMouseListener(mouseInputListener); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { desktopIcon.removeMouseMotionListener(mouseInputListener); desktopIcon.removeMouseListener(mouseInputListener); mouseInputListener = null; } + /** + * Installs default properties. + */ protected void installDefaults() { LookAndFeel.installBorder(desktopIcon, "DesktopIcon.border"); LookAndFeel.installProperty(desktopIcon, "opaque", Boolean.TRUE); } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(desktopIcon); } + /** + * Returns a new instance of {@code MouseInputListener}. + * + * @return a new instance of {@code MouseInputListener} + */ protected MouseInputListener createMouseInputListener() { return new MouseInputHandler(); } @@ -170,6 +207,12 @@ public class BasicDesktopIconUI extends DesktopIconUI { return iconPane.getMaximumSize(); } + /** + * Returns the insets. + * + * @param c a component + * @return the insets + */ public Insets getInsets(JComponent c) { JInternalFrame iframe = desktopIcon.getInternalFrame(); Border border = iframe.getBorder(); @@ -179,6 +222,9 @@ public class BasicDesktopIconUI extends DesktopIconUI { return new Insets(0,0,0,0); } + /** + * De-iconifies the internal frame. + */ public void deiconize() { try { frame.setIcon(false); } catch (PropertyVetoException e2) { } } @@ -284,6 +330,15 @@ public class BasicDesktopIconUI extends DesktopIconUI { return; } + /** + * Moves and repaints a component {@code f}. + * + * @param f a component + * @param newX a new X coordinate + * @param newY a new Y coordinate + * @param newWidth a new width + * @param newHeight a new height + */ public void moveAndRepaint(JComponent f, int newX, int newY, int newWidth, int newHeight) { Rectangle r = f.getBounds(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java index 9c31265d180..e5576c2aca9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,6 +80,14 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener * This method is here so that a subclass could do Label specific * layout and to shorten the method name a little. * + * @param label an instance of {@code JLabel} + * @param fontMetrics a font metrics + * @param text a text + * @param icon an icon + * @param viewR a bounding rectangle to lay out label + * @param iconR a bounding rectangle to lay out icon + * @param textR a bounding rectangle to lay out text + * @return a possibly clipped version of the compound labels string * @see SwingUtilities#layoutCompoundLabel */ protected String layoutCL( @@ -109,6 +117,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener /** * Paint clippedText at textX, textY with the labels foreground color. * + * @param l an instance of {@code JLabel} + * @param g an instance of {@code Graphics} + * @param s a text + * @param textX an X coordinate + * @param textY an Y coordinate * @see #paint * @see #paintDisabledText */ @@ -125,6 +138,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener * Paint clippedText at textX, textY with background.lighter() and then * shifted down and to the right by one pixel with background.darker(). * + * @param l an instance of {@code JLabel} + * @param g an instance of {@code Graphics} + * @param s a text + * @param textX an X coordinate + * @param textY an Y coordinate * @see #paint * @see #paintEnabledText */ @@ -329,26 +347,46 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener public void uninstallUI(JComponent c) { - uninstallDefaults((JLabel)c); - uninstallComponents((JLabel)c); - uninstallListeners((JLabel)c); - uninstallKeyboardActions((JLabel)c); + uninstallDefaults((JLabel) c); + uninstallComponents((JLabel) c); + uninstallListeners((JLabel) c); + uninstallKeyboardActions((JLabel) c); } - protected void installDefaults(JLabel c){ - LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", "Label.font"); - LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); - } + /** + * Installs default properties. + * + * @param c an instance of {@code JLabel} + */ + protected void installDefaults(JLabel c){ + LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", "Label.font"); + LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); + } + /** + * Registers listeners. + * + * @param c an instance of {@code JLabel} + */ protected void installListeners(JLabel c){ c.addPropertyChangeListener(this); } + /** + * Registers components. + * + * @param c an instance of {@code JLabel} + */ protected void installComponents(JLabel c){ BasicHTML.updateRenderer(c, c.getText()); c.setInheritsPopupMenu(true); } + /** + * Registers keyboard actions. + * + * @param l an instance of {@code JLabel} + */ protected void installKeyboardActions(JLabel l) { int dka = l.getDisplayedMnemonic(); Component lf = l.getLabelFor(); @@ -374,17 +412,37 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener } } + /** + * Uninstalls default properties. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallDefaults(JLabel c){ } + /** + * Unregisters listeners. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallListeners(JLabel c){ c.removePropertyChangeListener(this); } + /** + * Unregisters components. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallComponents(JLabel c){ BasicHTML.updateRenderer(c, ""); } + /** + * Unregisters keyboard actions. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallKeyboardActions(JLabel c) { SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, null); SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_IN_FOCUSED_WINDOW, @@ -392,6 +450,12 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener SwingUtilities.replaceUIActionMap(c, null); } + /** + * Returns an instance of {@code BasicLabelUI}. + * + * @param c a component + * @return an instance of {@code BasicLabelUI} + */ public static ComponentUI createUI(JComponent c) { if (System.getSecurityManager() != null) { AppContext appContext = AppContext.getAppContext(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java index 646282046b3..18df8abf202 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,21 +52,40 @@ import java.awt.event.*; public class BasicScrollPaneUI extends ScrollPaneUI implements ScrollPaneConstants { + /** + * The instance of {@code JScrollPane}. + */ protected JScrollPane scrollpane; + + /** + * {@code ChangeListener} installed on the vertical scrollbar. + */ protected ChangeListener vsbChangeListener; + + /** + * {@code ChangeListener} installed on the horizontal scrollbar. + */ protected ChangeListener hsbChangeListener; + + /** + * {@code ChangeListener} installed on the viewport. + */ protected ChangeListener viewportChangeListener; + + /** + * {@code PropertyChangeListener} installed on the scroll pane. + */ protected PropertyChangeListener spPropertyChangeListener; private MouseWheelListener mouseScrollListener; private int oldExtent = Integer.MIN_VALUE; /** - * PropertyChangeListener installed on the vertical scrollbar. + * {@code PropertyChangeListener} installed on the vertical scrollbar. */ private PropertyChangeListener vsbPropertyChangeListener; /** - * PropertyChangeListener installed on the horizontal scrollbar. + * {@code PropertyChangeListener} installed on the horizontal scrollbar. */ private PropertyChangeListener hsbPropertyChangeListener; @@ -79,7 +98,12 @@ public class BasicScrollPaneUI */ private boolean setValueCalled = false; - + /** + * Returns a new instance of {@code BasicScrollPaneUI}. + * + * @param x a component. + * @return a new instance of {@code BasicScrollPaneUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicScrollPaneUI(); } @@ -115,7 +139,11 @@ public class BasicScrollPaneUI return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE); } - + /** + * Installs default properties. + * + * @param scrollpane an instance of {@code JScrollPane} + */ protected void installDefaults(JScrollPane scrollpane) { LookAndFeel.installBorder(scrollpane, "ScrollPane.border"); @@ -132,7 +160,11 @@ public class BasicScrollPaneUI LookAndFeel.installProperty(scrollpane, "opaque", Boolean.TRUE); } - + /** + * Registers listeners. + * + * @param c an instance of {@code JScrollPane} + */ protected void installListeners(JScrollPane c) { vsbChangeListener = createVSBChangeListener(); @@ -165,6 +197,11 @@ public class BasicScrollPaneUI } + /** + * Registers keyboard actions. + * + * @param c an instance of {@code JScrollPane} + */ protected void installKeyboardActions(JScrollPane c) { InputMap inputMap = getInputMap(JComponent. WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); @@ -201,7 +238,11 @@ public class BasicScrollPaneUI installKeyboardActions(scrollpane); } - + /** + * Uninstalls default properties. + * + * @param c an instance of {@code JScrollPane} + */ protected void uninstallDefaults(JScrollPane c) { LookAndFeel.uninstallBorder(scrollpane); @@ -210,7 +251,11 @@ public class BasicScrollPaneUI } } - + /** + * Unregisters listeners. + * + * @param c a component + */ protected void uninstallListeners(JComponent c) { JViewport viewport = scrollpane.getViewport(); JScrollBar vsb = scrollpane.getVerticalScrollBar(); @@ -242,7 +287,11 @@ public class BasicScrollPaneUI handler = null; } - + /** + * Unregisters keyboard actions. + * + * @param c an instance of {@code JScrollPane} + */ protected void uninstallKeyboardActions(JScrollPane c) { SwingUtilities.replaceUIActionMap(c, null); SwingUtilities.replaceUIInputMap(c, JComponent. @@ -264,6 +313,9 @@ public class BasicScrollPaneUI return handler; } + /** + * Synchronizes the {@code JScrollPane} with {@code Viewport}. + */ protected void syncScrollPaneWithViewport() { JViewport viewport = scrollpane.getViewport(); @@ -453,6 +505,11 @@ public class BasicScrollPaneUI } } + /** + * Returns an instance of viewport {@code ChangeListener}. + * + * @return an instance of viewport {@code ChangeListener} + */ protected ChangeListener createViewportChangeListener() { return getHandler(); } @@ -483,6 +540,11 @@ public class BasicScrollPaneUI return getHandler(); } + /** + * Returns an instance of horizontal scroll bar {@code ChangeListener}. + * + * @return an instance of horizontal scroll bar {@code ChangeListener} + */ protected ChangeListener createHSBChangeListener() { return getHandler(); } @@ -514,6 +576,11 @@ public class BasicScrollPaneUI return getHandler(); } + /** + * Returns an instance of vertical scroll bar {@code ChangeListener}. + * + * @return an instance of vertical scroll bar {@code ChangeListener} + */ protected ChangeListener createVSBChangeListener() { return getHandler(); } @@ -565,12 +632,21 @@ public class BasicScrollPaneUI return getHandler(); } + /** + * Updates a scroll bar display policy. + * + * @param e the property change event + */ protected void updateScrollBarDisplayPolicy(PropertyChangeEvent e) { scrollpane.revalidate(); scrollpane.repaint(); } - + /** + * Updates viewport. + * + * @param e the property change event + */ protected void updateViewport(PropertyChangeEvent e) { JViewport oldViewport = (JViewport)(e.getOldValue()); @@ -599,7 +675,11 @@ public class BasicScrollPaneUI } } - + /** + * Updates row header. + * + * @param e the property change event + */ protected void updateRowHeader(PropertyChangeEvent e) { JViewport newRowHead = (JViewport)(e.getNewValue()); @@ -611,7 +691,11 @@ public class BasicScrollPaneUI } } - + /** + * Updates column header. + * + * @param e the property change event + */ protected void updateColumnHeader(PropertyChangeEvent e) { JViewport newColHead = (JViewport)(e.getNewValue()); @@ -679,9 +763,9 @@ public class BasicScrollPaneUI /** - * Creates an instance of PropertyChangeListener that's added to - * the JScrollPane by installUI(). Subclasses can override this method - * to return a custom PropertyChangeListener, e.g. + * Creates an instance of {@code PropertyChangeListener} that's added to + * the {@code JScrollPane} by {@code installUI()}. Subclasses can override + * this method to return a custom {@code PropertyChangeListener}, e.g. *
      * class MyScrollPaneUI extends BasicScrollPaneUI {
      *    protected PropertyChangeListener createPropertyChangeListener() {
@@ -698,6 +782,8 @@ public class BasicScrollPaneUI
      * }
      * 
* + * @return an instance of {@code PropertyChangeListener} + * * @see java.beans.PropertyChangeListener * @see #installUI */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java index 36b4129598c..34dfeb5710a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java @@ -65,9 +65,13 @@ public class BasicSplitPaneDivider extends Container { /** * Width or height of the divider based on orientation - * BasicSplitPaneUI adds two to this. + * {@code BasicSplitPaneUI} adds two to this. */ protected static final int ONE_TOUCH_SIZE = 6; + + /** + * The offset of the divider. + */ protected static final int ONE_TOUCH_OFFSET = 2; /** @@ -136,8 +140,10 @@ public class BasicSplitPaneDivider extends Container /** - * Creates an instance of BasicSplitPaneDivider. Registers this + * Creates an instance of {@code BasicSplitPaneDivider}. Registers this * instance for mouse events and mouse dragged events. + * + * @param ui an instance of {@code BasicSplitPaneUI} */ public BasicSplitPaneDivider(BasicSplitPaneUI ui) { oneTouchSize = DefaultLookup.getInt(ui.getSplitPane(), ui, @@ -163,7 +169,9 @@ public class BasicSplitPaneDivider extends Container } /** - * Sets the SplitPaneUI that is using the receiver. + * Sets the {@code SplitPaneUI} that is using the receiver. + * + * @param newUI the new {@code SplitPaneUI} */ public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) { if (splitPane != null) { @@ -198,8 +206,9 @@ public class BasicSplitPaneDivider extends Container /** - * Returns the SplitPaneUI the receiver is currently - * in. + * Returns the {@code SplitPaneUI} the receiver is currently in. + * + * @return the {@code SplitPaneUI} the receiver is currently in */ public BasicSplitPaneUI getBasicSplitPaneUI() { return splitPaneUI; @@ -207,9 +216,11 @@ public class BasicSplitPaneDivider extends Container /** - * Sets the size of the divider to newSize. That is - * the width if the splitpane is HORIZONTAL_SPLIT, or - * the height of VERTICAL_SPLIT. + * Sets the size of the divider to {@code newSize}. That is + * the width if the splitpane is {@code HORIZONTAL_SPLIT}, or + * the height of {@code VERTICAL_SPLIT}. + * + * @param newSize a new size */ public void setDividerSize(int newSize) { dividerSize = newSize; @@ -219,6 +230,8 @@ public class BasicSplitPaneDivider extends Container /** * Returns the size of the divider, that is the width if the splitpane * is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT. + * + * @return the size of the divider */ public int getDividerSize() { return dividerSize; @@ -227,6 +240,8 @@ public class BasicSplitPaneDivider extends Container /** * Sets the border of this component. + * + * @param border a new border * @since 1.3 */ public void setBorder(Border border) { @@ -382,8 +397,10 @@ public class BasicSplitPaneDivider extends Container /** - * Creates and return an instance of JButton that can be used to + * Creates and return an instance of {@code JButton} that can be used to * collapse the left component in the split pane. + * + * @return an instance of {@code JButton} */ protected JButton createLeftOneTouchButton() { JButton b = new JButton() { @@ -438,8 +455,10 @@ public class BasicSplitPaneDivider extends Container /** - * Creates and return an instance of JButton that can be used to + * Creates and return an instance of {@code JButton} that can be used to * collapse the right component in the split pane. + * + * @return an instance of {@code JButton} */ protected JButton createRightOneTouchButton() { JButton b = new JButton() { @@ -503,6 +522,8 @@ public class BasicSplitPaneDivider extends Container /** * Messages the BasicSplitPaneUI with dragDividerTo that this instance * is contained in. + * + * @param location a location */ protected void dragDividerTo(int location) { splitPaneUI.dragDividerTo(location); @@ -512,6 +533,8 @@ public class BasicSplitPaneDivider extends Container /** * Messages the BasicSplitPaneUI with finishDraggingTo that this instance * is contained in. + * + * @param location a location */ protected void finishDraggingTo(int location) { splitPaneUI.finishDraggingTo(location); @@ -694,7 +717,11 @@ public class BasicSplitPaneDivider extends Container */ int offset; - + /** + * Constructs a new instance of {@code DragController}. + * + * @param e a mouse event + */ protected DragController(MouseEvent e) { JSplitPane splitPane = splitPaneUI.getSplitPane(); Component leftC = splitPane.getLeftComponent(); @@ -741,7 +768,9 @@ public class BasicSplitPaneDivider extends Container /** - * Returns true if the dragging session is valid. + * Returns {@code true} if the dragging session is valid. + * + * @return {@code true} if the dragging session is valid */ protected boolean isValid() { return (maxX > 0); @@ -751,6 +780,9 @@ public class BasicSplitPaneDivider extends Container /** * Returns the new position to put the divider at based on * the passed in MouseEvent. + * + * @param e a mouse event + * @return the new position */ protected int positionForMouseEvent(MouseEvent e) { int newX = (e.getSource() == BasicSplitPaneDivider.this) ? @@ -764,6 +796,10 @@ public class BasicSplitPaneDivider extends Container /** * Returns the x argument, since this is used for horizontal * splits. + * + * @param x an X coordinate + * @param y an Y coordinate + * @return the X argument */ protected int getNeededLocation(int x, int y) { int newX; @@ -772,7 +808,13 @@ public class BasicSplitPaneDivider extends Container return newX; } - + /** + * Messages dragDividerTo with the new location for the mouse + * event. + * + * @param newX an X coordinate + * @param newY an Y coordinate + */ protected void continueDrag(int newX, int newY) { dragDividerTo(getNeededLocation(newX, newY)); } @@ -781,12 +823,20 @@ public class BasicSplitPaneDivider extends Container /** * Messages dragDividerTo with the new location for the mouse * event. + * + * @param e a mouse event */ protected void continueDrag(MouseEvent e) { dragDividerTo(positionForMouseEvent(e)); } - + /** + * Messages finishDraggingTo with the new location for the mouse + * event. + * + * @param x an X coordinate + * @param y an Y coordinate + */ protected void completeDrag(int x, int y) { finishDraggingTo(getNeededLocation(x, y)); } @@ -795,6 +845,8 @@ public class BasicSplitPaneDivider extends Container /** * Messages finishDraggingTo with the new location for the mouse * event. + * + * @param e a mouse event */ protected void completeDrag(MouseEvent e) { finishDraggingTo(positionForMouseEvent(e)); @@ -813,6 +865,11 @@ public class BasicSplitPaneDivider extends Container protected class VerticalDragController extends DragController { /* DragControllers ivars are now in terms of y, not x. */ + /** + * Constructs a new instance of {@code VerticalDragController}. + * + * @param e a mouse event + */ protected VerticalDragController(MouseEvent e) { super(e); JSplitPane splitPane = splitPaneUI.getSplitPane(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java index ba92184b436..bff514b57ff 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java @@ -64,12 +64,29 @@ public class BasicTableUI extends TableUI // // The JTable that is delegating the painting to this UI. + /** + * The instance of {@code JTable}. + */ protected JTable table; + + /** + * The instance of {@code CellRendererPane}. + */ protected CellRendererPane rendererPane; - // Listeners that are attached to the JTable + /** + * {@code KeyListener} that are attached to the {@code JTable}. + */ protected KeyListener keyListener; + + /** + * {@code FocusListener} that are attached to the {@code JTable}. + */ protected FocusListener focusListener; + + /** + * {@code MouseInputListener} that are attached to the {@code JTable}. + */ protected MouseInputListener mouseInputListener; private Handler handler; @@ -1350,21 +1367,27 @@ public class BasicTableUI extends TableUI } /** - * Creates the key listener for handling keyboard navigation in the JTable. + * Creates the key listener for handling keyboard navigation in the {@code JTable}. + * + * @return the key listener for handling keyboard navigation in the {@code JTable} */ protected KeyListener createKeyListener() { return null; } /** - * Creates the focus listener for handling keyboard navigation in the JTable. + * Creates the focus listener for handling keyboard navigation in the {@code JTable}. + * + * @return the focus listener for handling keyboard navigation in the {@code JTable} */ protected FocusListener createFocusListener() { return getHandler(); } /** - * Creates the mouse listener for the JTable. + * Creates the mouse listener for the {@code JTable}. + * + * @return the mouse listener for the {@code JTable} */ protected MouseInputListener createMouseInputListener() { return getHandler(); @@ -1374,6 +1397,12 @@ public class BasicTableUI extends TableUI // The installation/uninstall procedures and support // + /** + * Returns a new instance of {@code BasicTableUI}. + * + * @param c a component + * @return a new instance of {@code BasicTableUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicTableUI(); } @@ -1616,12 +1645,18 @@ public class BasicTableUI extends TableUI table = null; } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { if (table.getTransferHandler() instanceof UIResource) { table.setTransferHandler(null); } } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { table.removeFocusListener(focusListener); table.removeKeyListener(keyListener); @@ -1638,6 +1673,9 @@ public class BasicTableUI extends TableUI handler = null; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIInputMap(table, JComponent. WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null); From f77b84ddc6fd4688ad15e53d4df9fbc388ff3f15 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Thu, 10 Jul 2014 15:08:50 +0400 Subject: [PATCH 09/94] 8049830: Remove reflection from ScreenMenuBar Reviewed-by: anthony, serb --- .../classes/com/apple/laf/ScreenMenuBar.java | 51 +++++-------------- .../share/classes/java/awt/MenuComponent.java | 8 +++ .../share/classes/sun/awt/AWTAccessor.java | 7 ++- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java index f4c0aaf4ee8..2d56499ebb3 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java +++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java @@ -25,6 +25,9 @@ package com.apple.laf; +import sun.awt.AWTAccessor; +import sun.lwawt.macosx.CMenuBar; + import java.awt.*; import java.awt.event.*; import java.lang.reflect.*; @@ -243,55 +246,25 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM fSubmenus.remove(menu); } - private static Field[] stolenFields = null; - - static { - stolenFields = AccessController.doPrivileged(new PrivilegedAction() { - public Field[] run() { - try { - final Field[] localFields = new Field[2]; - localFields[0] = MenuBar.class.getDeclaredField("menus"); - localFields[1] = MenuComponent.class.getDeclaredField("parent"); - AccessibleObject.setAccessible(localFields, true); - return localFields; - } catch (final NoSuchFieldException nsf) { - // If this happens, Sun changed the definition of MenuBar and MenuComponent! - nsf.printStackTrace(System.err); - return null; - } - } - }); - }; - public Menu add(final Menu m, final int index) { synchronized (getTreeLock()) { if (m.getParent() != null) { m.getParent().remove(m); } - // Use nasty reflection to get at the menus array and parent fields. - try { - if (stolenFields == null) return m; + final Vector menus = AWTAccessor.getMenuBarAccessor().getMenus(this); + menus.insertElementAt(m, index); + AWTAccessor.getMenuComponentAccessor().setParent(m, this); - @SuppressWarnings("unchecked") - final Vector menus = (Vector)stolenFields[0].get(this); - menus.insertElementAt(m, index); + final CMenuBar peer = (CMenuBar)getPeer(); + if (peer == null) return m; - stolenFields[1].set(m, this); - - final sun.lwawt.macosx.CMenuBar peer = (sun.lwawt.macosx.CMenuBar)getPeer(); - if (peer == null) return m; - - peer.setNextInsertionIndex(index); - if (m.getPeer() == null) { - m.addNotify(); - } - - peer.setNextInsertionIndex(-1); - } catch (final IllegalAccessException iae) { - iae.printStackTrace(System.err); + peer.setNextInsertionIndex(index); + if (m.getPeer() == null) { + m.addNotify(); } + peer.setNextInsertionIndex(-1); return m; } } diff --git a/jdk/src/share/classes/java/awt/MenuComponent.java b/jdk/src/share/classes/java/awt/MenuComponent.java index 4ea95bf5969..64b1db9bf06 100644 --- a/jdk/src/share/classes/java/awt/MenuComponent.java +++ b/jdk/src/share/classes/java/awt/MenuComponent.java @@ -132,16 +132,24 @@ public abstract class MenuComponent implements java.io.Serializable { static { AWTAccessor.setMenuComponentAccessor( new AWTAccessor.MenuComponentAccessor() { + @Override public AppContext getAppContext(MenuComponent menuComp) { return menuComp.appContext; } + @Override public void setAppContext(MenuComponent menuComp, AppContext appContext) { menuComp.appContext = appContext; } + @Override public MenuContainer getParent(MenuComponent menuComp) { return menuComp.parent; } + @Override + public void setParent(MenuComponent menuComp, MenuContainer menuContainer) { + menuComp.parent = menuContainer; + } + @Override public Font getFont_NoClientCode(MenuComponent menuComp) { return menuComp.getFont_NoClientCode(); } diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index 0bec70b332a..ddf88d39c79 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -481,10 +481,15 @@ public final class AWTAccessor { void setAppContext(MenuComponent menuComp, AppContext appContext); /** - * Returns the menu container of the menu component + * Returns the menu container of the menu component. */ MenuContainer getParent(MenuComponent menuComp); + /** + * Sets the menu container of the menu component. + */ + void setParent(MenuComponent menuComp, MenuContainer menuContainer); + /** * Gets the font used for this menu component. */ From 2194d4368fe67e9aca7092d22ccc2608373cb30f Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Thu, 10 Jul 2014 17:20:56 +0400 Subject: [PATCH 10/94] 8049808: Fix doclint warnings from javax.swing.plaf.basic package, 3 of 7 Reviewed-by: pchelko --- .../javax/swing/plaf/basic/BasicBorders.java | 150 ++++++++++++- .../javax/swing/plaf/basic/BasicListUI.java | 129 ++++++++--- .../swing/plaf/basic/BasicMenuItemUI.java | 138 +++++++++++- .../swing/plaf/basic/BasicProgressBarUI.java | 79 ++++++- .../swing/plaf/basic/BasicSplitPaneUI.java | 204 ++++++++++++------ 5 files changed, 599 insertions(+), 101 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java index 05a3093e254..633b2f91ee4 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java @@ -45,6 +45,11 @@ import java.awt.Graphics; public class BasicBorders { + /** + * Returns a border instance for a {@code JButton}. + * + * @return a border instance for a {@code JButton} + */ public static Border getButtonBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border buttonBorder = new BorderUIResource.CompoundBorderUIResource( @@ -57,6 +62,11 @@ public class BasicBorders { return buttonBorder; } + /** + * Returns a border instance for a {@code JRadioButton}. + * + * @return a border instance for a {@code JRadioButton} + */ public static Border getRadioButtonBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border radioButtonBorder = new BorderUIResource.CompoundBorderUIResource( @@ -69,6 +79,11 @@ public class BasicBorders { return radioButtonBorder; } + /** + * Returns a border instance for a {@code JToggleButton}. + * + * @return a border instance for a {@code JToggleButton} + */ public static Border getToggleButtonBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource( @@ -81,6 +96,11 @@ public class BasicBorders { return toggleButtonBorder; } + /** + * Returns a border instance for a {@code JMenuBar}. + * + * @return a border instance for a {@code JMenuBar} + */ public static Border getMenuBarBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border menuBarBorder = new BasicBorders.MenuBarBorder( @@ -90,6 +110,11 @@ public class BasicBorders { return menuBarBorder; } + /** + * Returns a border instance for a {@code JSplitPane}. + * + * @return a border instance for a {@code JSplitPane} + */ public static Border getSplitPaneBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border splitPaneBorder = new BasicBorders.SplitPaneBorder( @@ -99,7 +124,9 @@ public class BasicBorders { } /** - * Returns a border instance for a JSplitPane divider + * Returns a border instance for a {@code JSplitPane} divider. + * + * @return a border instance for a {@code JSplitPane} divider * @since 1.3 */ public static Border getSplitPaneDividerBorder() { @@ -110,6 +137,11 @@ public class BasicBorders { return splitPaneBorder; } + /** + * Returns a border instance for a {@code JTextField}. + * + * @return a border instance for a {@code JTextField} + */ public static Border getTextFieldBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border textFieldBorder = new BasicBorders.FieldBorder( @@ -120,12 +152,22 @@ public class BasicBorders { return textFieldBorder; } + /** + * Returns a border instance for a {@code JProgressBar}. + * + * @return a border instance for a {@code JProgressBar} + */ public static Border getProgressBarBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border progressBarBorder = new BorderUIResource.LineBorderUIResource(Color.green, 2); return progressBarBorder; } + /** + * Returns a border instance for a {@code JInternalFrame}. + * + * @return a border instance for a {@code JInternalFrame} + */ public static Border getInternalFrameBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border internalFrameBorder = new BorderUIResource.CompoundBorderUIResource( @@ -147,6 +189,14 @@ public class BasicBorders { @SuppressWarnings("serial") // Superclass is not serializable across versions public static class RolloverButtonBorder extends ButtonBorder { + /** + * Constructs a new instance of a {@code RolloverButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public RolloverButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { super(shadow, darkShadow, highlight, lightHighlight); @@ -227,13 +277,36 @@ public class BasicBorders { } } + /** + * Draws a border around a button. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class ButtonBorder extends AbstractBorder implements UIResource { + /** + * The color of shadow. + */ protected Color shadow; + /** + * The color of dark shadow. + */ protected Color darkShadow; + /** + * The color of highlight. + */ protected Color highlight; + /** + * The color of light highlight. + */ protected Color lightHighlight; + /** + * Constructs a new instance of a {@code ButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public ButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { this.shadow = shadow; @@ -270,9 +343,20 @@ public class BasicBorders { } + /** + * Draws the border around a toggle button. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class ToggleButtonBorder extends ButtonBorder { + /** + * Constructs a new instance of a {@code ToggleButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public ToggleButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { super(shadow, darkShadow, highlight, lightHighlight); @@ -292,9 +376,20 @@ public class BasicBorders { } } + /** + * Draws the border around a radio button. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class RadioButtonBorder extends ButtonBorder { + /** + * Constructs a new instance of a {@code RadioButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public RadioButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { super(shadow, darkShadow, highlight, lightHighlight); @@ -329,11 +424,26 @@ public class BasicBorders { } } + /** + * Draws the border around a menu bar. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class MenuBarBorder extends AbstractBorder implements UIResource { + /** + * The color of shadow. + */ private Color shadow; + /** + * The color of highlight. + */ private Color highlight; + /** + * Constructs a new instance of a {@code MenuBarBorder}. + * + * @param shadow a color of shadow + * @param highlight a color of highlight + */ public MenuBarBorder(Color shadow, Color highlight) { this.shadow = shadow; this.highlight = highlight; @@ -356,6 +466,9 @@ public class BasicBorders { } } + /** + * Draws the border around components which support margins. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class MarginBorder extends AbstractBorder implements UIResource { public Insets getBorderInsets(Component c, Insets insets) { @@ -384,13 +497,36 @@ public class BasicBorders { } } + /** + * Draws the border around a field. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class FieldBorder extends AbstractBorder implements UIResource { + /** + * The color of shadow. + */ protected Color shadow; + /** + * The color of dark shadow. + */ protected Color darkShadow; + /** + * The color of highlight. + */ protected Color highlight; + /** + * The color of light highlight. + */ protected Color lightHighlight; + /** + * Constructs a new instance of a {@code FieldBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public FieldBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { this.shadow = shadow; @@ -509,9 +645,21 @@ public class BasicBorders { * also install a border on the divider (property SplitPaneDivider.border). */ public static class SplitPaneBorder implements Border, UIResource { + /** + * The color of highlight + */ protected Color highlight; + /** + * The color of shadow + */ protected Color shadow; + /** + * Constructs a new instance of a {@code SplitPaneBorder}. + * + * @param highlight a color of highlight + * @param shadow a color of shadow + */ public SplitPaneBorder(Color highlight, Color shadow) { this.highlight = highlight; this.shadow = shadow; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java index c66069e0ae6..fd4292e6350 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java @@ -59,20 +59,53 @@ public class BasicListUI extends ListUI private static final StringBuilder BASELINE_COMPONENT_KEY = new StringBuilder("List.baselineComponent"); + /** + * The instance of {@code JList}. + */ protected JList list = null; + /** + * The instance of {@code CellRendererPane}. + */ protected CellRendererPane rendererPane; // Listeners that this UI attaches to the JList + /** + * {@code FocusListener} that attached to {@code JList}. + */ protected FocusListener focusListener; + /** + * {@code MouseInputListener} that attached to {@code JList}. + */ protected MouseInputListener mouseInputListener; + /** + * {@code ListSelectionListener} that attached to {@code JList}. + */ protected ListSelectionListener listSelectionListener; + /** + * {@code ListDataListener} that attached to {@code JList}. + */ protected ListDataListener listDataListener; + /** + * {@code PropertyChangeListener} that attached to {@code JList}. + */ protected PropertyChangeListener propertyChangeListener; private Handler handler; + /** + * The array of cells' height + */ protected int[] cellHeights = null; + /** + * The height of cell. + */ protected int cellHeight = -1; + /** + * The width of cell. + */ protected int cellWidth = -1; + /** + * The value represents changes to {@code JList} model. + */ protected int updateLayoutStateNeeded = modelChanged; /** * Height of the list. When asked to paint, if the current size of @@ -131,12 +164,33 @@ public class BasicListUI extends ListUI * models length changed, are handled similarly, see DataListener. */ + /** + * The bit relates to model changed property. + */ protected final static int modelChanged = 1 << 0; + /** + * The bit relates to selection model changed property. + */ protected final static int selectionModelChanged = 1 << 1; + /** + * The bit relates to font changed property. + */ protected final static int fontChanged = 1 << 2; + /** + * The bit relates to fixed cell width changed property. + */ protected final static int fixedCellWidthChanged = 1 << 3; + /** + * The bit relates to fixed cell height changed property. + */ protected final static int fixedCellHeightChanged = 1 << 4; + /** + * The bit relates to prototype cell value changed property. + */ protected final static int prototypeCellValueChanged = 1 << 5; + /** + * The bit relates to cell renderer changed property. + */ protected final static int cellRendererChanged = 1 << 6; private final static int layoutOrientationChanged = 1 << 7; private final static int heightChanged = 1 << 8; @@ -187,9 +241,16 @@ public class BasicListUI extends ListUI /** * Paint one List cell: compute the relevant state, get the "rubber stamp" - * cell renderer component, and then use the CellRendererPane to paint it. - * Subclasses may want to override this method rather than paint(). + * cell renderer component, and then use the {@code CellRendererPane} to paint it. + * Subclasses may want to override this method rather than {@code paint()}. * + * @param g an instance of {@code Graphics} + * @param row a row + * @param rowBounds a bounding rectangle to render to + * @param cellRenderer a list of {@code ListCellRenderer} + * @param dataModel a list model + * @param selModel a selection model + * @param leadIndex a lead index * @see #paint */ protected void paintCell( @@ -916,10 +977,11 @@ public class BasicListUI extends ListUI /** - * Returns a new instance of BasicListUI. BasicListUI delegates are - * allocated one per JList. + * Returns a new instance of {@code BasicListUI}. + * {@code BasicListUI} delegates are allocated one per {@code JList}. * - * @return A new ListUI implementation for the Windows look and feel. + * @param list a component + * @return a new {@code ListUI} implementation for the Windows look and feel. */ public static ComponentUI createUI(JComponent list) { return new BasicListUI(); @@ -1046,7 +1108,8 @@ public class BasicListUI extends ListUI /** * Returns the height of the specified row based on the current layout. * - * @return The specified row height or -1 if row isn't valid. + * @param row a row + * @return the specified row height or -1 if row isn't valid * @see #convertYToRow * @see #convertRowToY * @see #updateLayoutState @@ -1058,11 +1121,12 @@ public class BasicListUI extends ListUI /** - * Convert the JList relative coordinate to the row that contains it, - * based on the current layout. If y0 doesn't fall within any row, + * Convert the {@code JList} relative coordinate to the row that contains it, + * based on the current layout. If {@code y0} doesn't fall within any row, * return -1. * - * @return The row that contains y0, or -1. + * @param y0 a relative Y coordinate + * @return the row that contains y0, or -1 * @see #getRowHeight * @see #updateLayoutState */ @@ -1073,10 +1137,11 @@ public class BasicListUI extends ListUI /** - * Return the JList relative Y coordinate of the origin of the specified + * Return the {@code JList} relative Y coordinate of the origin of the specified * row or -1 if row isn't valid. * - * @return The Y coordinate of the origin of row, or -1. + * @param row a row + * @return the Y coordinate of the origin of row, or -1 * @see #getRowHeight * @see #updateLayoutState */ @@ -1535,10 +1600,10 @@ public class BasicListUI extends ListUI /** - * Creates a delegate that implements MouseInputListener. - * The delegate is added to the corresponding java.awt.Component listener - * lists at installUI() time. Subclasses can override this method to return - * a custom MouseInputListener, e.g. + * Creates a delegate that implements {@code MouseInputListener}. + * The delegate is added to the corresponding {@code java.awt.Component} listener + * lists at {@code installUI()} time. Subclasses can override this method to return + * a custom {@code MouseInputListener}, e.g. *
      * class MyListUI extends BasicListUI {
      *    protected MouseInputListener createMouseInputListener() {
@@ -1553,6 +1618,7 @@ public class BasicListUI extends ListUI
      * }
      * 
* + * @return an instance of {@code MouseInputListener} * @see MouseInputHandler * @see #installUI */ @@ -1566,6 +1632,9 @@ public class BasicListUI extends ListUI */ public class FocusHandler implements FocusListener { + /** + * Repaints focused cells. + */ protected void repaintCellFocus() { getHandler().repaintCellFocus(); @@ -1584,6 +1653,11 @@ public class BasicListUI extends ListUI } } + /** + * Returns an instance of {@code FocusListener}. + * + * @return an instance of {@code FocusListener} + */ protected FocusListener createFocusListener() { return getHandler(); } @@ -1617,9 +1691,9 @@ public class BasicListUI extends ListUI /** - * Creates an instance of ListSelectionHandler that's added to - * the JLists by selectionModel as needed. Subclasses can override - * this method to return a custom ListSelectionListener, e.g. + * Creates an instance of {@code ListSelectionHandler} that's added to + * the {@code JLists} by selectionModel as needed. Subclasses can override + * this method to return a custom {@code ListSelectionListener}, e.g. *
      * class MyListUI extends BasicListUI {
      *    protected ListSelectionListener createListSelectionListener() {
@@ -1634,6 +1708,7 @@ public class BasicListUI extends ListUI
      * }
      * 
* + * @return an instance of {@code ListSelectionHandler} * @see ListSelectionHandler * @see #installUI */ @@ -1649,8 +1724,8 @@ public class BasicListUI extends ListUI /** - * The ListDataListener that's added to the JLists model at - * installUI time, and whenever the JList.model property changes. + * The {@code ListDataListener} that's added to the {@code JLists} model at + * {@code installUI time}, and whenever the JList.model property changes. *

* Warning: * Serialized objects of this class will not be compatible with @@ -1687,9 +1762,9 @@ public class BasicListUI extends ListUI /** - * Creates an instance of ListDataListener that's added to - * the JLists by model as needed. Subclasses can override - * this method to return a custom ListDataListener, e.g. + * Creates an instance of {@code ListDataListener} that's added to + * the {@code JLists} by model as needed. Subclasses can override + * this method to return a custom {@code ListDataListener}, e.g. *

      * class MyListUI extends BasicListUI {
      *    protected ListDataListener createListDataListener() {
@@ -1704,6 +1779,7 @@ public class BasicListUI extends ListUI
      * }
      * 
* + * @return an instance of {@code ListDataListener} * @see ListDataListener * @see JList#getModel * @see #installUI @@ -1744,9 +1820,9 @@ public class BasicListUI extends ListUI /** - * Creates an instance of PropertyChangeHandler that's added to - * the JList by installUI(). Subclasses can override this method - * to return a custom PropertyChangeListener, e.g. + * Creates an instance of {@code PropertyChangeHandler} that's added to + * the {@code JList} by {@code installUI()}. Subclasses can override this method + * to return a custom {@code PropertyChangeListener}, e.g. *
      * class MyListUI extends BasicListUI {
      *    protected PropertyChangeListener createPropertyChangeListener() {
@@ -1763,6 +1839,7 @@ public class BasicListUI extends ListUI
      * }
      * 
* + * @return an instance of {@code PropertyChangeHandler} * @see PropertyChangeListener * @see #installUI */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java index 9562a2089d6..d8e73a71290 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,11 +47,29 @@ import sun.swing.*; */ public class BasicMenuItemUI extends MenuItemUI { + /** + * The instance of {@code JMenuItem}. + */ protected JMenuItem menuItem = null; + /** + * The color of the selection background. + */ protected Color selectionBackground; + /** + * The color of the selection foreground. + */ protected Color selectionForeground; + /** + * The color of the disabled foreground. + */ protected Color disabledForeground; + /** + * The color of the accelerator foreground. + */ protected Color acceleratorForeground; + /** + * The color of the accelerator selection. + */ protected Color acceleratorSelectionForeground; /** @@ -60,18 +78,33 @@ public class BasicMenuItemUI extends MenuItemUI */ protected String acceleratorDelimiter; + /** + * The gap between the text and the icon. + */ protected int defaultTextIconGap; + /** + * The accelerator font. + */ protected Font acceleratorFont; + /** + * The instance of {@code MouseInputListener}. + */ protected MouseInputListener mouseInputListener; + /** + * The instance of {@code MenuDragMouseListener}. + */ protected MenuDragMouseListener menuDragMouseListener; + /** + * The instance of {@code MenuKeyListener}. + */ protected MenuKeyListener menuKeyListener; /** - * PropertyChangeListener returned from - * createPropertyChangeListener. You should not + * {@code PropertyChangeListener} returned from + * {@code createPropertyChangeListener}. You should not * need to access this field, rather if you want to customize the - * PropertyChangeListener override - * createPropertyChangeListener. + * {@code PropertyChangeListener} override + * {@code createPropertyChangeListener}. * * @since 1.6 * @see #createPropertyChangeListener @@ -79,10 +112,17 @@ public class BasicMenuItemUI extends MenuItemUI protected PropertyChangeListener propertyChangeListener; // BasicMenuUI also uses this. Handler handler; - + /** + * The arrow icon. + */ protected Icon arrowIcon = null; + /** + * The check icon. + */ protected Icon checkIcon = null; - + /** + * The value represents if the old border is painted. + */ protected boolean oldBorderPainted; /* diagnostic aids -- should be false for production builds. */ @@ -97,6 +137,12 @@ public class BasicMenuItemUI extends MenuItemUI BasicLookAndFeel.installAudioActionMap(map); } + /** + * Returns a new instance of {@code BasicMenuItemUI}. + * + * @param c a component + * @return a new instance of {@code BasicMenuItemUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicMenuItemUI(); } @@ -110,7 +156,9 @@ public class BasicMenuItemUI extends MenuItemUI installKeyboardActions(); } - + /** + * Installs default properties. + */ protected void installDefaults() { String prefix = getPropertyPrefix(); @@ -202,16 +250,26 @@ public class BasicMenuItemUI extends MenuItemUI } /** + * + * @param menuItem a menu item * @since 1.3 */ protected void installComponents(JMenuItem menuItem){ BasicHTML.updateRenderer(menuItem, menuItem.getText()); } + /** + * Returns a property prefix. + * + * @return a property prefix + */ protected String getPropertyPrefix() { return "MenuItem"; } + /** + * Registers listeners. + */ protected void installListeners() { if ((mouseInputListener = createMouseInputListener(menuItem)) != null) { menuItem.addMouseListener(mouseInputListener); @@ -228,6 +286,9 @@ public class BasicMenuItemUI extends MenuItemUI } } + /** + * Registers keyboard action. + */ protected void installKeyboardActions() { installLazyActionMap(); updateAcceleratorBinding(); @@ -248,7 +309,9 @@ public class BasicMenuItemUI extends MenuItemUI menuItem = null; } - + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(menuItem); LookAndFeel.installProperty(menuItem, "borderPainted", oldBorderPainted); @@ -261,12 +324,18 @@ public class BasicMenuItemUI extends MenuItemUI } /** + * Unregisters components. + * + * @param menuItem a menu item * @since 1.3 */ protected void uninstallComponents(JMenuItem menuItem){ BasicHTML.updateRenderer(menuItem, ""); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { if (mouseInputListener != null) { menuItem.removeMouseListener(mouseInputListener); @@ -289,30 +358,52 @@ public class BasicMenuItemUI extends MenuItemUI handler = null; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIActionMap(menuItem, null); SwingUtilities.replaceUIInputMap(menuItem, JComponent. WHEN_IN_FOCUSED_WINDOW, null); } + /** + * Returns an instance of {@code MouseInputListener}. + * + * @param c a component + * @return an instance of {@code MouseInputListener} + */ protected MouseInputListener createMouseInputListener(JComponent c) { return getHandler(); } + /** + * Returns an instance of {@code MenuDragMouseListener}. + * + * @param c a component + * @return an instance of {@code MenuDragMouseListener} + */ protected MenuDragMouseListener createMenuDragMouseListener(JComponent c) { return getHandler(); } + /** + * Returns an instance of {@code MenuKeyListener}. + * + * @param c a component + * @return an instance of {@code MenuKeyListener} + */ protected MenuKeyListener createMenuKeyListener(JComponent c) { return null; } /** - * Creates a PropertyChangeListener which will be added to + * Creates a {@code PropertyChangeListener} which will be added to * the menu item. * If this method returns null then it will not be added to the menu item. * - * @return an instance of a PropertyChangeListener or null + * @param c a component + * @return an instance of a {@code PropertyChangeListener} or null * @since 1.6 */ protected PropertyChangeListener @@ -380,6 +471,15 @@ public class BasicMenuItemUI extends MenuItemUI return d; } + /** + * Returns the preferred size of a menu item. + * + * @param c a component + * @param checkIcon a check icon + * @param arrowIcon an arrow icon + * @param defaultTextIconGap a gap between a text and an icon + * @return the preferred size of a menu item + */ protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, @@ -477,6 +577,17 @@ public class BasicMenuItemUI extends MenuItemUI defaultTextIconGap); } + /** + * Paints a menu item. + * + * @param g an instance of {@code Graphics} + * @param c a component + * @param checkIcon a check icon + * @param arrowIcon an arrow icon + * @param background a background color + * @param foreground a foreground color + * @param defaultTextIconGap a gap between a text and an icon + */ protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, @@ -701,6 +812,11 @@ public class BasicMenuItemUI extends MenuItemUI } } + /** + * Returns a menu element path. + * + * @return a menu element path + */ public MenuElement[] getPath() { MenuSelectionManager m = MenuSelectionManager.defaultManager(); MenuElement oldPath[] = m.getSelectedPath(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java index 8c4dbb1126c..caebdfe1688 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,13 @@ public class BasicProgressBarUI extends ProgressBarUI { private Animator animator; + /** + * The instance of {@code JProgressBar}. + */ protected JProgressBar progressBar; + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener changeListener; private Handler handler; @@ -127,7 +133,12 @@ public class BasicProgressBarUI extends ProgressBarUI { private int maxPosition = 0; //maximum X (horiz) or Y box location - + /** + * Returns a new instance of {@code BasicProgressBarUI}. + * + * @param x a component + * @return a new instance of {@code BasicProgressBarUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicProgressBarUI(); } @@ -150,6 +161,9 @@ public class BasicProgressBarUI extends ProgressBarUI { progressBar = null; } + /** + * Installs default properties. + */ protected void installDefaults() { LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE); LookAndFeel.installBorder(progressBar,"ProgressBar.border"); @@ -164,10 +178,16 @@ public class BasicProgressBarUI extends ProgressBarUI { selectionBackground = UIManager.getColor("ProgressBar.selectionBackground"); } + /** + * Unintalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(progressBar); } + /** + * Registers listeners. + */ protected void installListeners() { //Listen for changes in the progress bar's data. changeListener = getHandler(); @@ -291,6 +311,11 @@ public class BasicProgressBarUI extends ProgressBarUI { // protected void installKeyboardActions() // protected void uninstallKeyboardActions() + /** + * Returns preferred size of the horizontal {@code JProgressBar}. + * + * @return preferred size of the horizontal {@code JProgressBar} + */ protected Dimension getPreferredInnerHorizontal() { Dimension horizDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.horizontalSize"); @@ -300,6 +325,11 @@ public class BasicProgressBarUI extends ProgressBarUI { return horizDim; } + /** + * Returns preferred size of the vertical {@code JProgressBar}. + * + * @return preferred size of the vertical {@code JProgressBar} + */ protected Dimension getPreferredInnerVertical() { Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.verticalSize"); @@ -312,6 +342,8 @@ public class BasicProgressBarUI extends ProgressBarUI { /** * The "selectionForeground" is the color of the text when it is painted * over a filled area of the progress bar. + * + * @return the color of the selected foreground */ protected Color getSelectionForeground() { return selectionForeground; @@ -320,6 +352,8 @@ public class BasicProgressBarUI extends ProgressBarUI { /** * The "selectionBackground" is the color of the text when it is painted * over an unfilled area of the progress bar. + * + * @return the color of the selected background */ protected Color getSelectionBackground() { return selectionBackground; @@ -352,6 +386,11 @@ public class BasicProgressBarUI extends ProgressBarUI { } } + /** + * Sets the cell length. + * + * @param cellLen a new cell length + */ protected void setCellLength(int cellLen) { this.cellLength = cellLen; } @@ -374,6 +413,11 @@ public class BasicProgressBarUI extends ProgressBarUI { } } + /** + * Sets the cell spacing. + * + * @param cellSpace a new cell spacing + */ protected void setCellSpacing(int cellSpace) { this.cellSpacing = cellSpace; } @@ -384,6 +428,11 @@ public class BasicProgressBarUI extends ProgressBarUI { * operation so it was abstracted out. It assumes that your progress bar * is linear. That is, if you are making a circular progress indicator, * you will want to override this method. + * + * @param b insets + * @param width a width + * @param height a height + * @return the amount of the progress bar that should be filled */ protected int getAmountFull(Insets b, int width, int height) { int amountFull = 0; @@ -577,6 +626,8 @@ public class BasicProgressBarUI extends ProgressBarUI { * Override this if you are making another kind of * progress bar. * + * @param g an instance of {@code Graphics} + * @param c a component * @see #paintDeterminate * * @since 1.4 @@ -628,6 +679,8 @@ public class BasicProgressBarUI extends ProgressBarUI { * Naturally, override this if you are making a circular or * semi-circular progress bar. * + * @param g an instance of {@code Graphics} + * @param c a component * @see #paintIndeterminate * * @since 1.4 @@ -703,7 +756,18 @@ public class BasicProgressBarUI extends ProgressBarUI { } } - + /** + * Paints the progress string. + * + * @param g an instance of {@code Graphics} + * @param x X location of bounding box + * @param y Y location of bounding box + * @param width width of bounding box + * @param height height of bounding box + * @param amountFull size of the fill region, either width or height + * depending upon orientation. + * @param b Insets of the progress bar. + */ protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) { @@ -793,6 +857,14 @@ public class BasicProgressBarUI extends ProgressBarUI { * bar (in both x and y). Override this if you want to right, * left, top, or bottom align the progress string or if you need * to nudge it around for any reason. + * + * @param g an instance of {@code Graphics} + * @param progressString a text + * @param x an X coordinate + * @param y an Y coordinate + * @param width a width + * @param height a height + * @return the place where the progress string will be painted */ protected Point getStringPlacement(Graphics g, String progressString, int x,int y,int width,int height) { @@ -894,6 +966,7 @@ public class BasicProgressBarUI extends ProgressBarUI { /** * Gets the index of the current animation frame. * + * @return the index of the current animation frame * @since 1.4 */ protected int getAnimationIndex() { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java index 405795b985d..133325ff9b7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java @@ -286,7 +286,10 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Creates a new BasicSplitPaneUI instance + * Creates a new instance of {@code BasicSplitPaneUI}. + * + * @param x a component + * @return a new instance of {@code BasicSplitPaneUI} */ public static ComponentUI createUI(JComponent x) { return new BasicSplitPaneUI(); @@ -503,7 +506,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Creates a PropertyChangeListener for the JSplitPane UI. + * Creates a {@code PropertyChangeListener} for the {@code JSplitPane} UI. + * + * @return an instance of {@code PropertyChangeListener} */ protected PropertyChangeListener createPropertyChangeListener() { return getHandler(); @@ -518,7 +523,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Creates a FocusListener for the JSplitPane UI. + * Creates a {@code FocusListener} for the {@code JSplitPane} UI. + * + * @return an instance of {@code FocusListener} */ protected FocusListener createFocusListener() { return getHandler(); @@ -526,16 +533,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

- * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -545,16 +553,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

- * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -564,16 +573,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

- * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -583,16 +593,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

- * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -602,16 +613,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

- * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -621,7 +633,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the orientation for the JSplitPane. + * Returns the orientation for the {@code JSplitPane}. + * + * @return the orientation */ public int getOrientation() { return orientation; @@ -629,7 +643,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Set the orientation for the JSplitPane. + * Set the orientation for the {@code JSplitPane}. + * + * @param orientation the orientation */ public void setOrientation(int orientation) { this.orientation = orientation; @@ -637,7 +653,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Determines whether the JSplitPane is set to use a continuous layout. + * Determines whether the {@code JSplitPane} is set to use a continuous layout. + * + * @return {@code true} if a continuous layout is set */ public boolean isContinuousLayout() { return continuousLayout; @@ -646,6 +664,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Turn continuous layout on/off. + * + * @param b if {@code true} the continuous layout turns on */ public void setContinuousLayout(boolean b) { continuousLayout = b; @@ -653,7 +673,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the last drag location of the JSplitPane. + * Returns the last drag location of the {@code JSplitPane}. + * + * @return the last drag location */ public int getLastDragLocation() { return lastDragLocation; @@ -661,7 +683,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Set the last drag location of the JSplitPane. + * Set the last drag location of the {@code JSplitPane}. + * + * @param l the drag location */ public void setLastDragLocation(int l) { lastDragLocation = l; @@ -819,6 +843,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the divider between the top Components. + * + * @return the divider between the top Components */ public BasicSplitPaneDivider getDivider() { return divider; @@ -828,6 +854,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the default non continuous layout divider, which is an * instance of {@code Canvas} that fills in the background with dark gray. + * + * @return the default non continuous layout divider */ @SuppressWarnings("serial") // anonymous class protected Component createDefaultNonContinuousLayoutDivider() { @@ -849,10 +877,12 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Sets the divider to use when the splitPane is configured to + * Sets the divider to use when the {@code JSplitPane} is configured to * not continuously layout. This divider will only be used during a * dragging session. It is recommended that the passed in component * be a heavy weight. + * + * @param newDivider the new divider */ protected void setNonContinuousLayoutDivider(Component newDivider) { setNonContinuousLayoutDivider(newDivider, true); @@ -861,6 +891,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Sets the divider to use. + * + * @param newDivider the new divider + * @param rememberSizes if {@code true} the pane size is remembered */ protected void setNonContinuousLayoutDivider(Component newDivider, boolean rememberSizes) { @@ -903,9 +936,11 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the divider to use when the splitPane is configured to + * Returns the divider to use when the {@code JSplitPane} is configured to * not continuously layout. This divider will only be used during a * dragging session. + * + * @return the divider */ public Component getNonContinuousLayoutDivider() { return nonContinuousLayoutDivider; @@ -913,8 +948,10 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the splitpane this instance is currently contained + * Returns the {@code JSplitPane} this instance is currently contained * in. + * + * @return the instance of {@code JSplitPane} */ public JSplitPane getSplitPane() { return splitPane; @@ -923,6 +960,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Creates the default divider. + * + * @return the default divider */ public BasicSplitPaneDivider createDefaultDivider() { return new BasicSplitPaneDivider(this); @@ -1108,6 +1147,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the insets. The insets are returned from the border insets * of the current border. + * + * @param jc a component + * @return the insets */ public Insets getInsets(JComponent jc) { return null; @@ -1187,8 +1229,10 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Messaged during a dragging session to move the divider to the - * passed in location. If continuousLayout is true the location is - * reset and the splitPane validated. + * passed in {@code location}. If {@code continuousLayout} is {@code true} + * the location is reset and the splitPane validated. + * + * @param location the location of divider */ protected void dragDividerTo(int location) { if(getLastDragLocation() != location) { @@ -1230,7 +1274,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Messaged to finish the dragging session. If not continuous display - * the dividers location will be reset. + * the dividers {@code location} will be reset. + * + * @param location the location of divider */ protected void finishDraggingTo(int location) { dragDividerTo(location); @@ -1259,6 +1305,7 @@ public class BasicSplitPaneUI extends SplitPaneUI *

* Returns the width of one side of the divider border. * + * @return the width of one side of the divider border * @deprecated As of Java 2 platform v1.3, instead set the border on the * divider. */ @@ -1275,7 +1322,13 @@ public class BasicSplitPaneUI extends SplitPaneUI public class BasicHorizontalLayoutManager implements LayoutManager2 { /* left, right, divider. (in this exact order) */ + /** + * The size of components. + */ protected int[] sizes; + /** + * The components. + */ protected Component[] components; /** Size of the splitpane the last time laid out. */ private int lastSplitPaneSize; @@ -1596,6 +1649,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Resets the size of the Component at the passed in location. + * + * @param index the index of a component */ protected void resetSizeAt(int index) { sizes[index] = 0; @@ -1604,7 +1659,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Sets the sizes to newSizes. + * Sets the sizes to {@code newSizes}. + * + * @param newSizes the new sizes */ protected void setSizes(int[] newSizes) { System.arraycopy(newSizes, 0, sizes, 0, 3); @@ -1613,6 +1670,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the sizes of the components. + * + * @return the sizes of the components */ protected int[] getSizes() { int[] retSizes = new int[3]; @@ -1624,6 +1683,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the width of the passed in Components preferred size. + * + * @param c a component + * @return the preferred width of the component */ protected int getPreferredSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getPreferredSize()); @@ -1632,6 +1694,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the width of the passed in Components minimum size. + * + * @param c a component + * @return the minimum width of the component */ int getMinimumSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getMinimumSize()); @@ -1640,6 +1705,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the width of the passed in component. + * + * @param c a component + * @return the width of the component */ protected int getSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getSize()); @@ -1648,7 +1716,11 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the available width based on the container size and - * Insets. + * {@code Insets}. + * + * @param containerSize a container size + * @param insets an insets + * @return the available width */ protected int getAvailableSize(Dimension containerSize, Insets insets) { @@ -1661,8 +1733,11 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the left inset, unless the Insets are null in which case + * Returns the left inset, unless the {@code Insets} are null in which case * 0 is returned. + * + * @param insets the insets + * @return the left inset */ protected int getInitialLocation(Insets insets) { if(insets != null) @@ -1672,9 +1747,15 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Sets the width of the component c to be size, placing its - * x location at location, y to the insets.top and height - * to the containersize.height less the top and bottom insets. + * Sets the width of the component {@code c} to be {@code size}, placing its + * x location at {@code location}, y to the {@code insets.top} and height + * to the {@code containerSize.height} less the top and bottom insets. + * + * @param c a component + * @param size a new width + * @param location a new X coordinate + * @param insets an insets + * @param containerSize a container size */ protected void setComponentToSize(Component c, int size, int location, Insets insets, @@ -2021,6 +2102,9 @@ public class BasicSplitPaneUI extends SplitPaneUI public class BasicVerticalLayoutManager extends BasicHorizontalLayoutManager { + /** + * Constructs a new instance of {@code BasicVerticalLayoutManager}. + */ public BasicVerticalLayoutManager() { super(1); } From cb14edb87e27fd501b7e32bb752d0be055a1921f Mon Sep 17 00:00:00 2001 From: Mikhail Cherkasov Date: Thu, 10 Jul 2014 18:46:40 +0400 Subject: [PATCH 11/94] 4991647: PNGMetadata.getAsTree() sets bitDepth to invalid value Reviewed-by: prr, bae --- .../sun/imageio/plugins/png/PNGMetadata.java | 7 +- .../imageio/plugins/png/PngDitDepthTest.java | 74 +++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java index 11018ec4015..110bd9e2def 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java @@ -1254,8 +1254,11 @@ public class PNGMetadata extends IIOMetadata implements Cloneable { if (name.equals("IHDR")) { IHDR_width = getIntAttribute(node, "width"); IHDR_height = getIntAttribute(node, "height"); - IHDR_bitDepth = getEnumeratedAttribute(node, "bitDepth", - IHDR_bitDepths); + IHDR_bitDepth = + Integer.valueOf(IHDR_bitDepths[ + getEnumeratedAttribute(node, + "bitDepth", + IHDR_bitDepths)]); IHDR_colorType = getEnumeratedAttribute(node, "colorType", IHDR_colorTypeNames); IHDR_compressionMethod = diff --git a/jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java b/jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java new file mode 100644 index 00000000000..7317f87c503 --- /dev/null +++ b/jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* +* @test +* @bug 4991647 +* @summary PNGMetadata.getAsTree() sets bitDepth to invalid value +* @run main PngDitDepthTest +*/ + +import org.w3c.dom.Node; + +import javax.imageio.ImageIO; +import javax.imageio.ImageTypeSpecifier; +import javax.imageio.ImageWriter; +import javax.imageio.metadata.IIOInvalidTreeException; +import javax.imageio.metadata.IIOMetadata; +import java.awt.image.ColorModel; +import java.awt.image.SampleModel; +import java.util.Iterator; + +public class PngDitDepthTest { + + public static void main(String[] args) throws IIOInvalidTreeException { + + // getting the writer for the png format + Iterator iter = ImageIO.getImageWritersByFormatName("png"); + ImageWriter writer = (ImageWriter) iter.next(); + + // creating a color model + ColorModel colorModel = ColorModel.getRGBdefault(); + + // creating a sample model + SampleModel sampleModel = colorModel.createCompatibleSampleModel(640, 480); + + // creating a default metadata object + IIOMetadata metaData = writer.getDefaultImageMetadata(new ImageTypeSpecifier(colorModel, sampleModel), null); + String formatName = metaData.getNativeMetadataFormatName(); + + // first call + Node metaDataNode = metaData.getAsTree(formatName); + try { + metaData.setFromTree(formatName, metaDataNode); + } catch (Exception ex) { + ex.printStackTrace(); + } + + // second call (bitdepht is already set to an invalid value) + metaDataNode = metaData.getAsTree(formatName); + + metaData.setFromTree(formatName, metaDataNode); + + } +} From be41c05edc0bfafc89fb36956cc5fa434e44fc14 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 10 Jul 2014 15:27:02 -0700 Subject: [PATCH 12/94] 8049797: Fix raw and unchecked lint warnings in javax.swing.SortingFocusTraversalPolicy Reviewed-by: prr --- .../classes/javax/swing/SortingFocusTraversalPolicy.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java index 797f6f35524..7199531c61b 100644 --- a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java +++ b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java @@ -109,11 +109,12 @@ public class SortingFocusTraversalPolicy AccessController.doPrivileged(new PrivilegedAction() { public Method run() { try { - Class c = Class.forName("java.util.Arrays"); - Method m = c.getDeclaredMethod("legacyMergeSort", new Class[]{Object[].class, Comparator.class}); + Method m = java.util.Arrays.class.getDeclaredMethod("legacyMergeSort", + new Class[]{Object[].class, + Comparator.class}); m.setAccessible(true); return m; - } catch (ClassNotFoundException | NoSuchMethodException e) { + } catch (NoSuchMethodException e) { // using default sorting algo return null; } From f5a99dfd8f8355c507d0c95dc3d0b35ef9b08236 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Mon, 23 Jun 2014 10:54:10 -0700 Subject: [PATCH 13/94] 8042872: Fix raw and unchecked warnings in sun.applet Reviewed-by: darcy, herrick --- .../classes/sun/applet/AppletClassLoader.java | 39 +++++----- .../classes/sun/applet/AppletImageRef.java | 6 +- .../sun/applet/AppletObjectInputStream.java | 6 +- .../share/classes/sun/applet/AppletPanel.java | 50 ++++++------ .../share/classes/sun/applet/AppletProps.java | 8 +- .../classes/sun/applet/AppletSecurity.java | 63 +++++++-------- .../classes/sun/applet/AppletViewer.java | 76 ++++++++++--------- .../sun/applet/AppletViewerFactory.java | 3 +- .../classes/sun/applet/AppletViewerPanel.java | 6 +- jdk/src/share/classes/sun/applet/Main.java | 10 +-- 10 files changed, 138 insertions(+), 129 deletions(-) diff --git a/jdk/src/share/classes/sun/applet/AppletClassLoader.java b/jdk/src/share/classes/sun/applet/AppletClassLoader.java index fe3459771b2..83684cb36f2 100644 --- a/jdk/src/share/classes/sun/applet/AppletClassLoader.java +++ b/jdk/src/share/classes/sun/applet/AppletClassLoader.java @@ -137,7 +137,7 @@ public class AppletClassLoader extends URLClassLoader { * Override loadClass so that class loading errors can be caught in * order to print better error messages. */ - public synchronized Class loadClass(String name, boolean resolve) + public synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // First check if we have permission to access the package. This @@ -166,7 +166,7 @@ public class AppletClassLoader extends URLClassLoader { * Finds the applet class with the specified name. First searches * loaded JAR files then the applet code base for the class. */ - protected Class findClass(String name) throws ClassNotFoundException { + protected Class findClass(String name) throws ClassNotFoundException { int index = name.indexOf(';'); String cookie = ""; @@ -192,9 +192,9 @@ public class AppletClassLoader extends URLClassLoader { String encodedName = ParseUtil.encodePath(name.replace('.', '/'), false); final String path = (new StringBuffer(encodedName)).append(".class").append(cookie).toString(); try { - byte[] b = (byte[]) AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() throws IOException { + byte[] b = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public byte[] run() throws IOException { try { URL finalURL = new URL(base, path); @@ -556,9 +556,10 @@ public class AppletClassLoader extends URLClassLoader { * name. First checks loaded JAR files then the applet code base for all * available resources. */ - public Enumeration findResources(String name) throws IOException { + @Override + public Enumeration findResources(String name) throws IOException { - final Enumeration e = super.findResources(name); + final Enumeration e = super.findResources(name); // 6215746: Disable META-INF/* lookup from codebase in // applet/plugin classloader. [stanley.ho] @@ -576,9 +577,9 @@ public class AppletClassLoader extends URLClassLoader { } final URL url = u; - return new Enumeration() { + return new Enumeration() { private boolean done; - public Object nextElement() { + public URL nextElement() { if (!done) { if (e.hasMoreElements()) { return e.nextElement(); @@ -601,7 +602,7 @@ public class AppletClassLoader extends URLClassLoader { * attribute. The argument can either be the relative path * of the class file itself or just the name of the class. */ - Class loadCode(String name) throws ClassNotFoundException { + Class loadCode(String name) throws ClassNotFoundException { // first convert any '/' or native file separator to . name = name.replace('/', '.'); name = name.replace(File.separatorChar, '.'); @@ -646,7 +647,7 @@ public class AppletClassLoader extends URLClassLoader { public ThreadGroup getThreadGroup() { synchronized (threadGroupSynchronizer) { if (threadGroup == null || threadGroup.isDestroyed()) { - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { public Object run() { threadGroup = new AppletThreadGroup(base + "-threadGroup"); // threadGroup.setDaemon(true); @@ -770,8 +771,8 @@ public void grab() { // Hash map to store applet compatibility info - private HashMap jdk11AppletInfo = new HashMap(); - private HashMap jdk12AppletInfo = new HashMap(); + private HashMap jdk11AppletInfo = new HashMap<>(); + private HashMap jdk12AppletInfo = new HashMap<>(); /** * Set applet target level as JDK 1.1. @@ -780,7 +781,7 @@ public void grab() { * @param bool true if JDK is targeted for JDK 1.1; * false otherwise. */ - void setJDK11Target(Class clazz, boolean bool) + void setJDK11Target(Class clazz, boolean bool) { jdk11AppletInfo.put(clazz.toString(), Boolean.valueOf(bool)); } @@ -792,7 +793,7 @@ public void grab() { * @param bool true if JDK is targeted for JDK 1.2; * false otherwise. */ - void setJDK12Target(Class clazz, boolean bool) + void setJDK12Target(Class clazz, boolean bool) { jdk12AppletInfo.put(clazz.toString(), Boolean.valueOf(bool)); } @@ -805,9 +806,9 @@ public void grab() { * FALSE if applet is not; * null if applet is unknown. */ - Boolean isJDK11Target(Class clazz) + Boolean isJDK11Target(Class clazz) { - return (Boolean) jdk11AppletInfo.get(clazz.toString()); + return jdk11AppletInfo.get(clazz.toString()); } /** @@ -818,9 +819,9 @@ public void grab() { * FALSE if applet is not; * null if applet is unknown. */ - Boolean isJDK12Target(Class clazz) + Boolean isJDK12Target(Class clazz) { - return (Boolean) jdk12AppletInfo.get(clazz.toString()); + return jdk12AppletInfo.get(clazz.toString()); } private static AppletMessageHandler mh = diff --git a/jdk/src/share/classes/sun/applet/AppletImageRef.java b/jdk/src/share/classes/sun/applet/AppletImageRef.java index f264e890351..e3eb5a26fb1 100644 --- a/jdk/src/share/classes/sun/applet/AppletImageRef.java +++ b/jdk/src/share/classes/sun/applet/AppletImageRef.java @@ -65,7 +65,7 @@ class AppletImageRef { * invoke reconstitute(). */ public synchronized void flush() { - SoftReference s = soft; + SoftReference s = soft; if (s != null) s.clear(); soft = null; } @@ -74,9 +74,9 @@ class AppletImageRef { * Sets the thing to the specified object. * @param thing the specified object */ - public synchronized void setThing(Object thing) { + public synchronized void setThing(Image thing) { flush(); - soft = new SoftReference(thing); + soft = new SoftReference<>(thing); } /** diff --git a/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java b/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java index 36bd8156e5b..0906136bfec 100644 --- a/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java +++ b/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java @@ -59,7 +59,7 @@ class AppletObjectInputStream extends ObjectInputStream * Make a primitive array class */ - private Class primitiveType(char type) { + private Class primitiveType(char type) { switch (type) { case 'B': return byte.class; case 'C': return char.class; @@ -76,13 +76,13 @@ class AppletObjectInputStream extends ObjectInputStream /** * Use the given ClassLoader rather than using the system class */ - protected Class resolveClass(ObjectStreamClass classDesc) + protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { String cname = classDesc.getName(); if (cname.startsWith("[")) { // An array - Class component; // component class + Class component; // component class int dcount; // dimension for (dcount=1; cname.charAt(dcount)=='['; dcount++) ; if (cname.charAt(dcount) == 'L') { diff --git a/jdk/src/share/classes/sun/applet/AppletPanel.java b/jdk/src/share/classes/sun/applet/AppletPanel.java index 15ba72b288c..89514ddbcd3 100644 --- a/jdk/src/share/classes/sun/applet/AppletPanel.java +++ b/jdk/src/share/classes/sun/applet/AppletPanel.java @@ -179,7 +179,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { handler = new Thread(appletGroup, this, "thread " + nm); // set the context class loader for this thread - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { handler.setContextClassLoader(loader); @@ -253,7 +253,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { /** * AppletEvent Queue */ - private Queue queue = null; + private Queue queue = null; synchronized public void addAppletListener(AppletListener l) { @@ -282,7 +282,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { synchronized(this) { if (queue == null) { //System.out.println("SEND0= " + id); - queue = new Queue(); + queue = new Queue<>(); } Integer eventId = Integer.valueOf(id); queue.enqueue(eventId); @@ -309,7 +309,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { while (queue == null || queue.isEmpty()) { wait(); } - Integer eventId = (Integer)queue.dequeue(); + Integer eventId = queue.dequeue(); return new AppletEvent(this, eventId.intValue(), null); } @@ -631,14 +631,15 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * calls KeyboardFocusManager directly. */ private Component getMostRecentFocusOwnerForWindow(Window w) { - Method meth = (Method)AccessController.doPrivileged(new PrivilegedAction() { + Method meth = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { + public Method run() { Method meth = null; try { meth = KeyboardFocusManager.class.getDeclaredMethod( "getMostRecentFocusOwner", - new Class[]{Window.class}); + new Class[]{Window.class}); meth.setAccessible(true); } catch (Exception e) { // Must never happen @@ -988,7 +989,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { /** * The class loaders */ - private static HashMap classloaders = new HashMap(); + private static HashMap classloaders = new HashMap<>(); /** * Flush a class loader. @@ -1001,7 +1002,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * Flush all class loaders. */ public static synchronized void flushClassLoaders() { - classloaders = new HashMap(); + classloaders = new HashMap<>(); } /** @@ -1018,14 +1019,14 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * Get a class loader. Create in a restricted context */ synchronized AppletClassLoader getClassLoader(final URL codebase, final String key) { - AppletClassLoader c = (AppletClassLoader)classloaders.get(key); + AppletClassLoader c = classloaders.get(key); if (c == null) { AccessControlContext acc = getAccessControlContext(codebase); - c = (AppletClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { + c = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { + public AppletClassLoader run() { AppletClassLoader ac = createClassLoader(codebase); /* Should the creation of the classloader be * within the class synchronized block? Since @@ -1043,8 +1044,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * (which timeout when called from the browser). */ synchronized (getClass()) { - AppletClassLoader res = - (AppletClassLoader)classloaders.get(key); + AppletClassLoader res = classloaders.get(key); if (res == null) { classloaders.put(key, ac); return ac; @@ -1066,10 +1066,10 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { */ private AccessControlContext getAccessControlContext(final URL codebase) { - PermissionCollection perms = (PermissionCollection) - AccessController.doPrivileged(new PrivilegedAction() { + PermissionCollection perms = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { + public PermissionCollection run() { Policy p = java.security.Policy.getPolicy(); if (p != null) { return p.getPermissions(new CodeSource(null, @@ -1172,13 +1172,15 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { // critical section of the window list in AppContext. synchronized (Window.class) { - WeakReference weakRef = null; + WeakReference weakRef = null; // Remove frame from the Window list in wrong AppContext { // Lookup current frame's AppContext - Vector> windowList = (Vector>)oldAppContext.get(Window.class); + @SuppressWarnings("unchecked") + Vector> windowList = + (Vector>)oldAppContext.get(Window.class); if (windowList != null) { - for (WeakReference ref : windowList) { + for (WeakReference ref : windowList) { if (ref.get() == frame) { weakRef = ref; break; @@ -1195,7 +1197,9 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { // Insert frame into the Window list in the applet's AppContext map { - Vector> windowList = (Vector)newAppContext.get(Window.class); + @SuppressWarnings("unchecked") + Vector> windowList = + (Vector>)newAppContext.get(Window.class); if (windowList == null) { windowList = new Vector>(); newAppContext.put(Window.class, windowList); @@ -1224,7 +1228,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { // synchronized on applet class object, so calling from // different instances of the same applet will be // serialized. - Class appletClass = applet.getClass(); + Class appletClass = applet.getClass(); synchronized(appletClass) { // Determine if the JDK level of an applet has been diff --git a/jdk/src/share/classes/sun/applet/AppletProps.java b/jdk/src/share/classes/sun/applet/AppletProps.java index 466aa83735b..161bc79a8c3 100644 --- a/jdk/src/share/classes/sun/applet/AppletProps.java +++ b/jdk/src/share/classes/sun/applet/AppletProps.java @@ -105,9 +105,9 @@ class AppletProps extends Frame { String proxyPortValue = proxyPort.getText().trim(); // Get properties - final Properties props = (Properties) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + final Properties props = AccessController.doPrivileged( + new PrivilegedAction() { + public Properties run() { return System.getProperties(); } }); @@ -148,7 +148,7 @@ class AppletProps extends Frame { // Save properties try { reset(); - AccessController.doPrivileged(new PrivilegedExceptionAction() { + AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { File dotAV = Main.theUserPropertiesFile; FileOutputStream out = new FileOutputStream(dotAV); diff --git a/jdk/src/share/classes/sun/applet/AppletSecurity.java b/jdk/src/share/classes/sun/applet/AppletSecurity.java index 9fb20e9662e..2f11d43d19f 100644 --- a/jdk/src/share/classes/sun/applet/AppletSecurity.java +++ b/jdk/src/share/classes/sun/applet/AppletSecurity.java @@ -80,7 +80,7 @@ class AppletSecurity extends AWTSecurityManager { } // Cache to store known restricted packages - private HashSet restrictedPackages = new HashSet(); + private HashSet restrictedPackages = new HashSet<>(); /** * Reset from Properties @@ -90,11 +90,11 @@ class AppletSecurity extends AWTSecurityManager { // Clear cache restrictedPackages.clear(); - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { public Object run() { // Enumerate system properties - Enumeration e = System.getProperties().propertyNames(); + Enumeration e = System.getProperties().propertyNames(); while (e.hasMoreElements()) { @@ -130,7 +130,7 @@ class AppletSecurity extends AWTSecurityManager { return (AppletClassLoader)loader; // if that fails, get all the classes on the stack and check them. - Class[] context = getClassContext(); + Class[] context = getClassContext(); for (int i = 0; i < context.length; i++) { loader = context[i].getClassLoader(); if (loader instanceof AppletClassLoader) @@ -148,37 +148,38 @@ class AppletSecurity extends AWTSecurityManager { final ClassLoader currentLoader = context[i].getClassLoader(); if (currentLoader instanceof URLClassLoader) { - loader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + loader = AccessController.doPrivileged( + new PrivilegedAction() { + public ClassLoader run() { - AccessControlContext acc = null; - ProtectionDomain[] pds = null; + AccessControlContext acc = null; + ProtectionDomain[] pds = null; - try { - acc = (AccessControlContext) facc.get(currentLoader); - if (acc == null) { - return null; + try { + acc = (AccessControlContext) facc.get(currentLoader); + if (acc == null) { + return null; + } + + pds = (ProtectionDomain[]) fcontext.get(acc); + if (pds == null) { + return null; + } + } catch (Exception e) { + throw new UnsupportedOperationException(e); } - pds = (ProtectionDomain[]) fcontext.get(acc); - if (pds == null) { - return null; + for (int i=0; i iter = restrictedPackages.iterator(); iter.hasNext();) { - String pkg = (String) iter.next(); + String pkg = iter.next(); // Prevent matching "sun" and "sunir" even if they // starts with similar beginning characters diff --git a/jdk/src/share/classes/sun/applet/AppletViewer.java b/jdk/src/share/classes/sun/applet/AppletViewer.java index 92c4fc17f77..b58579fd096 100644 --- a/jdk/src/share/classes/sun/applet/AppletViewer.java +++ b/jdk/src/share/classes/sun/applet/AppletViewer.java @@ -94,7 +94,7 @@ final class StdAppletViewerFactory implements AppletViewerFactory { @Override public AppletViewer createAppletViewer(int x, int y, - URL doc, Hashtable atts) { + URL doc, Hashtable atts) { return new AppletViewer(x, y, doc, atts, System.out, this); } @@ -156,7 +156,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * Create the applet viewer. */ - public AppletViewer(int x, int y, URL doc, Hashtable atts, + public AppletViewer(int x, int y, URL doc, Hashtable atts, PrintStream statusMsgStream, AppletViewerFactory factory) { this.factory = factory; this.statusMsgStream = statusMsgStream; @@ -350,7 +350,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * s. Whitespace not stripped. */ private String [] splitSeparator(String sep, String s) { - Vector v = new Vector(); + Vector v = new Vector<>(); int tokenStart = 0; int tokenEnd = 0; @@ -370,7 +370,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * Methods for java.applet.AppletContext */ - private static Map audioClips = new HashMap(); + private static Map audioClips = new HashMap<>(); /** * Get an audio clip. @@ -379,7 +379,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { public AudioClip getAudioClip(URL url) { checkConnect(url); synchronized (audioClips) { - AudioClip clip = (AudioClip)audioClips.get(url); + AudioClip clip = audioClips.get(url); if (clip == null) { audioClips.put(url, clip = new AppletAudioClip(url)); } @@ -387,7 +387,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { } } - private static Map imageRefs = new HashMap(); + private static Map imageRefs = new HashMap<>(); /** * Get an image. @@ -403,7 +403,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { static Image getCachedImage(URL url) { // System.getSecurityManager().checkConnection(url.getHost(), url.getPort()); synchronized (imageRefs) { - AppletImageRef ref = (AppletImageRef)imageRefs.get(url); + AppletImageRef ref = imageRefs.get(url); if (ref == null) { ref = new AppletImageRef(url); imageRefs.put(url, ref); @@ -419,7 +419,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { imageRefs.clear(); } - static Vector appletPanels = new Vector(); + static Vector appletPanels = new Vector<>(); /** * Get an applet by name. @@ -430,8 +430,8 @@ public class AppletViewer extends Frame implements AppletContext, Printable { name = name.toLowerCase(); SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect"); - for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { - AppletPanel p = (AppletPanel)e.nextElement(); + for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { + AppletPanel p = e.nextElement(); String param = p.getParameter("name"); if (param != null) { param = param.toLowerCase(); @@ -455,14 +455,14 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * applets on this page. */ @Override - public Enumeration getApplets() { + public Enumeration getApplets() { AppletSecurity security = (AppletSecurity)System.getSecurityManager(); - Vector v = new Vector(); + Vector v = new Vector<>(); SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect"); - for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { - AppletPanel p = (AppletPanel)e.nextElement(); + for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { + AppletPanel p = e.nextElement(); if (p.getDocumentBase().equals(panel.getDocumentBase())) { SocketPermission sp = @@ -509,7 +509,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { } @Override - public Iterator getStreamKeys(){ + public Iterator getStreamKeys(){ // We do nothing. return null; } @@ -517,7 +517,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * System parameters. */ - static Hashtable systemParam = new Hashtable(); + static Hashtable systemParam = new Hashtable<>(); static { systemParam.put("codebase", "codebase"); @@ -533,32 +533,32 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * Print the HTML tag. */ - public static void printTag(PrintStream out, Hashtable atts) { + public static void printTag(PrintStream out, Hashtable atts) { out.print(" e = atts.keys() ; e.hasMoreElements() ;) { + String param = e.nextElement(); int i = 0; for (; i < len ; i++) { if (params[i].compareTo(param) >= 0) { @@ -649,7 +649,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * Save the applet to a well known file (for now) as a serialized object */ void appletSave() { - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { @@ -702,8 +702,10 @@ public class AppletViewer extends Frame implements AppletContext, Printable { void appletClone() { Point p = location(); updateAtts(); + @SuppressWarnings("unchecked") + Hashtable tmp = (Hashtable) panel.atts.clone(); factory.createAppletViewer(p.x + XDELTA, p.y + YDELTA, - panel.documentURL, (Hashtable)panel.atts.clone()); + panel.documentURL, tmp); } /** @@ -884,8 +886,8 @@ public class AppletViewer extends Frame implements AppletContext, Printable { @Override public void run() { - for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { - AppletPanel p = (AppletPanel)e.nextElement(); + for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { + AppletPanel p = e.nextElement(); appletShutdown(p); } appletSystemExit(); @@ -1016,8 +1018,8 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * Scan tag */ - public static Hashtable scanTag(Reader in) throws IOException { - Hashtable atts = new Hashtable(); + public static Hashtable scanTag(Reader in) throws IOException { + Hashtable atts = new Hashtable<>(); skipSpace(in); while (c >= 0 && c != '>') { String att = scanIdentifier(in); @@ -1122,7 +1124,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { url = conn.getURL(); int ydisp = 1; - Hashtable atts = null; + Hashtable atts = null; while(true) { c = in.read(); @@ -1172,12 +1174,12 @@ public class AppletViewer extends Frame implements AppletContext, Printable { else { String nm = scanIdentifier(in); if (nm.equalsIgnoreCase("param")) { - Hashtable t = scanTag(in); - String att = (String)t.get("name"); + Hashtable t = scanTag(in); + String att = t.get("name"); if (att == null) { statusMsgStream.println(requiresNameWarning); } else { - String val = (String)t.get("value"); + String val = t.get("value"); if (val == null) { statusMsgStream.println(requiresNameWarning); } else if (atts != null) { @@ -1235,13 +1237,13 @@ public class AppletViewer extends Frame implements AppletContext, Printable { } else if (nm.equalsIgnoreCase("app")) { statusMsgStream.println(appNotLongerSupportedWarning); - Hashtable atts2 = scanTag(in); - nm = (String)atts2.get("class"); + Hashtable atts2 = scanTag(in); + nm = atts2.get("class"); if (nm != null) { atts2.remove("class"); atts2.put("code", nm + ".class"); } - nm = (String)atts2.get("src"); + nm = atts2.get("src"); if (nm != null) { atts2.remove("src"); atts2.put("codebase", nm); diff --git a/jdk/src/share/classes/sun/applet/AppletViewerFactory.java b/jdk/src/share/classes/sun/applet/AppletViewerFactory.java index 6fcfaa2ee44..16b6db4679d 100644 --- a/jdk/src/share/classes/sun/applet/AppletViewerFactory.java +++ b/jdk/src/share/classes/sun/applet/AppletViewerFactory.java @@ -35,7 +35,8 @@ import java.awt.MenuBar; public interface AppletViewerFactory { - public AppletViewer createAppletViewer(int x, int y, URL doc, Hashtable atts); + public AppletViewer createAppletViewer(int x, int y, URL doc, + Hashtable atts); public MenuBar getBaseMenuBar(); public boolean isStandalone(); } diff --git a/jdk/src/share/classes/sun/applet/AppletViewerPanel.java b/jdk/src/share/classes/sun/applet/AppletViewerPanel.java index 93f064bb36d..1a8354c0035 100644 --- a/jdk/src/share/classes/sun/applet/AppletViewerPanel.java +++ b/jdk/src/share/classes/sun/applet/AppletViewerPanel.java @@ -59,7 +59,7 @@ class AppletViewerPanel extends AppletPanel { /** * The attributes of the applet. */ - Hashtable atts; + Hashtable atts; /* * JDK 1.1 serialVersionUID @@ -69,7 +69,7 @@ class AppletViewerPanel extends AppletPanel { /** * Construct an applet viewer and start the applet. */ - AppletViewerPanel(URL documentURL, Hashtable atts) { + AppletViewerPanel(URL documentURL, Hashtable atts) { this.documentURL = documentURL; this.atts = atts; @@ -105,7 +105,7 @@ class AppletViewerPanel extends AppletPanel { * Get an applet parameter. */ public String getParameter(String name) { - return (String)atts.get(name.toLowerCase()); + return atts.get(name.toLowerCase()); } /** diff --git a/jdk/src/share/classes/sun/applet/Main.java b/jdk/src/share/classes/sun/applet/Main.java index a95a36f2688..d29ed5ffd23 100644 --- a/jdk/src/share/classes/sun/applet/Main.java +++ b/jdk/src/share/classes/sun/applet/Main.java @@ -84,7 +84,7 @@ public class Main { /** * The list of valid URLs passed in to AppletViewer. */ - private static Vector urlList = new Vector(1); + private static Vector urlList = new Vector<>(1); // This is used in init(). Getting rid of this is desirable but depends // on whether the property that uses it is necessary/standard. @@ -153,7 +153,7 @@ public class Main { // XXX 5/17 this parsing method should be changed/fixed so that // it doesn't do both parsing of the html file and launching of // the AppletPanel - AppletViewer.parse((URL) urlList.elementAt(i), encoding); + AppletViewer.parse(urlList.elementAt(i), encoding); } catch (IOException e) { System.err.println(lookup("main.err.io", e.getMessage())); return 1; @@ -307,10 +307,10 @@ public class Main { // 2) Reflection removes any build dependency between appletviewer // and jdb. try { - Class c = Class.forName("com.sun.tools.example.debug.tty.TTY", true, + Class c = Class.forName("com.sun.tools.example.debug.tty.TTY", true, ClassLoader.getSystemClassLoader()); Method m = c.getDeclaredMethod("main", - new Class[] { String[].class }); + new Class[] { String[].class }); m.invoke(null, new Object[] { newArgs }); } catch (ClassNotFoundException cnfe) { System.err.println(lookup("main.debug.cantfinddebug")); @@ -367,7 +367,7 @@ public class Main { // Read in the System properties. If something is going to be // over-written, warn about it. Properties sysProps = System.getProperties(); - for (Enumeration e = sysProps.propertyNames(); e.hasMoreElements(); ) { + for (Enumeration e = sysProps.propertyNames(); e.hasMoreElements(); ) { String key = (String) e.nextElement(); String val = sysProps.getProperty(key); String oldVal; From 25f33c005dddc7c2eff5a9e0b1fc14f4b2b338a4 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Fri, 4 Jul 2014 11:46:01 +0200 Subject: [PATCH 14/94] 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories Introduce and clean up umbrella headers for the files in the cpu subdirectories. Reviewed-by: lfoltan, coleenp, dholmes --- hotspot/src/cpu/ppc/vm/frame_ppc.cpp | 1 - hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp | 3 +- hotspot/src/cpu/ppc/vm/interpreterRT_ppc.hpp | 5 +- hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp | 1 + hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp | 1 + hotspot/src/cpu/ppc/vm/ppc.ad | 4 +- hotspot/src/cpu/ppc/vm/register_ppc.hpp | 15 +++--- hotspot/src/cpu/ppc/vm/runtime_ppc.cpp | 6 +-- hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp | 5 +- hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp | 8 +-- .../cpu/ppc/vm/templateInterpreter_ppc.cpp | 1 + .../src/cpu/ppc/vm/templateTable_ppc_64.cpp | 1 + hotspot/src/cpu/ppc/vm/vmreg_ppc.hpp | 26 ++++++++-- hotspot/src/cpu/ppc/vm/vmreg_ppc.inline.hpp | 23 --------- .../src/cpu/sparc/vm/c1_Runtime1_sparc.cpp | 3 +- hotspot/src/cpu/sparc/vm/frame_sparc.cpp | 1 + .../src/cpu/sparc/vm/frame_sparc.inline.hpp | 3 +- .../src/cpu/sparc/vm/interpreterRT_sparc.cpp | 1 + .../src/cpu/sparc/vm/interpreter_sparc.cpp | 3 +- .../src/cpu/sparc/vm/macroAssembler_sparc.cpp | 2 +- .../src/cpu/sparc/vm/methodHandles_sparc.cpp | 3 +- hotspot/src/cpu/sparc/vm/register_sparc.hpp | 7 ++- .../sparc/vm/templateInterpreter_sparc.cpp | 3 +- .../src/cpu/sparc/vm/templateTable_sparc.cpp | 3 +- hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp | 33 ++++++++++-- .../src/cpu/sparc/vm/vmreg_sparc.inline.hpp | 30 ----------- hotspot/src/cpu/x86/vm/frame_x86.inline.hpp | 3 +- hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp | 3 +- hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp | 1 + hotspot/src/cpu/x86/vm/register_x86.hpp | 10 ++-- .../cpu/x86/vm/templateInterpreter_x86_32.cpp | 3 +- .../cpu/x86/vm/templateInterpreter_x86_64.cpp | 3 +- .../src/cpu/x86/vm/templateTable_x86_32.cpp | 3 +- .../src/cpu/x86/vm/templateTable_x86_64.cpp | 3 +- hotspot/src/cpu/x86/vm/vmreg_x86.hpp | 48 +++++++++++++++--- hotspot/src/cpu/x86/vm/vmreg_x86.inline.hpp | 44 ---------------- hotspot/src/cpu/x86/vm/x86.ad | 4 +- hotspot/src/os/aix/vm/os_aix.cpp | 1 + hotspot/src/os/solaris/vm/os_solaris.cpp | 1 + hotspot/src/os/windows/vm/os_windows.cpp | 1 + .../aix_ppc/vm/atomic_aix_ppc.inline.hpp | 5 +- .../aix_ppc/vm/orderAccess_aix_ppc.inline.hpp | 5 +- .../bsd_x86/vm/atomic_bsd_x86.inline.hpp | 3 +- .../bsd_x86/vm/orderAccess_bsd_x86.inline.hpp | 3 +- .../bsd_zero/vm/atomic_bsd_zero.inline.hpp | 3 +- .../vm/orderAccess_bsd_zero.inline.hpp | 3 +- .../linux_ppc/vm/atomic_linux_ppc.inline.hpp | 5 +- .../vm/orderAccess_linux_ppc.inline.hpp | 5 +- .../vm/atomic_linux_sparc.inline.hpp | 3 +- .../vm/orderAccess_linux_sparc.inline.hpp | 3 +- .../linux_x86/vm/atomic_linux_x86.inline.hpp | 3 +- .../vm/orderAccess_linux_x86.inline.hpp | 3 +- .../vm/atomic_linux_zero.inline.hpp | 3 +- .../vm/orderAccess_linux_zero.inline.hpp | 3 +- .../vm/atomic_solaris_sparc.inline.hpp | 3 +- .../vm/orderAccess_solaris_sparc.inline.hpp | 3 +- .../solaris_sparc/vm/os_solaris_sparc.cpp | 1 + .../vm/atomic_solaris_x86.inline.hpp | 3 +- .../vm/orderAccess_solaris_x86.inline.hpp | 3 +- .../vm/atomic_windows_x86.inline.hpp | 3 +- .../vm/orderAccess_windows_x86.inline.hpp | 3 +- hotspot/src/share/vm/adlc/main.cpp | 22 ++------ hotspot/src/share/vm/asm/assembler.hpp | 25 ++-------- hotspot/src/share/vm/asm/codeBuffer.cpp | 1 + hotspot/src/share/vm/c1/c1_CodeStubs.hpp | 3 +- hotspot/src/share/vm/c1/c1_Defs.hpp | 18 +------ hotspot/src/share/vm/c1/c1_FrameMap.cpp | 20 +------- hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 3 +- hotspot/src/share/vm/c1/c1_LIRAssembler.cpp | 23 +-------- hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 3 +- hotspot/src/share/vm/c1/c1_LinearScan.cpp | 19 +------ hotspot/src/share/vm/c1/c1_Runtime1.cpp | 1 + .../share/vm/classfile/bytecodeAssembler.cpp | 19 +------ .../share/vm/classfile/classFileStream.hpp | 16 +----- .../src/share/vm/classfile/stackMapTable.hpp | 18 +------ hotspot/src/share/vm/classfile/verifier.cpp | 16 +----- hotspot/src/share/vm/code/codeBlob.cpp | 15 ------ hotspot/src/share/vm/code/compiledIC.hpp | 18 +------ hotspot/src/share/vm/code/nativeInst.hpp | 44 ++++++++++++++++ hotspot/src/share/vm/code/vmreg.hpp | 27 ++-------- hotspot/src/share/vm/code/vmreg.inline.hpp | 46 +++++++++++++++++ hotspot/src/share/vm/compiler/compileLog.cpp | 1 + hotspot/src/share/vm/compiler/oopMap.cpp | 3 ++ .../vm/interpreter/abstractInterpreter.hpp | 23 ++------- hotspot/src/share/vm/interpreter/bytecode.hpp | 18 +------ .../vm/interpreter/bytecodeInterpreter.hpp | 19 ++----- .../share/vm/interpreter/bytecodeStream.hpp | 18 +------ .../src/share/vm/interpreter/bytecodes.cpp | 18 +------ .../src/share/vm/interpreter/interp_masm.hpp | 49 ++++++++++++++++++ .../src/share/vm/interpreter/interpreter.cpp | 29 ++++++++++- .../src/share/vm/interpreter/interpreter.hpp | 46 +++++------------ .../vm/interpreter/interpreterRuntime.cpp | 16 +----- .../vm/interpreter/templateInterpreter.cpp | 2 + .../vm/interpreter/templateInterpreter.hpp | 4 +- .../share/vm/interpreter/templateTable.cpp | 3 +- .../share/vm/interpreter/templateTable.hpp | 21 +------- hotspot/src/share/vm/memory/filemap.cpp | 1 + .../vm/memory/threadLocalAllocBuffer.hpp | 3 +- hotspot/src/share/vm/oops/constantPool.hpp | 16 +----- hotspot/src/share/vm/oops/oop.inline.hpp | 15 ------ hotspot/src/share/vm/opto/ad.hpp | 50 +++++++++++++++++++ hotspot/src/share/vm/opto/buildOopMap.cpp | 18 +------ hotspot/src/share/vm/opto/c2compiler.cpp | 24 +-------- hotspot/src/share/vm/opto/compile.cpp | 21 -------- hotspot/src/share/vm/opto/gcm.cpp | 22 -------- hotspot/src/share/vm/opto/lcm.cpp | 24 +-------- hotspot/src/share/vm/opto/library_call.cpp | 1 + hotspot/src/share/vm/opto/locknode.hpp | 26 ++-------- hotspot/src/share/vm/opto/matcher.cpp | 22 +------- hotspot/src/share/vm/opto/optoreg.hpp | 26 +++++++++- hotspot/src/share/vm/opto/output.cpp | 4 +- hotspot/src/share/vm/opto/output.hpp | 24 +-------- hotspot/src/share/vm/opto/regmask.cpp | 22 +------- hotspot/src/share/vm/opto/regmask.hpp | 23 +-------- hotspot/src/share/vm/opto/runtime.cpp | 23 +-------- hotspot/src/share/vm/opto/runtime.hpp | 1 + .../src/share/vm/precompiled/precompiled.hpp | 4 ++ hotspot/src/share/vm/prims/jniCheck.cpp | 15 ------ hotspot/src/share/vm/prims/jvm.cpp | 1 + .../vm/prims/jvmtiClassFileReconstituter.cpp | 19 ++----- hotspot/src/share/vm/prims/jvmtiTagMap.cpp | 3 +- hotspot/src/share/vm/prims/unsafe.cpp | 1 + hotspot/src/share/vm/prims/whitebox.cpp | 3 ++ .../vm/runtime/advancedThresholdPolicy.cpp | 3 +- hotspot/src/share/vm/runtime/arguments.cpp | 1 + .../src/share/vm/runtime/deoptimization.cpp | 39 +-------------- hotspot/src/share/vm/runtime/dtraceJSDT.cpp | 1 + hotspot/src/share/vm/runtime/dtraceJSDT.hpp | 17 +------ hotspot/src/share/vm/runtime/fprofiler.cpp | 1 + hotspot/src/share/vm/runtime/frame.cpp | 17 +------ hotspot/src/share/vm/runtime/frame.hpp | 25 +--------- hotspot/src/share/vm/runtime/frame.inline.hpp | 17 +------ hotspot/src/share/vm/runtime/java.cpp | 15 ------ hotspot/src/share/vm/runtime/os.cpp | 2 + hotspot/src/share/vm/runtime/registerMap.hpp | 17 +------ hotspot/src/share/vm/runtime/relocator.hpp | 18 +------ hotspot/src/share/vm/runtime/rframe.cpp | 1 + hotspot/src/share/vm/runtime/safepoint.cpp | 20 -------- .../src/share/vm/runtime/sharedRuntime.cpp | 21 +------- .../share/vm/runtime/stackValueCollection.cpp | 15 ------ hotspot/src/share/vm/runtime/statSampler.cpp | 18 +------ hotspot/src/share/vm/runtime/stubRoutines.hpp | 15 ------ hotspot/src/share/vm/runtime/thread.cpp | 2 + hotspot/src/share/vm/runtime/vframeArray.cpp | 1 + hotspot/src/share/vm/runtime/vmStructs.cpp | 22 +------- .../src/share/vm/runtime/vm_operations.cpp | 1 + hotspot/src/share/vm/runtime/vm_version.cpp | 16 +----- hotspot/src/share/vm/runtime/vm_version.hpp | 18 ++++++- .../share/vm/services/diagnosticCommand.hpp | 11 ++-- .../share/vm/services/diagnosticFramework.hpp | 3 +- hotspot/src/share/vm/utilities/bytes.hpp | 44 ++++++++++++++++ hotspot/src/share/vm/utilities/debug.cpp | 1 + hotspot/src/share/vm/utilities/ostream.cpp | 1 + hotspot/src/share/vm/utilities/vmError.cpp | 1 + 154 files changed, 637 insertions(+), 1175 deletions(-) create mode 100644 hotspot/src/share/vm/code/nativeInst.hpp create mode 100644 hotspot/src/share/vm/code/vmreg.inline.hpp create mode 100644 hotspot/src/share/vm/interpreter/interp_masm.hpp create mode 100644 hotspot/src/share/vm/opto/ad.hpp create mode 100644 hotspot/src/share/vm/utilities/bytes.hpp diff --git a/hotspot/src/cpu/ppc/vm/frame_ppc.cpp b/hotspot/src/cpu/ppc/vm/frame_ppc.cpp index ff177e6231a..6898907b6d4 100644 --- a/hotspot/src/cpu/ppc/vm/frame_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/frame_ppc.cpp @@ -36,7 +36,6 @@ #include "runtime/signature.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" -#include "vmreg_ppc.inline.hpp" #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" #include "runtime/vframeArray.hpp" diff --git a/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp b/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp index 6186906a860..11bbf69fd2e 100644 --- a/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp +++ b/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,6 +27,7 @@ #define CPU_PPC_VM_FRAME_PPC_INLINE_HPP #include "code/codeCache.hpp" +#include "code/vmreg.inline.hpp" // Inline functions for ppc64 frames: diff --git a/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.hpp b/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.hpp index 144ef50bfa8..da98715a102 100644 --- a/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright 2012, 2014 SAP AG. 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 @@ -26,6 +26,7 @@ #ifndef CPU_PPC_VM_INTERPRETERRT_PPC_HPP #define CPU_PPC_VM_INTERPRETERRT_PPC_HPP +#include "asm/macroAssembler.hpp" #include "memory/allocation.hpp" // native method calls diff --git a/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp b/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp index a35b1ebb7a1..96814188f03 100644 --- a/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp @@ -30,6 +30,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp index ce10145ed90..4366af19626 100644 --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -32,6 +32,7 @@ #include "memory/resourceArea.hpp" #include "prims/methodHandles.hpp" #include "runtime/biasedLocking.hpp" +#include "runtime/icache.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/objectMonitor.hpp" #include "runtime/os.hpp" diff --git a/hotspot/src/cpu/ppc/vm/ppc.ad b/hotspot/src/cpu/ppc/vm/ppc.ad index 9087959fe1e..18870359ad9 100644 --- a/hotspot/src/cpu/ppc/vm/ppc.ad +++ b/hotspot/src/cpu/ppc/vm/ppc.ad @@ -267,7 +267,7 @@ register %{ // It's worth about 1% on SPEC geomean to get this right. // Chunk0, chunk1, and chunk2 form the MachRegisterNumbers enumeration -// in adGlobals_ppc64.hpp which defines the _num values, e.g. +// in adGlobals_ppc.hpp which defines the _num values, e.g. // R3_num. Therefore, R3_num may not be (and in reality is not) // the same as R3->encoding()! Furthermore, we cannot make any // assumptions on ordering, e.g. R3_num may be less than R2_num. @@ -1632,7 +1632,7 @@ enum RC { rc_bad, rc_int, rc_float, rc_stack }; static enum RC rc_class(OptoReg::Name reg) { // Return the register class for the given register. The given register // reg is a _num value, which is an index into the MachRegisterNumbers - // enumeration in adGlobals_ppc64.hpp. + // enumeration in adGlobals_ppc.hpp. if (reg == OptoReg::Bad) return rc_bad; diff --git a/hotspot/src/cpu/ppc/vm/register_ppc.hpp b/hotspot/src/cpu/ppc/vm/register_ppc.hpp index 107c5bab8b8..9dc765ab4a2 100644 --- a/hotspot/src/cpu/ppc/vm/register_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/register_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,7 +27,6 @@ #define CPU_PPC_VM_REGISTER_PPC_HPP #include "asm/register.hpp" -#include "vm_version_ppc.hpp" // forward declaration class Address; @@ -92,8 +91,8 @@ class RegisterImpl: public AbstractRegisterImpl { inline friend Register as_Register(int encoding); // accessors - int encoding() const { assert(is_valid(), "invalid register"); return value(); } - VMReg as_VMReg(); + int encoding() const { assert(is_valid(), "invalid register"); return value(); } + inline VMReg as_VMReg(); Register successor() const { return as_Register(encoding() + 1); } // testers @@ -208,8 +207,8 @@ class ConditionRegisterImpl: public AbstractRegisterImpl { inline friend ConditionRegister as_ConditionRegister(int encoding); // accessors - int encoding() const { assert(is_valid(), "invalid register"); return value(); } - VMReg as_VMReg(); + int encoding() const { assert(is_valid(), "invalid register"); return value(); } + inline VMReg as_VMReg(); // testers bool is_valid() const { return (0 <= value() && value() < number_of_registers); } @@ -264,7 +263,7 @@ class FloatRegisterImpl: public AbstractRegisterImpl { // accessors int encoding() const { assert(is_valid(), "invalid register"); return value(); } - VMReg as_VMReg(); + inline VMReg as_VMReg(); FloatRegister successor() const { return as_FloatRegister(encoding() + 1); } // testers @@ -365,7 +364,7 @@ class SpecialRegisterImpl: public AbstractRegisterImpl { // accessors int encoding() const { assert(is_valid(), "invalid register"); return value(); } - VMReg as_VMReg(); + inline VMReg as_VMReg(); // testers bool is_valid() const { return 0 <= value() && value() < number_of_registers; } diff --git a/hotspot/src/cpu/ppc/vm/runtime_ppc.cpp b/hotspot/src/cpu/ppc/vm/runtime_ppc.cpp index 0e5898381c2..404df938777 100644 --- a/hotspot/src/cpu/ppc/vm/runtime_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/runtime_ppc.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright 2012, 2014 SAP AG. 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 @@ #include "classfile/systemDictionary.hpp" #include "code/vmreg.hpp" #include "interpreter/interpreter.hpp" +#include "interpreter/interp_masm.hpp" #include "nativeInst_ppc.hpp" #include "opto/runtime.hpp" #include "runtime/interfaceSupport.hpp" @@ -37,7 +38,6 @@ #include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "utilities/globalDefinitions.hpp" -#include "vmreg_ppc.inline.hpp" #endif #define __ masm-> diff --git a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp index 15a5812e881..68dda7d3e2b 100644 --- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,16 +29,17 @@ #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" +#include "interpreter/interp_masm.hpp" #include "oops/compiledICHolder.hpp" #include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_ppc.inline.hpp" -#include "adfiles/ad_ppc_64.hpp" #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" #endif #ifdef COMPILER2 +#include "adfiles/ad_ppc_64.hpp" #include "opto/runtime.hpp" #endif diff --git a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp index d452b27038c..6918228fe60 100644 --- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -401,11 +401,11 @@ class StubGenerator: public StubCodeGenerator { __ load_const(exception_file, (void*)__FILE__); __ load_const(exception_line, (void*)__LINE__); - __ std(R3_ARG1, thread_(pending_exception)); + __ std(R3_ARG1, in_bytes(JavaThread::pending_exception_offset()), R16_thread); // store into `char *' - __ std(exception_file, thread_(exception_file)); + __ std(exception_file, in_bytes(JavaThread::exception_file_offset()), R16_thread); // store into `int' - __ stw(exception_line, thread_(exception_line)); + __ stw(exception_line, in_bytes(JavaThread::exception_line_offset()), R16_thread); // complete return to VM assert(StubRoutines::_call_stub_return_address != NULL, "must have been generated before"); diff --git a/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp b/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp index 8a9fae04770..b787fecc7d5 100644 --- a/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp @@ -30,6 +30,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp index 367e8fef7d7..0b375da582e 100644 --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -27,6 +27,7 @@ #include "asm/macroAssembler.inline.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateInterpreter.hpp" #include "interpreter/templateTable.hpp" #include "memory/universe.inline.hpp" diff --git a/hotspot/src/cpu/ppc/vm/vmreg_ppc.hpp b/hotspot/src/cpu/ppc/vm/vmreg_ppc.hpp index 92c4d088de8..4fe7bdb62e1 100644 --- a/hotspot/src/cpu/ppc/vm/vmreg_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/vmreg_ppc.hpp @@ -26,10 +26,28 @@ #ifndef CPU_PPC_VM_VMREG_PPC_HPP #define CPU_PPC_VM_VMREG_PPC_HPP - bool is_Register(); - Register as_Register(); +inline bool is_Register() { + return (unsigned int)value() < (unsigned int)ConcreteRegisterImpl::max_gpr; +} - bool is_FloatRegister(); - FloatRegister as_FloatRegister(); +inline bool is_FloatRegister() { + return value() >= ConcreteRegisterImpl::max_gpr && + value() < ConcreteRegisterImpl::max_fpr; +} + +inline Register as_Register() { + assert(is_Register() && is_even(value()), "even-aligned GPR name"); + return ::as_Register(value()>>1); +} + +inline FloatRegister as_FloatRegister() { + assert(is_FloatRegister() && is_even(value()), "must be"); + return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); +} + +inline bool is_concrete() { + assert(is_reg(), "must be"); + return is_even(value()); +} #endif // CPU_PPC_VM_VMREG_PPC_HPP diff --git a/hotspot/src/cpu/ppc/vm/vmreg_ppc.inline.hpp b/hotspot/src/cpu/ppc/vm/vmreg_ppc.inline.hpp index d097c5bc5cb..16e5e5d8fd7 100644 --- a/hotspot/src/cpu/ppc/vm/vmreg_ppc.inline.hpp +++ b/hotspot/src/cpu/ppc/vm/vmreg_ppc.inline.hpp @@ -44,28 +44,5 @@ inline VMReg SpecialRegisterImpl::as_VMReg() { return VMRegImpl::as_VMReg((encoding()) + ConcreteRegisterImpl::max_cnd); } -inline bool VMRegImpl::is_Register() { - return (unsigned int)value() < (unsigned int)ConcreteRegisterImpl::max_gpr; -} - -inline bool VMRegImpl::is_FloatRegister() { - return value() >= ConcreteRegisterImpl::max_gpr && - value() < ConcreteRegisterImpl::max_fpr; -} - -inline Register VMRegImpl::as_Register() { - assert(is_Register() && is_even(value()), "even-aligned GPR name"); - return ::as_Register(value()>>1); -} - -inline FloatRegister VMRegImpl::as_FloatRegister() { - assert(is_FloatRegister() && is_even(value()), "must be"); - return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); -} - -inline bool VMRegImpl::is_concrete() { - assert(is_reg(), "must be"); - return is_even(value()); -} #endif // CPU_PPC_VM_VMREG_PPC_INLINE_HPP diff --git a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp index 1eeca870804..9f9fc75bd1b 100644 --- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ #include "oops/compiledICHolder.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" -#include "register_sparc.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" #include "runtime/vframeArray.hpp" diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp index 17b4d9e05ac..de161ecd9eb 100644 --- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "code/codeCache.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" #include "oops/markOop.hpp" diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp index 8aa0105bf0d..da6c4b25c71 100644 --- a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #define CPU_SPARC_VM_FRAME_SPARC_INLINE_HPP #include "asm/macroAssembler.hpp" +#include "code/vmreg.inline.hpp" // Inline functions for SPARC frames: diff --git a/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp b/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp index 41bdd88f7f5..8cbe422a4af 100644 --- a/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "asm/macroAssembler.inline.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "memory/allocation.inline.hpp" diff --git a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp index 132c5292a06..debdaeae7a4 100644 --- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp index e43d77665ac..79ca56aecd3 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "asm/assembler.inline.hpp" +#include "asm/macroAssembler.inline.hpp" #include "compiler/disassembler.hpp" #include "gc_interface/collectedHeap.inline.hpp" #include "interpreter/interpreter.hpp" diff --git a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp index af2e4e1e96c..4cd5b2a93c3 100644 --- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "interpreter/interpreter.hpp" +#include "interpreter/interp_masm.hpp" #include "memory/allocation.inline.hpp" #include "prims/methodHandles.hpp" diff --git a/hotspot/src/cpu/sparc/vm/register_sparc.hpp b/hotspot/src/cpu/sparc/vm/register_sparc.hpp index 7d0096ccf59..22cb0283825 100644 --- a/hotspot/src/cpu/sparc/vm/register_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/register_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ #define CPU_SPARC_VM_REGISTER_SPARC_HPP #include "asm/register.hpp" -#include "vm_version_sparc.hpp" // forward declaration class Address; @@ -65,7 +64,7 @@ class RegisterImpl: public AbstractRegisterImpl { friend Register as_oRegister(int number); friend Register as_gRegister(int number); - VMReg as_VMReg(); + inline VMReg as_VMReg(); // accessors int encoding() const { assert(is_valid(), "invalid register"); return value(); } @@ -234,7 +233,7 @@ class FloatRegisterImpl: public AbstractRegisterImpl { }; // construction - VMReg as_VMReg( ); + inline VMReg as_VMReg( ); // accessors int encoding() const { assert(is_valid(), "invalid register"); return value(); } diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp index c281e3bc005..018ff0e08aa 100644 --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index d4eb74f3204..f85864df878 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "memory/universe.inline.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp b/hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp index ce8cb4c3d3a..29f38a8d8ca 100644 --- a/hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp @@ -25,10 +25,35 @@ #ifndef CPU_SPARC_VM_VMREG_SPARC_HPP #define CPU_SPARC_VM_VMREG_SPARC_HPP - bool is_Register(); - Register as_Register(); +inline bool is_Register() { return value() >= 0 && value() < ConcreteRegisterImpl::max_gpr; } +inline bool is_FloatRegister() { return value() >= ConcreteRegisterImpl::max_gpr && + value() < ConcreteRegisterImpl::max_fpr; } +inline Register as_Register() { - bool is_FloatRegister(); - FloatRegister as_FloatRegister(); + assert( is_Register() && is_even(value()), "even-aligned GPR name" ); + // Yuk + return ::as_Register(value()>>1); +} + +inline FloatRegister as_FloatRegister() { + assert( is_FloatRegister(), "must be" ); + // Yuk + return ::as_FloatRegister( value() - ConcreteRegisterImpl::max_gpr ); +} + +inline bool is_concrete() { + assert(is_reg(), "must be"); + int v = value(); + if ( v < ConcreteRegisterImpl::max_gpr ) { + return is_even(v); + } + // F0..F31 + if ( v <= ConcreteRegisterImpl::max_gpr + 31) return true; + if ( v < ConcreteRegisterImpl::max_fpr) { + return is_even(v); + } + assert(false, "what register?"); + return false; +} #endif // CPU_SPARC_VM_VMREG_SPARC_HPP diff --git a/hotspot/src/cpu/sparc/vm/vmreg_sparc.inline.hpp b/hotspot/src/cpu/sparc/vm/vmreg_sparc.inline.hpp index 993216fc12d..936d39db68b 100644 --- a/hotspot/src/cpu/sparc/vm/vmreg_sparc.inline.hpp +++ b/hotspot/src/cpu/sparc/vm/vmreg_sparc.inline.hpp @@ -33,35 +33,5 @@ inline VMReg RegisterImpl::as_VMReg() { inline VMReg FloatRegisterImpl::as_VMReg() { return VMRegImpl::as_VMReg( ConcreteRegisterImpl::max_gpr + encoding() ); } -inline bool VMRegImpl::is_Register() { return value() >= 0 && value() < ConcreteRegisterImpl::max_gpr; } -inline bool VMRegImpl::is_FloatRegister() { return value() >= ConcreteRegisterImpl::max_gpr && - value() < ConcreteRegisterImpl::max_fpr; } -inline Register VMRegImpl::as_Register() { - - assert( is_Register() && is_even(value()), "even-aligned GPR name" ); - // Yuk - return ::as_Register(value()>>1); -} - -inline FloatRegister VMRegImpl::as_FloatRegister() { - assert( is_FloatRegister(), "must be" ); - // Yuk - return ::as_FloatRegister( value() - ConcreteRegisterImpl::max_gpr ); -} - -inline bool VMRegImpl::is_concrete() { - assert(is_reg(), "must be"); - int v = value(); - if ( v < ConcreteRegisterImpl::max_gpr ) { - return is_even(v); - } - // F0..F31 - if ( v <= ConcreteRegisterImpl::max_gpr + 31) return true; - if ( v < ConcreteRegisterImpl::max_fpr) { - return is_even(v); - } - assert(false, "what register?"); - return false; -} #endif // CPU_SPARC_VM_VMREG_SPARC_INLINE_HPP diff --git a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp index 9b875b83499..da05e8868bb 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #define CPU_X86_VM_FRAME_X86_INLINE_HPP #include "code/codeCache.hpp" +#include "code/vmreg.inline.hpp" // Inline functions for Intel frames: diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp index 3c66bf4fb45..abe354360ff 100644 --- a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp index e9c1ef782d8..65ffc6d2e97 100644 --- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp @@ -28,6 +28,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/x86/vm/register_x86.hpp b/hotspot/src/cpu/x86/vm/register_x86.hpp index 680dd900a48..b5e6989d5d9 100644 --- a/hotspot/src/cpu/x86/vm/register_x86.hpp +++ b/hotspot/src/cpu/x86/vm/register_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ #define CPU_X86_VM_REGISTER_X86_HPP #include "asm/register.hpp" -#include "vm_version_x86.hpp" class VMRegImpl; typedef VMRegImpl* VMReg; @@ -59,7 +58,7 @@ class RegisterImpl: public AbstractRegisterImpl { // construction inline friend Register as_Register(int encoding); - VMReg as_VMReg(); + inline VMReg as_VMReg(); // accessors int encoding() const { assert(is_valid(), "invalid register"); return (intptr_t)this; } @@ -110,9 +109,10 @@ class FloatRegisterImpl: public AbstractRegisterImpl { // construction inline friend FloatRegister as_FloatRegister(int encoding); - VMReg as_VMReg(); + inline VMReg as_VMReg(); // derived registers, offsets, and addresses + FloatRegister successor() const { return as_FloatRegister(encoding() + 1); } // accessors @@ -152,7 +152,7 @@ class XMMRegisterImpl: public AbstractRegisterImpl { // construction friend XMMRegister as_XMMRegister(int encoding); - VMReg as_VMReg(); + inline VMReg as_VMReg(); // derived registers, offsets, and addresses XMMRegister successor() const { return as_XMMRegister(encoding() + 1); } diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp index 1e49ce1c6a4..c9be17caab1 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 201,4 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 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp index 12b0d0568f9..7d836127da2 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "oops/arrayOop.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index 7fc8d33c42f..da56c1449cd 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #include "asm/macroAssembler.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "memory/universe.inline.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index 60f62077e55..00d2d58cdfb 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #include "asm/macroAssembler.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "memory/universe.inline.hpp" #include "oops/methodData.hpp" diff --git a/hotspot/src/cpu/x86/vm/vmreg_x86.hpp b/hotspot/src/cpu/x86/vm/vmreg_x86.hpp index 38d47dccfc3..f31e1c5c9fd 100644 --- a/hotspot/src/cpu/x86/vm/vmreg_x86.hpp +++ b/hotspot/src/cpu/x86/vm/vmreg_x86.hpp @@ -25,13 +25,49 @@ #ifndef CPU_X86_VM_VMREG_X86_HPP #define CPU_X86_VM_VMREG_X86_HPP - bool is_Register(); - Register as_Register(); - bool is_FloatRegister(); - FloatRegister as_FloatRegister(); - bool is_XMMRegister(); - XMMRegister as_XMMRegister(); +inline bool is_Register() { + return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; +} + +inline bool is_FloatRegister() { + return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; +} + +inline bool is_XMMRegister() { + return value() >= ConcreteRegisterImpl::max_fpr && value() < ConcreteRegisterImpl::max_xmm; +} + +inline Register as_Register() { + + assert( is_Register(), "must be"); + // Yuk +#ifdef AMD64 + return ::as_Register(value() >> 1); +#else + return ::as_Register(value()); +#endif // AMD64 +} + +inline FloatRegister as_FloatRegister() { + assert( is_FloatRegister() && is_even(value()), "must be" ); + // Yuk + return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); +} + +inline XMMRegister as_XMMRegister() { + assert( is_XMMRegister() && is_even(value()), "must be" ); + // Yuk + return ::as_XMMRegister((value() - ConcreteRegisterImpl::max_fpr) >> 3); +} + +inline bool is_concrete() { + assert(is_reg(), "must be"); +#ifndef AMD64 + if (is_Register()) return true; +#endif // AMD64 + return is_even(value()); +} #endif // CPU_X86_VM_VMREG_X86_HPP diff --git a/hotspot/src/cpu/x86/vm/vmreg_x86.inline.hpp b/hotspot/src/cpu/x86/vm/vmreg_x86.inline.hpp index 0608d3edbff..bc94e4839af 100644 --- a/hotspot/src/cpu/x86/vm/vmreg_x86.inline.hpp +++ b/hotspot/src/cpu/x86/vm/vmreg_x86.inline.hpp @@ -42,48 +42,4 @@ inline VMReg XMMRegisterImpl::as_VMReg() { return VMRegImpl::as_VMReg((encoding() << 3) + ConcreteRegisterImpl::max_fpr); } - -inline bool VMRegImpl::is_Register() { - return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; -} - -inline bool VMRegImpl::is_FloatRegister() { - return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; -} - -inline bool VMRegImpl::is_XMMRegister() { - return value() >= ConcreteRegisterImpl::max_fpr && value() < ConcreteRegisterImpl::max_xmm; -} - -inline Register VMRegImpl::as_Register() { - - assert( is_Register(), "must be"); - // Yuk -#ifdef AMD64 - return ::as_Register(value() >> 1); -#else - return ::as_Register(value()); -#endif // AMD64 -} - -inline FloatRegister VMRegImpl::as_FloatRegister() { - assert( is_FloatRegister() && is_even(value()), "must be" ); - // Yuk - return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); -} - -inline XMMRegister VMRegImpl::as_XMMRegister() { - assert( is_XMMRegister() && is_even(value()), "must be" ); - // Yuk - return ::as_XMMRegister((value() - ConcreteRegisterImpl::max_fpr) >> 3); -} - -inline bool VMRegImpl::is_concrete() { - assert(is_reg(), "must be"); -#ifndef AMD64 - if (is_Register()) return true; -#endif // AMD64 - return is_even(value()); -} - #endif // CPU_X86_VM_VMREG_X86_INLINE_HPP diff --git a/hotspot/src/cpu/x86/vm/x86.ad b/hotspot/src/cpu/x86/vm/x86.ad index b575a98a816..42cc708a610 100644 --- a/hotspot/src/cpu/x86/vm/x86.ad +++ b/hotspot/src/cpu/x86/vm/x86.ad @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This code is free software; you can redistribute it and/or modify it @@ -487,6 +487,8 @@ source_hpp %{ // To keep related declarations/definitions/uses close together, // we switch between source %{ }% and source_hpp %{ }% freely as needed. +class NativeJump; + class CallStubImpl { //-------------------------------------------------------------- diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index b774455a454..e6b92b76f12 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -66,6 +66,7 @@ #include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/timer.hpp" +#include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/runtimeService.hpp" #include "utilities/decoder.hpp" diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 744ff23408b..e963aeec5ad 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -59,6 +59,7 @@ #include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/timer.hpp" +#include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/memTracker.hpp" #include "services/runtimeService.hpp" diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 0b2bf13383a..86d6913299c 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -62,6 +62,7 @@ #include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/timer.hpp" +#include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/memTracker.hpp" #include "services/runtimeService.hpp" diff --git a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp index 744bb7c38d4..046912a2c24 100644 --- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, SAP AG. 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 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_ppc.hpp" #ifndef _LP64 #error "Atomic currently only impleneted for PPC64" diff --git a/hotspot/src/os_cpu/aix_ppc/vm/orderAccess_aix_ppc.inline.hpp b/hotspot/src/os_cpu/aix_ppc/vm/orderAccess_aix_ppc.inline.hpp index 93e5ed159cd..36ca820a6bd 100644 --- a/hotspot/src/os_cpu/aix_ppc/vm/orderAccess_aix_ppc.inline.hpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/orderAccess_aix_ppc.inline.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, SAP AG. 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,7 +27,6 @@ #define OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_INLINE_HPP #include "runtime/orderAccess.hpp" -#include "vm_version_ppc.hpp" // Implementation of class OrderAccess. diff --git a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp index ab7fab3dd13..0a9feddfec4 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" // Implementation of class atomic diff --git a/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp b/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp index c7459d5a514..834efd2bbf7 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" // Implementation of class OrderAccess. diff --git a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp index 4ed2934463b..60969caa962 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,7 +28,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_zero.hpp" // Implementation of class atomic diff --git a/hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp b/hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp index 7f8e78bbff8..ecc4c752777 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,7 +27,6 @@ #define OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP #include "runtime/orderAccess.hpp" -#include "vm_version_zero.hpp" #ifdef ARM diff --git a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp index c8fcf1f64d2..39ed85ea361 100644 --- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp +++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, SAP AG. 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 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_ppc.hpp" #ifndef PPC64 #error "Atomic currently only implemented for PPC64" diff --git a/hotspot/src/os_cpu/linux_ppc/vm/orderAccess_linux_ppc.inline.hpp b/hotspot/src/os_cpu/linux_ppc/vm/orderAccess_linux_ppc.inline.hpp index dcc2375f878..dff21c6bf6a 100644 --- a/hotspot/src/os_cpu/linux_ppc/vm/orderAccess_linux_ppc.inline.hpp +++ b/hotspot/src/os_cpu/linux_ppc/vm/orderAccess_linux_ppc.inline.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, SAP AG. 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,7 +27,6 @@ #define OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP #include "runtime/orderAccess.hpp" -#include "vm_version_ppc.hpp" #ifndef PPC64 #error "OrderAccess currently only implemented for PPC64" diff --git a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp index 331eed7a67f..29b51d70f7f 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_sparc.hpp" // Implementation of class atomic diff --git a/hotspot/src/os_cpu/linux_sparc/vm/orderAccess_linux_sparc.inline.hpp b/hotspot/src/os_cpu/linux_sparc/vm/orderAccess_linux_sparc.inline.hpp index 6833c1f4e61..f5215f187e8 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/orderAccess_linux_sparc.inline.hpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/orderAccess_linux_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ #define OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP #include "runtime/orderAccess.hpp" -#include "vm_version_sparc.hpp" // Implementation of class OrderAccess. diff --git a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp index 2d0d5197344..679dd614523 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" // Implementation of class atomic diff --git a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp index 10240a0b1c2..a71a53cfa8c 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" // Implementation of class OrderAccess. diff --git a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp index 33ce50dc73f..d9df41034d4 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp +++ b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,7 +28,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_zero.hpp" // Implementation of class atomic diff --git a/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp b/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp index 773fd643ab7..e15041e76a7 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp +++ b/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,7 +27,6 @@ #define OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_INLINE_HPP #include "runtime/orderAccess.hpp" -#include "vm_version_zero.hpp" #ifdef ARM diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp index 7d17fdf39cd..83a07ce3fe5 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_sparc.hpp" // Implementation of class atomic diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp index 7e633fd95cb..f9321f2bac2 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" -#include "vm_version_sparc.hpp" // Implementation of class OrderAccess. diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index ed7b2538280..f22bdcb923e 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -27,6 +27,7 @@ #include "classfile/classLoader.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" diff --git a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp index 27c0d396b72..e00d5be1ff0 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; } inline void Atomic::store (jshort store_value, jshort* dest) { *dest = store_value; } diff --git a/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp b/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp index e7238c27549..e211c060552 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" // Implementation of class OrderAccess. diff --git a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp index 7ba00f7aaeb..072b61f07d3 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" // The following alternative implementations are needed because // Windows 95 doesn't support (some of) the corresponding Windows NT diff --git a/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp b/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp index ea0ed143e98..37e5126e066 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" -#include "vm_version_x86.hpp" // Implementation of class OrderAccess. diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp index 614f0d43f10..6c4553f4b8f 100644 --- a/hotspot/src/share/vm/adlc/main.cpp +++ b/hotspot/src/share/vm/adlc/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -213,7 +213,8 @@ int main(int argc, char *argv[]) AD.addInclude(AD._CPP_file, "memory/allocation.inline.hpp"); AD.addInclude(AD._CPP_file, "asm/macroAssembler.inline.hpp"); AD.addInclude(AD._CPP_file, "code/compiledIC.hpp"); - AD.addInclude(AD._CPP_file, "code/vmreg.hpp"); + AD.addInclude(AD._CPP_file, "code/nativeInst.hpp"); + AD.addInclude(AD._CPP_file, "code/vmreg.inline.hpp"); AD.addInclude(AD._CPP_file, "gc_interface/collectedHeap.inline.hpp"); AD.addInclude(AD._CPP_file, "oops/compiledICHolder.hpp"); AD.addInclude(AD._CPP_file, "oops/markOop.hpp"); @@ -230,23 +231,8 @@ int main(int argc, char *argv[]) AD.addInclude(AD._CPP_file, "runtime/sharedRuntime.hpp"); AD.addInclude(AD._CPP_file, "runtime/stubRoutines.hpp"); AD.addInclude(AD._CPP_file, "utilities/growableArray.hpp"); -#ifdef TARGET_ARCH_x86 - AD.addInclude(AD._CPP_file, "nativeInst_x86.hpp"); - AD.addInclude(AD._CPP_file, "vmreg_x86.inline.hpp"); -#endif -#ifdef TARGET_ARCH_sparc - AD.addInclude(AD._CPP_file, "nativeInst_sparc.hpp"); - AD.addInclude(AD._CPP_file, "vmreg_sparc.inline.hpp"); -#endif -#ifdef TARGET_ARCH_arm - AD.addInclude(AD._CPP_file, "nativeInst_arm.hpp"); - AD.addInclude(AD._CPP_file, "vmreg_arm.inline.hpp"); -#endif -#ifdef TARGET_ARCH_ppc - AD.addInclude(AD._CPP_file, "nativeInst_ppc.hpp"); - AD.addInclude(AD._CPP_file, "vmreg_ppc.inline.hpp"); -#endif AD.addInclude(AD._HPP_file, "memory/allocation.hpp"); + AD.addInclude(AD._HPP_file, "code/nativeInst.hpp"); AD.addInclude(AD._HPP_file, "opto/machnode.hpp"); AD.addInclude(AD._HPP_file, "opto/node.hpp"); AD.addInclude(AD._HPP_file, "opto/regalloc.hpp"); diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp index ec8ec5eb435..3b9c012e02f 100644 --- a/hotspot/src/share/vm/asm/assembler.hpp +++ b/hotspot/src/share/vm/asm/assembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,34 +26,15 @@ #define SHARE_VM_ASM_ASSEMBLER_HPP #include "asm/codeBuffer.hpp" +#include "asm/register.hpp" #include "code/oopRecorder.hpp" #include "code/relocInfo.hpp" #include "memory/allocation.hpp" +#include "runtime/vm_version.hpp" #include "utilities/debug.hpp" #include "utilities/growableArray.hpp" #include "utilities/top.hpp" -#ifdef TARGET_ARCH_x86 -# include "register_x86.hpp" -# include "vm_version_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "register_sparc.hpp" -# include "vm_version_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "register_zero.hpp" -# include "vm_version_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "register_arm.hpp" -# include "vm_version_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "register_ppc.hpp" -# include "vm_version_ppc.hpp" -#endif - // This file contains platform-independent assembler declarations. class MacroAssembler; diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp index 60d405b35f4..9c4bc206158 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.cpp +++ b/hotspot/src/share/vm/asm/codeBuffer.cpp @@ -28,6 +28,7 @@ #include "memory/gcLocker.hpp" #include "oops/methodData.hpp" #include "oops/oop.inline.hpp" +#include "runtime/icache.hpp" #include "utilities/copy.hpp" #include "utilities/xmlstream.hpp" diff --git a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp index 2d0c31e2afe..e3a4f4d5680 100644 --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ #include "c1/c1_Instruction.hpp" #include "c1/c1_LIR.hpp" #include "c1/c1_Runtime1.hpp" +#include "code/nativeInst.hpp" #include "utilities/array.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/c1/c1_Defs.hpp b/hotspot/src/share/vm/c1/c1_Defs.hpp index bebb3b0bebe..7504bbf7ce7 100644 --- a/hotspot/src/share/vm/c1/c1_Defs.hpp +++ b/hotspot/src/share/vm/c1/c1_Defs.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,21 +26,7 @@ #define SHARE_VM_C1_C1_DEFS_HPP #include "utilities/globalDefinitions.hpp" -#ifdef TARGET_ARCH_x86 -# include "register_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "register_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "register_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "register_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "register_ppc.hpp" -#endif +#include "asm/register.hpp" // set frame size and return address offset to these values in blobs // (if the compiled frame uses ebp as link pointer on IA; otherwise, diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp index f9e46f30132..a164d8ccb00 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,24 +25,8 @@ #include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" +#include "code/vmreg.inline.hpp" #include "runtime/sharedRuntime.hpp" -#ifdef TARGET_ARCH_x86 -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmreg_ppc.inline.hpp" -#endif - - //----------------------------------------------------- diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index cada65e1a94..6798e615e56 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ #include "interpreter/bytecode.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/compilationPolicy.hpp" +#include "runtime/vm_version.hpp" #include "utilities/bitMap.inline.hpp" class BlockListBuilder VALUE_OBJ_CLASS_SPEC { diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp index 5697e9046aa..48b560840e3 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,27 +30,6 @@ #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_ValueStack.hpp" #include "ci/ciInstance.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -# include "vmreg_ppc.inline.hpp" -#endif - void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) { // we must have enough patching space so that call can be inserted diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index bf0b6f2f1ea..57b76803b42 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ #include "ci/ciObjArray.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/vm_version.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/macros.hpp" #if INCLUDE_ALL_GCS diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp index 91bef59ef17..afed1de995f 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,23 +31,8 @@ #include "c1/c1_LIRGenerator.hpp" #include "c1/c1_LinearScan.hpp" #include "c1/c1_ValueStack.hpp" +#include "code/vmreg.inline.hpp" #include "utilities/bitMap.inline.hpp" -#ifdef TARGET_ARCH_x86 -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmreg_ppc.inline.hpp" -#endif - #ifndef PRODUCT diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index a472718a64e..b78b787fc5b 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -56,6 +56,7 @@ #include "runtime/threadCritical.hpp" #include "runtime/vframe.hpp" #include "runtime/vframeArray.hpp" +#include "runtime/vm_version.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" diff --git a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp index cbf3baf7945..0d8cfc7878a 100644 --- a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp +++ b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,22 +28,7 @@ #include "interpreter/bytecodes.hpp" #include "memory/oopFactory.hpp" #include "oops/constantPool.hpp" - -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif +#include "utilities/bytes.hpp" u2 BytecodeConstantPool::find_or_add(BytecodeCPEntry const& bcpe) { u2 index; diff --git a/hotspot/src/share/vm/classfile/classFileStream.hpp b/hotspot/src/share/vm/classfile/classFileStream.hpp index 691ed808fec..de392e7fa13 100644 --- a/hotspot/src/share/vm/classfile/classFileStream.hpp +++ b/hotspot/src/share/vm/classfile/classFileStream.hpp @@ -25,22 +25,8 @@ #ifndef SHARE_VM_CLASSFILE_CLASSFILESTREAM_HPP #define SHARE_VM_CLASSFILE_CLASSFILESTREAM_HPP +#include "utilities/bytes.hpp" #include "utilities/top.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif // Input stream for reading .class file // diff --git a/hotspot/src/share/vm/classfile/stackMapTable.hpp b/hotspot/src/share/vm/classfile/stackMapTable.hpp index ee8b33f6219..385aef3a7e6 100644 --- a/hotspot/src/share/vm/classfile/stackMapTable.hpp +++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,22 +30,8 @@ #include "memory/allocation.hpp" #include "oops/constantPool.hpp" #include "oops/method.hpp" +#include "utilities/bytes.hpp" #include "utilities/globalDefinitions.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif class StackMapReader; diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index c7eca2d011b..60eab975142 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -45,21 +45,7 @@ #include "runtime/javaCalls.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/os.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif +#include "utilities/bytes.hpp" #define NOFAILOVER_MAJOR_VERSION 51 #define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51 diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp index f9e78bfb9e2..710ca948ddc 100644 --- a/hotspot/src/share/vm/code/codeBlob.cpp +++ b/hotspot/src/share/vm/code/codeBlob.cpp @@ -39,21 +39,6 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/vframe.hpp" #include "services/memoryService.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -#endif #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" #endif diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp index 0d522af63fe..ec36381b1f2 100644 --- a/hotspot/src/share/vm/code/compiledIC.hpp +++ b/hotspot/src/share/vm/code/compiledIC.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,23 +25,9 @@ #ifndef SHARE_VM_CODE_COMPILEDIC_HPP #define SHARE_VM_CODE_COMPILEDIC_HPP +#include "code/nativeInst.hpp" #include "interpreter/linkResolver.hpp" #include "oops/compiledICHolder.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -#endif //----------------------------------------------------------------------------- // The CompiledIC represents a compiled inline cache. diff --git a/hotspot/src/share/vm/code/nativeInst.hpp b/hotspot/src/share/vm/code/nativeInst.hpp new file mode 100644 index 00000000000..6e4ece7d01a --- /dev/null +++ b/hotspot/src/share/vm/code/nativeInst.hpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + * + */ + +#ifndef SHARE_VM_CODE_NATIVEINST_HPP +#define SHARE_VM_CODE_NATIVEINST_HPP + +#ifdef TARGET_ARCH_x86 +# include "nativeInst_x86.hpp" +#endif +#ifdef TARGET_ARCH_sparc +# include "nativeInst_sparc.hpp" +#endif +#ifdef TARGET_ARCH_zero +# include "nativeInst_zero.hpp" +#endif +#ifdef TARGET_ARCH_arm +# include "nativeInst_arm.hpp" +#endif +#ifdef TARGET_ARCH_ppc +# include "nativeInst_ppc.hpp" +#endif + +#endif // SHARE_VM_CODE_NATIVEINST_HPP diff --git a/hotspot/src/share/vm/code/vmreg.hpp b/hotspot/src/share/vm/code/vmreg.hpp index 1ef07ec199c..0b2edd19fd9 100644 --- a/hotspot/src/share/vm/code/vmreg.hpp +++ b/hotspot/src/share/vm/code/vmreg.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,34 +25,13 @@ #ifndef SHARE_VM_CODE_VMREG_HPP #define SHARE_VM_CODE_VMREG_HPP +#include "asm/register.hpp" #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" -#include "asm/register.hpp" #ifdef COMPILER2 #include "opto/adlcVMDeps.hpp" #include "utilities/ostream.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/adGlobals_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/adGlobals_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/adGlobals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/adGlobals_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/adGlobals_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/adGlobals_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/adGlobals_ppc_64.hpp" -#endif #endif //------------------------------VMReg------------------------------------------ @@ -107,7 +86,7 @@ public: // also a register you could use in the assembler. On machines with // 64bit registers only one half of the VMReg (and OptoReg) is considered // concrete. - bool is_concrete(); + // bool is_concrete(); // VMRegs are 4 bytes wide on all platforms static const int stack_slot_size; diff --git a/hotspot/src/share/vm/code/vmreg.inline.hpp b/hotspot/src/share/vm/code/vmreg.inline.hpp new file mode 100644 index 00000000000..6204f9df39f --- /dev/null +++ b/hotspot/src/share/vm/code/vmreg.inline.hpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + * + */ + +#ifndef SHARE_VM_CODE_VMREG_INLINE_HPP +#define SHARE_VM_CODE_VMREG_INLINE_HPP + +#include "asm/register.hpp" +#include "code/vmreg.hpp" +#ifdef TARGET_ARCH_x86 +# include "vmreg_x86.inline.hpp" +#endif +#ifdef TARGET_ARCH_sparc +# include "vmreg_sparc.inline.hpp" +#endif +#ifdef TARGET_ARCH_zero +# include "vmreg_zero.inline.hpp" +#endif +#ifdef TARGET_ARCH_arm +# include "vmreg_arm.inline.hpp" +#endif +#ifdef TARGET_ARCH_ppc +# include "vmreg_ppc.inline.hpp" +#endif + +#endif // SHARE_VM_CODE_VMREG_INLINE_HPP diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp index f2c04b6e4ff..340251f3265 100644 --- a/hotspot/src/share/vm/compiler/compileLog.cpp +++ b/hotspot/src/share/vm/compiler/compileLog.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "ci/ciMethod.hpp" +#include "code/codeCache.hpp" #include "compiler/compileLog.hpp" #include "memory/allocation.inline.hpp" #include "oops/method.hpp" diff --git a/hotspot/src/share/vm/compiler/oopMap.cpp b/hotspot/src/share/vm/compiler/oopMap.cpp index 5e1801584c2..556966bc9bf 100644 --- a/hotspot/src/share/vm/compiler/oopMap.cpp +++ b/hotspot/src/share/vm/compiler/oopMap.cpp @@ -36,6 +36,9 @@ #ifdef COMPILER1 #include "c1/c1_Defs.hpp" #endif +#ifdef COMPILER2 +#include "opto/optoreg.hpp" +#endif // OopMapStream diff --git a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp index d5d1b150134..783066e0adb 100644 --- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,29 +25,12 @@ #ifndef SHARE_VM_INTERPRETER_ABSTRACTINTERPRETER_HPP #define SHARE_VM_INTERPRETER_ABSTRACTINTERPRETER_HPP +#include "asm/macroAssembler.hpp" #include "code/stubs.hpp" #include "interpreter/bytecodes.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" #include "utilities/top.hpp" -#ifdef TARGET_ARCH_x86 -# include "interp_masm_x86.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "interp_masm_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "interp_masm_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "interp_masm_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "interp_masm_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "interp_masm_ppc_64.hpp" -#endif // This file contains the platform-independent parts // of the abstract interpreter and the abstract interpreter generator. @@ -75,6 +58,8 @@ //------------------------------------------------------------------------------------------------------------------------ // The C++ interface to the bytecode interpreter(s). +class InterpreterMacroAssembler; + class AbstractInterpreter: AllStatic { friend class VMStructs; friend class Interpreter; diff --git a/hotspot/src/share/vm/interpreter/bytecode.hpp b/hotspot/src/share/vm/interpreter/bytecode.hpp index 10b5a567b24..0708816ff51 100644 --- a/hotspot/src/share/vm/interpreter/bytecode.hpp +++ b/hotspot/src/share/vm/interpreter/bytecode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,21 +28,7 @@ #include "interpreter/bytecodes.hpp" #include "memory/allocation.hpp" #include "oops/method.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif +#include "utilities/bytes.hpp" class ciBytecodeStream; diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp index b2a1c49683f..49fc1703d50 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,21 +32,6 @@ #include "runtime/frame.hpp" #include "runtime/globals.hpp" #include "utilities/globalDefinitions.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif #ifdef CC_INTERP @@ -56,6 +41,8 @@ // CVM definitions find hotspot equivalents... +class InterpreterMacroAssembler; + union VMJavaVal64 { jlong l; jdouble d; diff --git a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp index cf5500a7e33..1f657b98bc2 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,21 +29,7 @@ #include "memory/allocation.hpp" #include "oops/method.hpp" #include "runtime/handles.inline.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif +#include "utilities/bytes.hpp" // A BytecodeStream is used for fast iteration over the bytecodes // of a Method*. diff --git a/hotspot/src/share/vm/interpreter/bytecodes.cpp b/hotspot/src/share/vm/interpreter/bytecodes.cpp index 5c26a4a751f..7fcd6543984 100644 --- a/hotspot/src/share/vm/interpreter/bytecodes.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,21 +26,7 @@ #include "interpreter/bytecodes.hpp" #include "memory/resourceArea.hpp" #include "oops/method.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif +#include "utilities/bytes.hpp" #if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER < 1600)) diff --git a/hotspot/src/share/vm/interpreter/interp_masm.hpp b/hotspot/src/share/vm/interpreter/interp_masm.hpp new file mode 100644 index 00000000000..6e647835448 --- /dev/null +++ b/hotspot/src/share/vm/interpreter/interp_masm.hpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + * + */ + +#ifndef SHARE_VM_INTERPRETER_INTERP_MASM_HPP +#define SHARE_VM_INTERPRETER_INTERP_MASM_HPP + +#include "asm/macroAssembler.hpp" + +#ifdef TARGET_ARCH_x86 +# include "interp_masm_x86.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_sparc +# include "interp_masm_sparc.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_zero +# include "interp_masm_zero.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_arm +# include "interp_masm_arm.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_ppc_32 +# include "interp_masm_ppc_32.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_ppc_64 +# include "interp_masm_ppc_64.hpp" +#endif + +#endif // SHARE_VM_INTERPRETER_INTERP_MASM_HPP diff --git a/hotspot/src/share/vm/interpreter/interpreter.cpp b/hotspot/src/share/vm/interpreter/interpreter.cpp index 7ce4bdbb3ec..4807cd08398 100644 --- a/hotspot/src/share/vm/interpreter/interpreter.cpp +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp @@ -30,6 +30,7 @@ #include "interpreter/bytecodeInterpreter.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" @@ -80,9 +81,35 @@ void InterpreterCodelet::print_on(outputStream* st) const { } } +CodeletMark::CodeletMark(InterpreterMacroAssembler*& masm, + const char* description, + Bytecodes::Code bytecode) : + _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())), + _cb(_clet->code_begin(), _clet->code_size()) { + // Request all space (add some slack for Codelet data). + assert(_clet != NULL, "we checked not enough space already"); + + // Initialize Codelet attributes. + _clet->initialize(description, bytecode); + // Create assembler for code generation. + masm = new InterpreterMacroAssembler(&_cb); + _masm = &masm; +} + +CodeletMark::~CodeletMark() { + // Align so printing shows nop's instead of random code at the end (Codelets are aligned). + (*_masm)->align(wordSize); + // Make sure all code is in code buffer. + (*_masm)->flush(); + + // Commit Codelet. + AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->strings()); + // Make sure nobody can use _masm outside a CodeletMark lifespan. + *_masm = NULL; +} //------------------------------------------------------------------------------------------------------------------------ -// Implementation of platform independent aspects of Interpreter +// Implementation of platform independent aspects of Interpreter void AbstractInterpreter::initialize() { if (_code != NULL) return; diff --git a/hotspot/src/share/vm/interpreter/interpreter.hpp b/hotspot/src/share/vm/interpreter/interpreter.hpp index cc26b378d73..2a81daf205d 100644 --- a/hotspot/src/share/vm/interpreter/interpreter.hpp +++ b/hotspot/src/share/vm/interpreter/interpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,8 @@ // This file contains the platform-independent parts // of the interpreter and the interpreter generator. +class InterpreterMacroAssembler; + //------------------------------------------------------------------------------------------------------------------------ // An InterpreterCodelet is a piece of interpreter code. All // interpreter code is generated into little codelets which @@ -99,42 +101,17 @@ class CodeletMark: ResourceMark { int codelet_size = AbstractInterpreter::code()->available_space() - 2*K; // Guarantee there's a little bit of code space left. - guarantee (codelet_size > 0 && (size_t)codelet_size > 2*K, - "not enough space for interpreter generation"); + guarantee(codelet_size > 0 && (size_t)codelet_size > 2*K, + "not enough space for interpreter generation"); return codelet_size; } public: - CodeletMark( - InterpreterMacroAssembler*& masm, - const char* description, - Bytecodes::Code bytecode = Bytecodes::_illegal): - _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())), - _cb(_clet->code_begin(), _clet->code_size()) - - { // request all space (add some slack for Codelet data) - assert (_clet != NULL, "we checked not enough space already"); - - // initialize Codelet attributes - _clet->initialize(description, bytecode); - // create assembler for code generation - masm = new InterpreterMacroAssembler(&_cb); - _masm = &masm; - } - - ~CodeletMark() { - // align so printing shows nop's instead of random code at the end (Codelets are aligned) - (*_masm)->align(wordSize); - // make sure all code is in code buffer - (*_masm)->flush(); - - - // commit Codelet - AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->strings()); - // make sure nobody can use _masm outside a CodeletMark lifespan - *_masm = NULL; - } + CodeletMark(InterpreterMacroAssembler*& masm, + const char* description, + Bytecodes::Code bytecode = Bytecodes::_illegal); + ~CodeletMark(); }; // Wrapper classes to produce Interpreter/InterpreterGenerator from either @@ -142,9 +119,10 @@ class CodeletMark: ResourceMark { class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) { - public: + public: // Debugging/printing - static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); } + static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); } + #ifdef TARGET_ARCH_x86 # include "interpreter_x86.hpp" #endif diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp index 42a721839a8..b736d8edbdb 100644 --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp @@ -48,6 +48,7 @@ #include "runtime/deoptimization.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/icache.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/java.hpp" #include "runtime/jfieldIDWorkaround.hpp" @@ -57,21 +58,6 @@ #include "runtime/synchronizer.hpp" #include "runtime/threadCritical.hpp" #include "utilities/events.hpp" -#ifdef TARGET_ARCH_x86 -# include "vm_version_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vm_version_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vm_version_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vm_version_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vm_version_ppc.hpp" -#endif #ifdef COMPILER2 #include "opto/runtime.hpp" #endif diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp index 66eb63eafb6..9f28e20f9b7 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp @@ -26,6 +26,8 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterGenerator.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "interpreter/interp_masm.hpp" +#include "interpreter/templateInterpreter.hpp" #include "interpreter/templateTable.hpp" #ifndef CC_INTERP diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp index 48e0e217091..c72fafdbada 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ #ifndef CC_INTERP +class InterpreterMacroAssembler; + //------------------------------------------------------------------------------------------------------------------------ // A little wrapper class to group tosca-specific entry points into a unit. // (tosca = Top-Of-Stack CAche) diff --git a/hotspot/src/share/vm/interpreter/templateTable.cpp b/hotspot/src/share/vm/interpreter/templateTable.cpp index 05b8a069691..8449321d9f3 100644 --- a/hotspot/src/share/vm/interpreter/templateTable.cpp +++ b/hotspot/src/share/vm/interpreter/templateTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc_interface/collectedHeap.hpp" +#include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "runtime/timer.hpp" diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp index c6ea51537a2..e6d334005e1 100644 --- a/hotspot/src/share/vm/interpreter/templateTable.hpp +++ b/hotspot/src/share/vm/interpreter/templateTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,24 +28,6 @@ #include "interpreter/bytecodes.hpp" #include "memory/allocation.hpp" #include "runtime/frame.hpp" -#ifdef TARGET_ARCH_x86 -# include "interp_masm_x86.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "interp_masm_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "interp_masm_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "interp_masm_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "interp_masm_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "interp_masm_ppc_64.hpp" -#endif #ifndef CC_INTERP // All the necessary definitions used for (bytecode) template generation. Instead of @@ -53,6 +35,7 @@ // and the snippet generator, a template is assigned to each bytecode which can be // used to generate the bytecode's implementation if needed. +class InterpreterMacroAssembler; // A Template describes the properties of a code template for a given bytecode // and provides a generator to generate the code template. diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp index 47527f21e9f..2f5c0165893 100644 --- a/hotspot/src/share/vm/memory/filemap.cpp +++ b/hotspot/src/share/vm/memory/filemap.cpp @@ -30,6 +30,7 @@ #include "runtime/arguments.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" +#include "runtime/vm_version.hpp" #include "services/memTracker.hpp" #include "utilities/defaultStream.hpp" diff --git a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.hpp b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.hpp index e0dc61a73f6..a54de2bf0a3 100644 --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.hpp +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ #include "gc_implementation/shared/gcUtil.hpp" #include "oops/typeArrayOop.hpp" #include "runtime/perfData.hpp" +#include "runtime/vm_version.hpp" class GlobalTLABStats; diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp index 5c5ea1c76e2..5e26ec5e622 100644 --- a/hotspot/src/share/vm/oops/constantPool.hpp +++ b/hotspot/src/share/vm/oops/constantPool.hpp @@ -31,22 +31,8 @@ #include "oops/symbol.hpp" #include "oops/typeArrayOop.hpp" #include "runtime/handles.hpp" +#include "utilities/bytes.hpp" #include "utilities/constantTag.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif // A ConstantPool is an array containing class constants as described in the // class file. diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index 0dc0db8e946..08839267e01 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -42,21 +42,6 @@ #include "runtime/orderAccess.inline.hpp" #include "runtime/os.hpp" #include "utilities/macros.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif // Implementation of all inlined member functions defined in oop.hpp // We need a separate file to avoid circular references diff --git a/hotspot/src/share/vm/opto/ad.hpp b/hotspot/src/share/vm/opto/ad.hpp new file mode 100644 index 00000000000..29308f8b10c --- /dev/null +++ b/hotspot/src/share/vm/opto/ad.hpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + * + */ + +#ifndef SHARE_VM_OPTO_AD_HPP +#define SHARE_VM_OPTO_AD_HPP + +#ifdef TARGET_ARCH_MODEL_x86_32 +# include "adfiles/ad_x86_32.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_x86_64 +# include "adfiles/ad_x86_64.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_sparc +# include "adfiles/ad_sparc.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_zero +# include "adfiles/ad_zero.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_arm +# include "adfiles/ad_arm.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_ppc_32 +# include "adfiles/ad_ppc_32.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_ppc_64 +# include "adfiles/ad_ppc_64.hpp" +#endif + +#endif // SHARE_VM_OPTO_AD_HPP diff --git a/hotspot/src/share/vm/opto/buildOopMap.cpp b/hotspot/src/share/vm/opto/buildOopMap.cpp index 9f2dd674e2f..1fa98978f26 100644 --- a/hotspot/src/share/vm/opto/buildOopMap.cpp +++ b/hotspot/src/share/vm/opto/buildOopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "code/vmreg.inline.hpp" #include "compiler/oopMap.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" @@ -32,21 +33,6 @@ #include "opto/phase.hpp" #include "opto/regalloc.hpp" #include "opto/rootnode.hpp" -#ifdef TARGET_ARCH_x86 -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmreg_ppc.inline.hpp" -#endif // The functions in this file builds OopMaps after all scheduling is done. // diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp index dced2e00f34..795b0ec1fe5 100644 --- a/hotspot/src/share/vm/opto/c2compiler.cpp +++ b/hotspot/src/share/vm/opto/c2compiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,28 +24,8 @@ #include "precompiled.hpp" #include "opto/c2compiler.hpp" +#include "opto/optoreg.hpp" #include "opto/runtime.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif // register information defined by ADLC extern const char register_save_policy[]; diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 9c8ae35a04e..86f566c5877 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -68,27 +68,6 @@ #include "runtime/timer.hpp" #include "trace/tracing.hpp" #include "utilities/copy.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif // -------------------- Compile::mach_constant_base_node ----------------------- diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp index 4aa770d5af5..0486bf6885b 100644 --- a/hotspot/src/share/vm/opto/gcm.cpp +++ b/hotspot/src/share/vm/opto/gcm.cpp @@ -35,28 +35,6 @@ #include "opto/rootnode.hpp" #include "opto/runtime.hpp" #include "runtime/deoptimization.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif - // Portions of code courtesy of Clifford Click diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index 10daf5694f9..a601752d4cd 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,33 +24,13 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" +#include "opto/ad.hpp" #include "opto/block.hpp" #include "opto/c2compiler.hpp" #include "opto/callnode.hpp" #include "opto/cfgnode.hpp" #include "opto/machnode.hpp" #include "opto/runtime.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif // Optimization - Graph Style diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index e0a09d27ff1..8e01709fcda 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "asm/macroAssembler.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compileBroker.hpp" diff --git a/hotspot/src/share/vm/opto/locknode.hpp b/hotspot/src/share/vm/opto/locknode.hpp index 8bd6f35afd8..515a40c4663 100644 --- a/hotspot/src/share/vm/opto/locknode.hpp +++ b/hotspot/src/share/vm/opto/locknode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,27 +28,9 @@ #include "opto/node.hpp" #include "opto/opcodes.hpp" #include "opto/subnode.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif + +class BiasedLockingCounters; +class RTMLockingCounters; //------------------------------BoxLockNode------------------------------------ class BoxLockNode : public Node { diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index a8321b07753..cce4a739473 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" +#include "opto/ad.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" #include "opto/idealGraphPrinter.hpp" @@ -37,27 +38,6 @@ #include "opto/type.hpp" #include "opto/vectornode.hpp" #include "runtime/os.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif OptoReg::Name OptoReg::c_frame_pointer; diff --git a/hotspot/src/share/vm/opto/optoreg.hpp b/hotspot/src/share/vm/opto/optoreg.hpp index 0d45c7a50ab..cc383393946 100644 --- a/hotspot/src/share/vm/opto/optoreg.hpp +++ b/hotspot/src/share/vm/opto/optoreg.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,30 @@ #ifndef SHARE_VM_OPTO_OPTOREG_HPP #define SHARE_VM_OPTO_OPTOREG_HPP +// AdGlobals contains c2 specific register handling code as specified +// in the .ad files. +#ifdef TARGET_ARCH_MODEL_x86_32 +# include "adfiles/adGlobals_x86_32.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_x86_64 +# include "adfiles/adGlobals_x86_64.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_sparc +# include "adfiles/adGlobals_sparc.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_zero +# include "adfiles/adGlobals_zero.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_arm +# include "adfiles/adGlobals_arm.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_ppc_32 +# include "adfiles/adGlobals_ppc_32.hpp" +#endif +#ifdef TARGET_ARCH_MODEL_ppc_64 +# include "adfiles/adGlobals_ppc_64.hpp" +#endif + //------------------------------OptoReg---------------------------------------- // We eventually need Registers for the Real World. Registers are essentially // non-SSA names. A Register is represented as a number. Non-regular values diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index be29ce452f8..d6768a7fdf8 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,10 +30,12 @@ #include "compiler/compileBroker.hpp" #include "compiler/oopMap.hpp" #include "memory/allocation.inline.hpp" +#include "opto/ad.hpp" #include "opto/callnode.hpp" #include "opto/cfgnode.hpp" #include "opto/locknode.hpp" #include "opto/machnode.hpp" +#include "opto/optoreg.hpp" #include "opto/output.hpp" #include "opto/regalloc.hpp" #include "opto/runtime.hpp" diff --git a/hotspot/src/share/vm/opto/output.hpp b/hotspot/src/share/vm/opto/output.hpp index 298de0fec67..ab3c1a30457 100644 --- a/hotspot/src/share/vm/opto/output.hpp +++ b/hotspot/src/share/vm/opto/output.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,29 +25,9 @@ #ifndef SHARE_VM_OPTO_OUTPUT_HPP #define SHARE_VM_OPTO_OUTPUT_HPP +#include "opto/ad.hpp" #include "opto/block.hpp" #include "opto/node.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif class Arena; class Bundle; diff --git a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp index a30678dadf2..06a245a12f0 100644 --- a/hotspot/src/share/vm/opto/regmask.cpp +++ b/hotspot/src/share/vm/opto/regmask.cpp @@ -23,29 +23,9 @@ */ #include "precompiled.hpp" +#include "opto/ad.hpp" #include "opto/compile.hpp" #include "opto/regmask.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif #define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */ diff --git a/hotspot/src/share/vm/opto/regmask.hpp b/hotspot/src/share/vm/opto/regmask.hpp index ff0d0b96dc2..15f687ac38e 100644 --- a/hotspot/src/share/vm/opto/regmask.hpp +++ b/hotspot/src/share/vm/opto/regmask.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,27 +27,6 @@ #include "code/vmreg.hpp" #include "opto/optoreg.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/adGlobals_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/adGlobals_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/adGlobals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/adGlobals_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/adGlobals_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/adGlobals_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/adGlobals_ppc_64.hpp" -#endif // Some fun naming (textual) substitutions: // diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index dba4f047b5a..2a2fb131dfd 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "code/compiledIC.hpp" #include "code/icBuffer.hpp" #include "code/nmethod.hpp" @@ -45,6 +46,7 @@ #include "memory/oopFactory.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" +#include "opto/ad.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" #include "opto/cfgnode.hpp" @@ -68,27 +70,6 @@ #include "runtime/vframe_hp.hpp" #include "utilities/copy.hpp" #include "utilities/preserveException.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif // For debugging purposes: diff --git a/hotspot/src/share/vm/opto/runtime.hpp b/hotspot/src/share/vm/opto/runtime.hpp index b8ad0105dfc..b5e8bc34d98 100644 --- a/hotspot/src/share/vm/opto/runtime.hpp +++ b/hotspot/src/share/vm/opto/runtime.hpp @@ -27,6 +27,7 @@ #include "code/codeBlob.hpp" #include "opto/machnode.hpp" +#include "opto/optoreg.hpp" #include "opto/type.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/rtmLocking.hpp" diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp index e8d014430df..be70cfffd6e 100644 --- a/hotspot/src/share/vm/precompiled/precompiled.hpp +++ b/hotspot/src/share/vm/precompiled/precompiled.hpp @@ -70,6 +70,7 @@ # include "code/exceptionHandlerTable.hpp" # include "code/jvmticmlr.h" # include "code/location.hpp" +# include "code/nativeInst.hpp" # include "code/nmethod.hpp" # include "code/oopRecorder.hpp" # include "code/pcDesc.hpp" @@ -106,6 +107,7 @@ # include "interpreter/bytecodes.hpp" # include "interpreter/cppInterpreter.hpp" # include "interpreter/interpreter.hpp" +# include "interpreter/interp_masm.hpp" # include "interpreter/invocationCounter.hpp" # include "interpreter/linkResolver.hpp" # include "interpreter/templateInterpreter.hpp" @@ -228,6 +230,7 @@ # include "utilities/array.hpp" # include "utilities/bitMap.hpp" # include "utilities/bitMap.inline.hpp" +# include "utilities/bytes.hpp" # include "utilities/constantTag.hpp" # include "utilities/copy.hpp" # include "utilities/debug.hpp" @@ -250,6 +253,7 @@ # include "libadt/dict.hpp" # include "libadt/set.hpp" # include "libadt/vectset.hpp" +# include "opto/ad.hpp" # include "opto/addnode.hpp" # include "opto/adlcVMDeps.hpp" # include "opto/block.hpp" diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp index cdce2643775..73a2965004e 100644 --- a/hotspot/src/share/vm/prims/jniCheck.cpp +++ b/hotspot/src/share/vm/prims/jniCheck.cpp @@ -37,21 +37,6 @@ #include "runtime/interfaceSupport.hpp" #include "runtime/jfieldIDWorkaround.hpp" #include "runtime/thread.inline.hpp" -#ifdef TARGET_ARCH_x86 -# include "jniTypes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "jniTypes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "jniTypes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "jniTypes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "jniTypes_ppc.hpp" -#endif // Complain every extra number of unplanned local refs #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32 diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 1cd19a56332..6e03e784952 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -59,6 +59,7 @@ #include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" #include "runtime/vm_operations.hpp" +#include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/management.hpp" #include "services/threadService.hpp" diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp index 92ff86fcd6d..c6633bf34a9 100644 --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,21 +28,8 @@ #include "oops/fieldStreams.hpp" #include "prims/jvmtiClassFileReconstituter.hpp" #include "runtime/signature.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif +#include "utilities/bytes.hpp" + // FIXME: add Deprecated attribute // FIXME: fix Synthetic attribute // FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes() diff --git a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp index aeb8f58e7ca..70e9a98e30a 100644 --- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/objArrayKlass.hpp" diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index 955e34d5034..c0e4f30d2a2 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -38,6 +38,7 @@ #include "runtime/orderAccess.inline.hpp" #include "runtime/reflection.hpp" #include "runtime/synchronizer.hpp" +#include "runtime/vm_version.hpp" #include "services/threadService.hpp" #include "trace/tracing.hpp" #include "utilities/copy.hpp" diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index 15f316aa6c2..683ac097c3f 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -24,6 +24,8 @@ #include "precompiled.hpp" +#include "code/codeCache.hpp" + #include "memory/universe.hpp" #include "oops/oop.inline.hpp" @@ -37,6 +39,7 @@ #include "runtime/arguments.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/os.hpp" +#include "runtime/vm_version.hpp" #include "utilities/debug.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp index 1b97c18b7f7..5c765ec21b8 100644 --- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp +++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "code/codeCache.hpp" #include "runtime/advancedThresholdPolicy.hpp" #include "runtime/simpleThresholdPolicy.inline.hpp" diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 7accd0c0b18..9497164e819 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -38,6 +38,7 @@ #include "runtime/globals_extension.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" +#include "runtime/vm_version.hpp" #include "services/management.hpp" #include "services/memTracker.hpp" #include "utilities/defaultStream.hpp" diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp index b15664f4b52..a7ad943cf7c 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.cpp +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" +#include "code/codeCache.hpp" #include "code/debugInfoRec.hpp" #include "code/nmethod.hpp" #include "code/pcDesc.hpp" @@ -50,44 +51,6 @@ #include "runtime/vframe_hp.hpp" #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" -#ifdef TARGET_ARCH_x86 -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmreg_ppc.inline.hpp" -#endif -#ifdef COMPILER2 -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/ad_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#endif -#endif // COMPILER2 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/runtime/dtraceJSDT.cpp b/hotspot/src/share/vm/runtime/dtraceJSDT.cpp index 1a5f4fe5286..51ae25d0c34 100644 --- a/hotspot/src/share/vm/runtime/dtraceJSDT.cpp +++ b/hotspot/src/share/vm/runtime/dtraceJSDT.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "code/codeBlob.hpp" +#include "code/nativeInst.hpp" #include "memory/allocation.hpp" #include "prims/jvm.h" #include "runtime/dtraceJSDT.hpp" diff --git a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp index 67b766ae944..7e7592a5406 100644 --- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp +++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,21 +26,6 @@ #define SHARE_VM_RUNTIME_DTRACEJSDT_HPP #include "code/nmethod.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -#endif class RegisteredProbes; typedef jlong OpaqueProbes; diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp index 58cb6e89daa..aec76268824 100644 --- a/hotspot/src/share/vm/runtime/fprofiler.cpp +++ b/hotspot/src/share/vm/runtime/fprofiler.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/classLoader.hpp" +#include "code/codeCache.hpp" #include "code/vtableStubs.hpp" #include "gc_interface/collectedHeap.inline.hpp" #include "interpreter/interpreter.hpp" diff --git a/hotspot/src/share/vm/runtime/frame.cpp b/hotspot/src/share/vm/runtime/frame.cpp index 0e6d22eb01f..7c4f96824f2 100644 --- a/hotspot/src/share/vm/runtime/frame.cpp +++ b/hotspot/src/share/vm/runtime/frame.cpp @@ -23,6 +23,8 @@ */ #include "precompiled.hpp" +#include "code/codeCache.hpp" +#include "code/vmreg.inline.hpp" #include "compiler/abstractCompiler.hpp" #include "compiler/disassembler.hpp" #include "gc_interface/collectedHeap.inline.hpp" @@ -48,21 +50,6 @@ #include "runtime/thread.inline.hpp" #include "utilities/decoder.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -#endif PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp index f715f68b52d..51306dafc9c 100644 --- a/hotspot/src/share/vm/runtime/frame.hpp +++ b/hotspot/src/share/vm/runtime/frame.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,29 +30,6 @@ #include "runtime/monitorChunk.hpp" #include "runtime/registerMap.hpp" #include "utilities/top.hpp" -#ifdef COMPILER2 -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/adGlobals_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/adGlobals_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/adGlobals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/adGlobals_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/adGlobals_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/adGlobals_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/adGlobals_ppc_64.hpp" -#endif -#endif // COMPILER2 #ifdef ZERO #ifdef TARGET_ARCH_zero # include "stack_zero.hpp" diff --git a/hotspot/src/share/vm/runtime/frame.inline.hpp b/hotspot/src/share/vm/runtime/frame.inline.hpp index ce725956dee..28cd2f83a5b 100644 --- a/hotspot/src/share/vm/runtime/frame.inline.hpp +++ b/hotspot/src/share/vm/runtime/frame.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,21 +31,6 @@ #include "oops/method.hpp" #include "runtime/frame.hpp" #include "runtime/signature.hpp" -#ifdef TARGET_ARCH_x86 -# include "jniTypes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "jniTypes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "jniTypes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "jniTypes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "jniTypes_ppc.hpp" -#endif #ifdef ZERO #ifdef TARGET_ARCH_zero # include "entryFrame_zero.hpp" diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp index 3a075117afe..cfecf0a5d57 100644 --- a/hotspot/src/share/vm/runtime/java.cpp +++ b/hotspot/src/share/vm/runtime/java.cpp @@ -65,21 +65,6 @@ #include "utilities/histogram.hpp" #include "utilities/macros.hpp" #include "utilities/vmError.hpp" -#ifdef TARGET_ARCH_x86 -# include "vm_version_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vm_version_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vm_version_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vm_version_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vm_version_ppc.hpp" -#endif #if INCLUDE_ALL_GCS #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index 86bf1d6ba4d..d24c688bf13 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -27,6 +27,7 @@ #include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "gc_implementation/shared/vmGCOperations.hpp" @@ -49,6 +50,7 @@ #include "runtime/os.inline.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" +#include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/memTracker.hpp" #include "services/threadService.hpp" diff --git a/hotspot/src/share/vm/runtime/registerMap.hpp b/hotspot/src/share/vm/runtime/registerMap.hpp index b0f536fb95c..e27b745ff7c 100644 --- a/hotspot/src/share/vm/runtime/registerMap.hpp +++ b/hotspot/src/share/vm/runtime/registerMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,21 +27,6 @@ #include "code/vmreg.hpp" #include "utilities/globalDefinitions.hpp" -#ifdef TARGET_ARCH_x86 -# include "register_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "register_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "register_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "register_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "register_ppc.hpp" -#endif class JavaThread; diff --git a/hotspot/src/share/vm/runtime/relocator.hpp b/hotspot/src/share/vm/runtime/relocator.hpp index bbc0600f739..6ea9ab4c819 100644 --- a/hotspot/src/share/vm/runtime/relocator.hpp +++ b/hotspot/src/share/vm/runtime/relocator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,21 +27,7 @@ #include "interpreter/bytecodes.hpp" #include "oops/method.hpp" -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif +#include "utilities/bytes.hpp" // This code has been converted from the 1.1E java virtual machine // Thanks to the JavaTopics group for using the code diff --git a/hotspot/src/share/vm/runtime/rframe.cpp b/hotspot/src/share/vm/runtime/rframe.cpp index c52d16ff3d5..f3ef5504b37 100644 --- a/hotspot/src/share/vm/runtime/rframe.cpp +++ b/hotspot/src/share/vm/runtime/rframe.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "code/codeCache.hpp" #include "interpreter/interpreter.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index b0dc8863e83..05bb2224a53 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -56,26 +56,6 @@ #include "services/runtimeService.hpp" #include "utilities/events.hpp" #include "utilities/macros.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -# include "vmreg_ppc.inline.hpp" -#endif #if INCLUDE_ALL_GCS #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" #include "gc_implementation/shared/suspendibleThreadSet.hpp" diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index c717e61c8c6..1656cdc1cd5 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "code/compiledIC.hpp" #include "code/scopeDesc.hpp" #include "code/vtableStubs.hpp" @@ -59,26 +60,6 @@ #include "utilities/hashtable.inline.hpp" #include "utilities/macros.hpp" #include "utilities/xmlstream.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -# include "vmreg_ppc.inline.hpp" -#endif #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" #endif diff --git a/hotspot/src/share/vm/runtime/stackValueCollection.cpp b/hotspot/src/share/vm/runtime/stackValueCollection.cpp index 3794f64d78c..fdf448b3718 100644 --- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp +++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp @@ -24,21 +24,6 @@ #include "precompiled.hpp" #include "runtime/stackValueCollection.hpp" -#ifdef TARGET_ARCH_x86 -# include "jniTypes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "jniTypes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "jniTypes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "jniTypes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "jniTypes_ppc.hpp" -#endif PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp index 082cc4ec45e..55fda6fb3f9 100644 --- a/hotspot/src/share/vm/runtime/statSampler.cpp +++ b/hotspot/src/share/vm/runtime/statSampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,21 +33,7 @@ #include "runtime/javaCalls.hpp" #include "runtime/os.hpp" #include "runtime/statSampler.hpp" -#ifdef TARGET_ARCH_x86 -# include "vm_version_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vm_version_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vm_version_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vm_version_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vm_version_ppc.hpp" -#endif +#include "runtime/vm_version.hpp" // -------------------------------------------------------- // StatSamplerTask diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp index 78381168fc4..46d93a52916 100644 --- a/hotspot/src/share/vm/runtime/stubRoutines.hpp +++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp @@ -31,21 +31,6 @@ #include "runtime/mutexLocker.hpp" #include "runtime/stubCodeGenerator.hpp" #include "utilities/top.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -#endif // StubRoutines provides entry points to assembly routines used by // compiled code and the run-time system. Platform-specific entry diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 9a2cbca09e0..69c2326a6ff 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -27,6 +27,7 @@ #include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "code/scopeDesc.hpp" #include "compiler/compileBroker.hpp" #include "interpreter/interpreter.hpp" @@ -74,6 +75,7 @@ #include "runtime/vframe_hp.hpp" #include "runtime/vmThread.hpp" #include "runtime/vm_operations.hpp" +#include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/management.hpp" #include "services/memTracker.hpp" diff --git a/hotspot/src/share/vm/runtime/vframeArray.cpp b/hotspot/src/share/vm/runtime/vframeArray.cpp index 72e2e8717cb..e35114bb619 100644 --- a/hotspot/src/share/vm/runtime/vframeArray.cpp +++ b/hotspot/src/share/vm/runtime/vframeArray.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/vmSymbols.hpp" +#include "code/vmreg.inline.hpp" #include "interpreter/bytecode.hpp" #include "interpreter/interpreter.hpp" #include "memory/allocation.inline.hpp" diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 33fe915e7fe..3ff41705843 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -193,33 +193,13 @@ #include "opto/movenode.hpp" #include "opto/narrowptrnode.hpp" #include "opto/opaquenode.hpp" +#include "opto/optoreg.hpp" #include "opto/phaseX.hpp" #include "opto/parse.hpp" #include "opto/regalloc.hpp" #include "opto/rootnode.hpp" #include "opto/subnode.hpp" #include "opto/vectornode.hpp" -#ifdef TARGET_ARCH_MODEL_x86_32 -# include "adfiles/adGlobals_x86_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_x86_64 -# include "adfiles/adGlobals_x86_64.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_sparc -# include "adfiles/adGlobals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_zero -# include "adfiles/adGlobals_zero.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_arm -# include "adfiles/adGlobals_arm.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/adGlobals_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/adGlobals_ppc_64.hpp" -#endif #endif // COMPILER2 // Note: the cross-product of (c1, c2, product, nonproduct, ...), diff --git a/hotspot/src/share/vm/runtime/vm_operations.cpp b/hotspot/src/share/vm/runtime/vm_operations.cpp index 6f27fe3fecc..2e913c5015f 100644 --- a/hotspot/src/share/vm/runtime/vm_operations.cpp +++ b/hotspot/src/share/vm/runtime/vm_operations.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/symbolTable.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" #include "compiler/compilerOracle.hpp" #include "gc_implementation/shared/isGCActiveMark.hpp" diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp index a1779a85fe2..b5e3c674228 100644 --- a/hotspot/src/share/vm/runtime/vm_version.cpp +++ b/hotspot/src/share/vm/runtime/vm_version.cpp @@ -26,21 +26,7 @@ #include "memory/universe.hpp" #include "oops/oop.inline.hpp" #include "runtime/arguments.hpp" -#ifdef TARGET_ARCH_x86 -# include "vm_version_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vm_version_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vm_version_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vm_version_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vm_version_ppc.hpp" -#endif +#include "runtime/vm_version.hpp" const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release(); const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string(); diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp index 27a5717d383..96d2bf5e683 100644 --- a/hotspot/src/share/vm/runtime/vm_version.hpp +++ b/hotspot/src/share/vm/runtime/vm_version.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -123,4 +123,20 @@ class Abstract_VM_Version: AllStatic { static unsigned int calc_parallel_worker_threads(); }; +#ifdef TARGET_ARCH_x86 +# include "vm_version_x86.hpp" +#endif +#ifdef TARGET_ARCH_sparc +# include "vm_version_sparc.hpp" +#endif +#ifdef TARGET_ARCH_zero +# include "vm_version_zero.hpp" +#endif +#ifdef TARGET_ARCH_arm +# include "vm_version_arm.hpp" +#endif +#ifdef TARGET_ARCH_ppc +# include "vm_version_ppc.hpp" +#endif + #endif // SHARE_VM_RUNTIME_VM_VERSION_HPP diff --git a/hotspot/src/share/vm/services/diagnosticCommand.hpp b/hotspot/src/share/vm/services/diagnosticCommand.hpp index 7a6d3402809..73e8673dddb 100644 --- a/hotspot/src/share/vm/services/diagnosticCommand.hpp +++ b/hotspot/src/share/vm/services/diagnosticCommand.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,17 +25,16 @@ #ifndef SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP #define SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP -#include "runtime/arguments.hpp" #include "classfile/vmSymbols.hpp" -#include "utilities/ostream.hpp" -#include "runtime/vm_version.hpp" -#include "runtime/vmThread.hpp" +#include "runtime/arguments.hpp" #include "runtime/os.hpp" +#include "runtime/vmThread.hpp" #include "services/diagnosticArgument.hpp" #include "services/diagnosticCommand.hpp" -#include "services/diagnosticFramework.hpp" #include "services/diagnosticCommand_ext.hpp" +#include "services/diagnosticFramework.hpp" #include "utilities/macros.hpp" +#include "utilities/ostream.hpp" class HelpDCmd : public DCmdWithParser { protected: diff --git a/hotspot/src/share/vm/services/diagnosticFramework.hpp b/hotspot/src/share/vm/services/diagnosticFramework.hpp index ca60f53ebc8..4c9fe98da9d 100644 --- a/hotspot/src/share/vm/services/diagnosticFramework.hpp +++ b/hotspot/src/share/vm/services/diagnosticFramework.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ #include "memory/allocation.hpp" #include "runtime/arguments.hpp" #include "runtime/os.hpp" -#include "runtime/vm_version.hpp" #include "runtime/vmThread.hpp" #include "utilities/ostream.hpp" diff --git a/hotspot/src/share/vm/utilities/bytes.hpp b/hotspot/src/share/vm/utilities/bytes.hpp new file mode 100644 index 00000000000..7da269a4775 --- /dev/null +++ b/hotspot/src/share/vm/utilities/bytes.hpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + * + */ + +#ifndef SHARE_VM_UTILITIES_BYTES_HPP +#define SHARE_VM_UTILITIES_BYTES_HPP + +#ifdef TARGET_ARCH_x86 +# include "bytes_x86.hpp" +#endif +#ifdef TARGET_ARCH_sparc +# include "bytes_sparc.hpp" +#endif +#ifdef TARGET_ARCH_zero +# include "bytes_zero.hpp" +#endif +#ifdef TARGET_ARCH_arm +# include "bytes_arm.hpp" +#endif +#ifdef TARGET_ARCH_ppc +# include "bytes_ppc.hpp" +#endif + +#endif // SHARE_VM_UTILITIES_BYTES_HPP diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index 0fc7d6af3a1..58e84e23a16 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -48,6 +48,7 @@ #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" +#include "runtime/vm_version.hpp" #include "services/heapDumper.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp index 4a807a0662d..59943c4b161 100644 --- a/hotspot/src/share/vm/utilities/ostream.cpp +++ b/hotspot/src/share/vm/utilities/ostream.cpp @@ -28,6 +28,7 @@ #include "oops/oop.inline.hpp" #include "runtime/arguments.hpp" #include "runtime/os.hpp" +#include "runtime/vm_version.hpp" #include "utilities/defaultStream.hpp" #include "utilities/ostream.hpp" #include "utilities/top.hpp" diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp index d18df9ad4e3..2d2d4284260 100644 --- a/hotspot/src/share/vm/utilities/vmError.cpp +++ b/hotspot/src/share/vm/utilities/vmError.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" #include "gc_interface/collectedHeap.hpp" #include "prims/whitebox.hpp" From f429e5b86c1bccd0472d42777b5d98b166cc14e3 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 11 Jul 2014 12:08:43 +0400 Subject: [PATCH 15/94] 8049198: [macosx] Incorrect thread access when showing splash screen Reviewed-by: serb, pchelko --- .../native/sun/awt/splashscreen/splashscreen_sys.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m index affb6577d64..25b00545a74 100644 --- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m +++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m @@ -45,6 +45,7 @@ #include #include +#import "ThreadUtilities.h" static NSScreen* SplashNSScreen() { @@ -130,8 +131,12 @@ char* SplashGetScaledImageName(const char* jar, const char* file, NSAutoreleasePool *pool = [NSAutoreleasePool new]; *scaleFactor = 1; char* scaledFile = nil; - float screenScaleFactor = [SplashNSScreen() backingScaleFactor]; - + __block float screenScaleFactor = 1; + + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + screenScaleFactor = [SplashNSScreen() backingScaleFactor]; + }]; + if (screenScaleFactor > 1) { NSString *fileName = [NSString stringWithUTF8String: file]; NSUInteger length = [fileName length]; From a3d9307fb978fa1641c43e24c048689e10cb30a4 Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Fri, 11 Jul 2014 12:51:14 +0400 Subject: [PATCH 16/94] 8037511: Tidy warnings cleanup for java.awt - 2d part Reviewed-by: prr --- jdk/src/share/classes/java/awt/Color.java | 4 ++-- jdk/src/share/classes/java/awt/Font.java | 3 +-- jdk/src/share/classes/java/awt/Graphics.java | 4 ++-- jdk/src/share/classes/java/awt/Polygon.java | 4 ++-- jdk/src/share/classes/java/awt/Rectangle.java | 11 +++++------ .../share/classes/java/awt/color/ColorSpace.java | 10 +++++----- .../classes/java/awt/color/ICC_ColorSpace.java | 10 +++++----- .../share/classes/java/awt/font/TextAttribute.java | 2 +- jdk/src/share/classes/java/awt/geom/Arc2D.java | 6 +++--- .../classes/java/awt/image/AffineTransformOp.java | 2 +- .../classes/java/awt/image/BufferedImageFilter.java | 4 ++-- .../share/classes/java/awt/image/ImageFilter.java | 2 +- .../classes/java/awt/image/WritableRaster.java | 4 ++-- .../share/classes/java/awt/print/PrinterJob.java | 1 - jdk/src/share/classes/javax/imageio/package.html | 4 ++-- jdk/src/share/classes/javax/print/Doc.java | 6 +++--- jdk/src/share/classes/javax/print/DocFlavor.java | 13 ++----------- jdk/src/share/classes/javax/print/PrintService.java | 3 +-- .../classes/javax/print/PrintServiceLookup.java | 4 +--- jdk/src/share/classes/javax/print/ServiceUI.java | 5 ++--- .../share/classes/javax/print/ServiceUIFactory.java | 4 ++-- jdk/src/share/classes/javax/print/SimpleDoc.java | 6 +++--- .../javax/print/StreamPrintServiceFactory.java | 6 +++--- .../classes/javax/print/attribute/Attribute.java | 3 +-- .../javax/print/attribute/DateTimeSyntax.java | 3 +-- .../classes/javax/print/attribute/DocAttribute.java | 3 +-- .../javax/print/attribute/DocAttributeSet.java | 3 +-- .../classes/javax/print/attribute/EnumSyntax.java | 3 +-- .../javax/print/attribute/HashAttributeSet.java | 1 - .../javax/print/attribute/HashDocAttributeSet.java | 3 +-- .../print/attribute/HashPrintJobAttributeSet.java | 3 +-- .../attribute/HashPrintRequestAttributeSet.java | 3 +-- .../attribute/HashPrintServiceAttributeSet.java | 3 +-- .../javax/print/attribute/IntegerSyntax.java | 3 +-- .../javax/print/attribute/PrintJobAttribute.java | 3 +-- .../javax/print/attribute/PrintJobAttributeSet.java | 3 +-- .../print/attribute/PrintRequestAttribute.java | 3 +-- .../print/attribute/PrintRequestAttributeSet.java | 3 +-- .../print/attribute/PrintServiceAttribute.java | 3 +-- .../print/attribute/PrintServiceAttributeSet.java | 3 +-- .../javax/print/attribute/ResolutionSyntax.java | 3 +-- .../javax/print/attribute/SetOfIntegerSyntax.java | 3 +-- .../classes/javax/print/attribute/Size2DSyntax.java | 3 +-- .../print/attribute/SupportedValuesAttribute.java | 3 +-- .../classes/javax/print/attribute/TextSyntax.java | 3 +-- .../classes/javax/print/attribute/URISyntax.java | 3 +-- .../classes/javax/print/attribute/package.html | 4 ++-- .../print/attribute/standard/ColorSupported.java | 3 +-- .../javax/print/attribute/standard/Compression.java | 1 - .../print/attribute/standard/CopiesSupported.java | 3 +-- .../attribute/standard/DateTimeAtCompleted.java | 3 +-- .../attribute/standard/DateTimeAtCreation.java | 3 +-- .../attribute/standard/DateTimeAtProcessing.java | 3 +-- .../javax/print/attribute/standard/Destination.java | 3 +-- .../attribute/standard/DialogTypeSelection.java | 5 ++--- .../print/attribute/standard/DocumentName.java | 3 +-- .../print/attribute/standard/JobHoldUntil.java | 3 +-- .../print/attribute/standard/JobImpressions.java | 3 +-- .../attribute/standard/JobImpressionsCompleted.java | 3 +-- .../attribute/standard/JobImpressionsSupported.java | 3 +-- .../javax/print/attribute/standard/JobKOctets.java | 3 +-- .../attribute/standard/JobKOctetsProcessed.java | 3 +-- .../attribute/standard/JobKOctetsSupported.java | 3 +-- .../print/attribute/standard/JobMediaSheets.java | 3 +-- .../attribute/standard/JobMediaSheetsCompleted.java | 3 +-- .../attribute/standard/JobMediaSheetsSupported.java | 3 +-- .../attribute/standard/JobMessageFromOperator.java | 3 +-- .../javax/print/attribute/standard/JobName.java | 3 +-- .../attribute/standard/JobOriginatingUserName.java | 3 +-- .../javax/print/attribute/standard/JobPriority.java | 3 +-- .../attribute/standard/JobPrioritySupported.java | 3 +-- .../javax/print/attribute/standard/JobSheets.java | 1 - .../javax/print/attribute/standard/JobState.java | 3 +-- .../print/attribute/standard/JobStateReason.java | 1 - .../print/attribute/standard/JobStateReasons.java | 1 - .../javax/print/attribute/standard/Media.java | 3 +-- .../javax/print/attribute/standard/MediaSize.java | 3 +-- .../print/attribute/standard/NumberOfDocuments.java | 3 +-- .../attribute/standard/NumberOfInterveningJobs.java | 3 +-- .../print/attribute/standard/NumberUpSupported.java | 3 +-- .../attribute/standard/OrientationRequested.java | 3 +-- .../attribute/standard/OutputDeviceAssigned.java | 3 +-- .../attribute/standard/PDLOverrideSupported.java | 1 - .../print/attribute/standard/PagesPerMinute.java | 3 +-- .../attribute/standard/PagesPerMinuteColor.java | 3 +-- .../attribute/standard/PresentationDirection.java | 3 +-- .../print/attribute/standard/PrintQuality.java | 1 - .../javax/print/attribute/standard/PrinterInfo.java | 3 +-- .../attribute/standard/PrinterIsAcceptingJobs.java | 3 +-- .../print/attribute/standard/PrinterLocation.java | 3 +-- .../attribute/standard/PrinterMakeAndModel.java | 3 +-- .../standard/PrinterMessageFromOperator.java | 3 +-- .../print/attribute/standard/PrinterMoreInfo.java | 3 +-- .../standard/PrinterMoreInfoManufacturer.java | 3 +-- .../javax/print/attribute/standard/PrinterName.java | 3 +-- .../print/attribute/standard/PrinterResolution.java | 3 +-- .../print/attribute/standard/PrinterState.java | 3 +-- .../attribute/standard/PrinterStateReason.java | 1 - .../attribute/standard/PrinterStateReasons.java | 3 +-- .../javax/print/attribute/standard/PrinterURI.java | 3 +-- .../print/attribute/standard/QueuedJobCount.java | 3 +-- .../standard/ReferenceUriSchemesSupported.java | 3 +-- .../attribute/standard/RequestingUserName.java | 3 +-- .../javax/print/attribute/standard/Severity.java | 3 +-- .../print/attribute/standard/SheetCollate.java | 3 +-- .../javax/print/attribute/standard/package.html | 4 ++-- .../share/classes/javax/print/event/package.html | 4 ++-- jdk/src/share/classes/javax/print/package.html | 4 ++-- 108 files changed, 133 insertions(+), 230 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Color.java b/jdk/src/share/classes/java/awt/Color.java index e80e991aa15..3a94d73ac74 100644 --- a/jdk/src/share/classes/java/awt/Color.java +++ b/jdk/src/share/classes/java/awt/Color.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ import java.awt.color.ColorSpace; * see * http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html * . - *

+ * * @version 10 Feb 1997 * @author Sami Shaio * @author Arthur van Hoff diff --git a/jdk/src/share/classes/java/awt/Font.java b/jdk/src/share/classes/java/awt/Font.java index 41d143522dc..d9faf3d3e80 100644 --- a/jdk/src/share/classes/java/awt/Font.java +++ b/jdk/src/share/classes/java/awt/Font.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -542,7 +542,6 @@ public class Font implements java.io.Serializable * compatible alternative, then the font system will map the Font * instance to "Dialog", such that for example, the family as reported * by {@link #getFamily() getFamily} will be "Dialog". - *

* * @param name the font name. This can be a font face name or a font * family name, and may represent either a logical font or a physical diff --git a/jdk/src/share/classes/java/awt/Graphics.java b/jdk/src/share/classes/java/awt/Graphics.java index 4f03e1c61dd..3be860cab31 100644 --- a/jdk/src/share/classes/java/awt/Graphics.java +++ b/jdk/src/share/classes/java/awt/Graphics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,7 +151,7 @@ public abstract class Graphics { * is specified by the width and height * arguments. * - *

+ * * @param x the x coordinate. * @param y the y coordinate. * @param width the width of the clipping rectangle. diff --git a/jdk/src/share/classes/java/awt/Polygon.java b/jdk/src/share/classes/java/awt/Polygon.java index e714428c0d1..0d89e6045be 100644 --- a/jdk/src/share/classes/java/awt/Polygon.java +++ b/jdk/src/share/classes/java/awt/Polygon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -351,7 +351,7 @@ public class Polygon implements Shape, java.io.Serializable { /** * Determines whether the specified coordinates are inside this * Polygon. - *

+ * * @param x the specified X coordinate to be tested * @param y the specified Y coordinate to be tested * @return {@code true} if this {@code Polygon} contains diff --git a/jdk/src/share/classes/java/awt/Rectangle.java b/jdk/src/share/classes/java/awt/Rectangle.java index d64deaf2f0e..727fe8e7ba8 100644 --- a/jdk/src/share/classes/java/awt/Rectangle.java +++ b/jdk/src/share/classes/java/awt/Rectangle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,14 +41,13 @@ import java.beans.Transient; *

* * A {@code Rectangle} whose width or height is exactly zero has location - * along those axes with zero dimension, but is otherwise considered empty. + * along those axes with zero dimension, but is otherwise considered empty. * The {@link #isEmpty} method will return true for such a {@code Rectangle}. * Methods which test if an empty {@code Rectangle} contains or intersects * a point or rectangle will always return false if either dimension is zero. * Methods which combine such a {@code Rectangle} with a point or rectangle * will include the location of the {@code Rectangle} on that axis in the * result as if the {@link #add(Point)} method were being called. - * *

* * A {@code Rectangle} whose width or height is negative has neither @@ -422,7 +421,7 @@ public class Rectangle extends Rectangle2D * Rectangle to the specified * x, y, width, * and height. - *

+ * * @param x the new X coordinate for the upper-left * corner of this Rectangle * @param y the new Y coordinate for the upper-left @@ -488,7 +487,7 @@ public class Rectangle extends Rectangle2D /** * Moves this Rectangle to the specified location. - *

+ * * @param x the X coordinate of the new location * @param y the Y coordinate of the new location * @deprecated As of JDK version 1.1, @@ -629,7 +628,7 @@ public class Rectangle extends Rectangle2D /** * Sets the size of this Rectangle to the specified * width and height. - *

+ * * @param width the new width for this Rectangle * @param height the new height for this Rectangle * @deprecated As of JDK version 1.1, diff --git a/jdk/src/share/classes/java/awt/color/ColorSpace.java b/jdk/src/share/classes/java/awt/color/ColorSpace.java index ac21273d415..08feedd844e 100644 --- a/jdk/src/share/classes/java/awt/color/ColorSpace.java +++ b/jdk/src/share/classes/java/awt/color/ColorSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -388,7 +388,7 @@ public abstract class ColorSpace implements java.io.Serializable { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

+ * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace * @return a float array of length 3 @@ -412,7 +412,7 @@ public abstract class ColorSpace implements java.io.Serializable { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

+ * * @param rgbvalue a float array with length of at least 3 * @return a float array with length equal to the number of * components in this ColorSpace @@ -439,7 +439,7 @@ public abstract class ColorSpace implements java.io.Serializable { * that would be measured using current CIE recommended practices. * See the {@link ICC_ColorSpace#toCIEXYZ(float[]) toCIEXYZ} method of * ICC_ColorSpace for further information. - *

+ * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace * @return a float array of length 3 @@ -467,7 +467,7 @@ public abstract class ColorSpace implements java.io.Serializable { * relative values before being passed to this method. * See the {@link ICC_ColorSpace#fromCIEXYZ(float[]) fromCIEXYZ} method of * ICC_ColorSpace for further information. - *

+ * * @param colorvalue a float array with length of at least 3 * @return a float array with length equal to the number of * components in this ColorSpace diff --git a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java index ee2ed1a43a5..c64177658f1 100644 --- a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java +++ b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -149,7 +149,7 @@ public class ICC_ColorSpace extends ColorSpace { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

+ * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace. * @return a float array of length 3. @@ -201,7 +201,7 @@ public class ICC_ColorSpace extends ColorSpace { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

+ * * @param rgbvalue a float array with length of at least 3. * @return a float array with length equal to the number of * components in this ColorSpace. @@ -336,7 +336,7 @@ public class ICC_ColorSpace extends ColorSpace { * will result in a measured device XYZ value of D65. This will not * be the same as the media white point tag XYZ value in the ICC * profile for an sRGB device. - *

+ * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace. * @return a float array of length 3. @@ -480,7 +480,7 @@ public class ICC_ColorSpace extends ColorSpace { * will result in a measured device XYZ value of D65. This will not * be the same as the media white point tag XYZ value in the ICC * profile for an sRGB device. - *

+ * * @param colorvalue a float array with length of at least 3. * @return a float array with length equal to the number of * components in this ColorSpace. diff --git a/jdk/src/share/classes/java/awt/font/TextAttribute.java b/jdk/src/share/classes/java/awt/font/TextAttribute.java index 3a7714ba1dd..280e1934693 100644 --- a/jdk/src/share/classes/java/awt/font/TextAttribute.java +++ b/jdk/src/share/classes/java/awt/font/TextAttribute.java @@ -96,7 +96,7 @@ import sun.misc.SharedSecrets; * * *

Summary of attributes

- * * diff --git a/jdk/src/share/classes/java/awt/geom/Arc2D.java b/jdk/src/share/classes/java/awt/geom/Arc2D.java index 3d92306f618..be51e8a4bc3 100644 --- a/jdk/src/share/classes/java/awt/geom/Arc2D.java +++ b/jdk/src/share/classes/java/awt/geom/Arc2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ import java.io.Serializable; *

* * The arc is a partial section of a full ellipse which - * inscribes the framing rectangle of its parent {@link RectangularShape}. - * + * inscribes the framing rectangle of its parent {@link RectangularShape}. + * * * The angles are specified relative to the non-square * framing rectangle such that 45 degrees always falls on the line from diff --git a/jdk/src/share/classes/java/awt/image/AffineTransformOp.java b/jdk/src/share/classes/java/awt/image/AffineTransformOp.java index 9e6a66eea5c..d9216606b73 100644 --- a/jdk/src/share/classes/java/awt/image/AffineTransformOp.java +++ b/jdk/src/share/classes/java/awt/image/AffineTransformOp.java @@ -324,7 +324,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { * this part of the rectangle is not drawn. If the coordinates * of the rectangle are positive then the filtered image is drawn at * that position in the destination Raster. - *

+ * * @param src The Raster to transform. * @param dst The Raster in which to store the results of the * transformation. diff --git a/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java b/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java index bac63a8f066..e848fd9c206 100644 --- a/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java +++ b/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,7 +85,7 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { * an image should avoid calling this method directly since that * operation could result in problems with retrieving the requested * pixels. - *

+ * * @param width the width to which to set the width of this * BufferedImageFilter * @param height the height to which to set the height of this diff --git a/jdk/src/share/classes/java/awt/image/ImageFilter.java b/jdk/src/share/classes/java/awt/image/ImageFilter.java index 33198346e03..04077b6d6a5 100644 --- a/jdk/src/share/classes/java/awt/image/ImageFilter.java +++ b/jdk/src/share/classes/java/awt/image/ImageFilter.java @@ -225,7 +225,7 @@ public class ImageFilter implements ImageConsumer, Cloneable { * *

  • * Override the method to simply send the data. - * This is appropriate if the filter can handle the request itself — + * This is appropriate if the filter can handle the request itself — * for example, * if the generated pixels have been saved in some sort of buffer. * diff --git a/jdk/src/share/classes/java/awt/image/WritableRaster.java b/jdk/src/share/classes/java/awt/image/WritableRaster.java index 6ad950288ee..65ff74aa4f9 100644 --- a/jdk/src/share/classes/java/awt/image/WritableRaster.java +++ b/jdk/src/share/classes/java/awt/image/WritableRaster.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -394,7 +394,7 @@ public class WritableRaster extends Raster { * is first converted to a 32-bit int (if necessary), using the above * rules for integral types, and then the int is cast to float or * double. - *

    + * * @param srcRaster The Raster from which to copy pixels. * * @throws NullPointerException if srcRaster is null. diff --git a/jdk/src/share/classes/java/awt/print/PrinterJob.java b/jdk/src/share/classes/java/awt/print/PrinterJob.java index 0c80d1490d4..41d39ce10ec 100644 --- a/jdk/src/share/classes/java/awt/print/PrinterJob.java +++ b/jdk/src/share/classes/java/awt/print/PrinterJob.java @@ -546,7 +546,6 @@ public abstract class PrinterJob { * user settings returned from * printDialog(PrintRequestAttributeSet attributes to * this print() method. - *

    * * @param attributes a set of attributes for the job * @exception PrinterException an error in the print system diff --git a/jdk/src/share/classes/javax/imageio/package.html b/jdk/src/share/classes/javax/imageio/package.html index f0927fa147b..f8254b11284 100644 --- a/jdk/src/share/classes/javax/imageio/package.html +++ b/jdk/src/share/classes/javax/imageio/package.html @@ -131,8 +131,8 @@ standard plug-ins.

  • the number of bands is 1;
  • the number of bits per sample is not greater than 8;
  • the size of a color component is not greater than 8; -

    - + +

    By default the GIF writer plug-in creates version "89a" images. This can be changed to "87a" by explicitly setting the version in the diff --git a/jdk/src/share/classes/javax/print/Doc.java b/jdk/src/share/classes/javax/print/Doc.java index d28a3e565ef..873aac594a6 100644 --- a/jdk/src/share/classes/javax/print/Doc.java +++ b/jdk/src/share/classes/javax/print/Doc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -168,7 +168,7 @@ public interface Doc { * from the print data representation object. * However, if the print data representation object is itself a Reader, * then the print data representation object is simply returned. - *

    + * * @return Reader for reading the print data characters from this doc. * If a reader cannot be provided because this doc does not meet * the criteria stated above, null is returned. @@ -192,7 +192,7 @@ public interface Doc { * object as a stream of bytes is created and returned. However, if the * print data representation object is itself an input stream, then the * print data representation object is simply returned. - *

    + * * @return Input stream for reading the print data bytes from this doc. If * an input stream cannot be provided because this doc does not * meet the criteria stated above, null is returned. diff --git a/jdk/src/share/classes/javax/print/DocFlavor.java b/jdk/src/share/classes/javax/print/DocFlavor.java index eac9d38954d..cb00e00753b 100644 --- a/jdk/src/share/classes/javax/print/DocFlavor.java +++ b/jdk/src/share/classes/javax/print/DocFlavor.java @@ -381,7 +381,6 @@ import java.io.Serializable; *

  • * A line feed (LF) character standing by itself means * "go to column 1 of the next line." - *
  • * *

    * The client must itself perform all plain text print data formatting not @@ -436,7 +435,6 @@ import java.io.Serializable; * Java Print Service instance supports without having * to load the representation classes, which may be problematic for * limited-resource clients. - *

    * * @author Alan Kaminsky */ @@ -536,7 +534,7 @@ public class DocFlavor implements Serializable, Cloneable { * The charset for text types is a commonly useful example. * This convenience method will return the value of the specified * parameter if one was specified in the mime type for this flavor. - *

    + * * @param paramName the name of the paramater. This name is internally * converted to the canonical lower case format before performing * the match. @@ -638,7 +636,6 @@ public class DocFlavor implements Serializable, Cloneable { * Class DocFlavor.BYTE_ARRAY provides predefined static constant * DocFlavor objects for example doc flavors using a byte array * (byte[]) as the print data representation class. - *

    * * @author Alan Kaminsky */ @@ -836,7 +833,6 @@ public class DocFlavor implements Serializable, Cloneable { * DocFlavor objects for example doc flavors using a byte stream ({@link * java.io.InputStream java.io.InputStream}) as the print * data representation class. - *

    * * @author Alan Kaminsky */ @@ -1038,8 +1034,7 @@ public class DocFlavor implements Serializable, Cloneable { * objects. * For example doc flavors using a Uniform Resource Locator ({@link * java.net.URL java.net.URL}) as the print data - * representation class. - *

    + * representation class. * * @author Alan Kaminsky */ @@ -1229,7 +1224,6 @@ public class DocFlavor implements Serializable, Cloneable { * DocFlavor objects for example doc flavors using a character array * (char[]) as the print data representation class. As such, * the character set is Unicode. - *

    * * @author Alan Kaminsky */ @@ -1279,7 +1273,6 @@ public class DocFlavor implements Serializable, Cloneable { * objects for example doc flavors using a string ({@link java.lang.String * java.lang.String}) as the print data representation class. * As such, the character set is Unicode. - *

    * * @author Alan Kaminsky */ @@ -1327,7 +1320,6 @@ public class DocFlavor implements Serializable, Cloneable { * objects for example doc flavors using a character stream ({@link * java.io.Reader java.io.Reader}) as the print data * representation class. As such, the character set is Unicode. - *

    * * @author Alan Kaminsky */ @@ -1376,7 +1368,6 @@ public class DocFlavor implements Serializable, Cloneable { * Class DocFlavor.SERVICE_FORMATTED provides predefined static constant * DocFlavor objects for example doc flavors for service formatted print * data. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/PrintService.java b/jdk/src/share/classes/javax/print/PrintService.java index f52eb72a0d2..a003e730880 100644 --- a/jdk/src/share/classes/javax/print/PrintService.java +++ b/jdk/src/share/classes/javax/print/PrintService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -327,7 +327,6 @@ public interface PrintService { * that indicates bounds on the legal values -- used, for example, by an * integer-valued attribute that must lie within a certain range. * - *

    * * @param category Printing attribute category to test. It must be a * {@link java.lang.Class Class} that implements diff --git a/jdk/src/share/classes/javax/print/PrintServiceLookup.java b/jdk/src/share/classes/javax/print/PrintServiceLookup.java index aece5d1205a..70695a995f8 100644 --- a/jdk/src/share/classes/javax/print/PrintServiceLookup.java +++ b/jdk/src/share/classes/javax/print/PrintServiceLookup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -199,7 +199,6 @@ public abstract class PrintServiceLookup { * available that is not part of the installation. * If the lookup service is already registered, or cannot be registered, * the method returns false. - *

    * * @param sp an implementation of a lookup service. * @return true if the new lookup service is newly @@ -305,7 +304,6 @@ public abstract class PrintServiceLookup { *

    * Locates MultiDoc print services which can be positively confirmed * to support the combination of attributes and DocFlavors specified. - *

    * * @param flavors of documents required. If null or empty it is ignored. * @param attributes required to be supported. If null this diff --git a/jdk/src/share/classes/javax/print/ServiceUI.java b/jdk/src/share/classes/javax/print/ServiceUI.java index 20b23611ed1..c6ba370a064 100644 --- a/jdk/src/share/classes/javax/print/ServiceUI.java +++ b/jdk/src/share/classes/javax/print/ServiceUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,8 +131,7 @@ public class ServiceUI { * } * } * } - *

    - + * * @param gc used to select screen. null means primary or default screen. * @param x location of dialog including border in screen coordinates * @param y location of dialog including border in screen coordinates diff --git a/jdk/src/share/classes/javax/print/ServiceUIFactory.java b/jdk/src/share/classes/javax/print/ServiceUIFactory.java index d293a8cadc7..06deb02e5e8 100644 --- a/jdk/src/share/classes/javax/print/ServiceUIFactory.java +++ b/jdk/src/share/classes/javax/print/ServiceUIFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ public abstract class ServiceUIFactory { /** * Get a UI object which may be cast to the requested UI type * by the application and used in its user interface. - *

    + * * @param role requested. Must be one of the standard roles or * a private role supported by this factory. * @param ui type in which the role is requested. diff --git a/jdk/src/share/classes/javax/print/SimpleDoc.java b/jdk/src/share/classes/javax/print/SimpleDoc.java index 3cf0d779086..f73d794f76b 100644 --- a/jdk/src/share/classes/javax/print/SimpleDoc.java +++ b/jdk/src/share/classes/javax/print/SimpleDoc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -176,7 +176,7 @@ public final class SimpleDoc implements Doc { * However, if the print data representation object is itself a * Reader then the print data representation object is * simply returned. - *

    + * * @return a Reader for reading the print data * characters from this doc. * If a reader cannot be provided because this doc does not meet @@ -224,7 +224,7 @@ public final class SimpleDoc implements Doc { * However, if the print data representation object is itself an * input stream then the print data representation object is simply * returned. - *

    + * * @return an InputStream for reading the print data * bytes from this doc. If an input stream cannot be * provided because this doc does not meet diff --git a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java index dfa91a70fcb..f1f7f28c410 100644 --- a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java +++ b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ public abstract class StreamPrintServiceFactory { * Although null is an acceptable value to use in the lookup of stream * printing services, it's typical to search for a particular * desired format, such as Postscript(TM). - *

    + * * @param flavor of the input document type - null means match all * types. * @param outputMimeType representing the required output format, used to @@ -153,7 +153,7 @@ public abstract class StreamPrintServiceFactory { * Implementations which allocate resources on construction should examine * the stream and may wish to only allocate resources if the stream is * non-null. - *

    + * * @param out destination stream for generated output. * @return a PrintService which will generate the format specified by the * DocFlavor supported by this Factory. diff --git a/jdk/src/share/classes/javax/print/attribute/Attribute.java b/jdk/src/share/classes/javax/print/attribute/Attribute.java index 5226f9cb80d..a6c58e6f933 100644 --- a/jdk/src/share/classes/javax/print/attribute/Attribute.java +++ b/jdk/src/share/classes/javax/print/attribute/Attribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ import java.io.Serializable; * Interface Attribute is the base interface implemented by any and every * printing attribute class to indicate that the class represents a * printing attribute. All printing attributes are serializable. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java b/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java index d78c8f2004a..72e583a0347 100644 --- a/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,7 +54,6 @@ import java.util.Date; * rather than a java.util.Calendar because it typically takes * less memory to store and less time to compare a java.util.Date * than a java.util.Calendar. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/DocAttribute.java b/jdk/src/share/classes/javax/print/attribute/DocAttribute.java index e99c09d6bcb..994208f0a9e 100644 --- a/jdk/src/share/classes/javax/print/attribute/DocAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/DocAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ package javax.print.attribute; * PrintRequestAttribute} as well as DocAttribute, the client may include the * attribute in a attribute set which specifies a print job * to specify a characteristic for all the docs in that job. - *

    * * @see DocAttributeSet * @see PrintRequestAttributeSet diff --git a/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java index b4482d2e455..bacc1074f2c 100644 --- a/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java b/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java index 85ee7d8b402..f774066e592 100644 --- a/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -102,7 +102,6 @@ import java.io.Serializable; * uses some of the same integer values as the superclass. However, the * application in which the enumeration class and subclass are used may need to * have distinct integer values in the superclass and subclass. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java index 7956794d304..e4928a8196d 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java @@ -34,7 +34,6 @@ import java.util.HashMap; /** * Class HashAttributeSet provides an AttributeSet * implementation with characteristics of a hash map. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java index d4bc20e27d3..0b915ba2ca9 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.io.Serializable; * inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface {@link * DocAttributeSet DocAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java index 980693694e6..f39c85883d5 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.io.Serializable; * which inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface * {@link PrintJobAttributeSet PrintJobAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java index 53708f0259c..fde4ebb6945 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.io.Serializable; * class {@link HashAttributeSet HashAttributeSet} and enforces the * semantic restrictions of interface * {@link PrintRequestAttributeSet PrintRequestAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java index 64e5b9e48f3..d98430d0d75 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,6 @@ import java.io.Serializable; * which inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface * {@link PrintServiceAttributeSet PrintServiceAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java b/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java index 7675a8327e7..1fbd3b2556d 100644 --- a/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,6 @@ import java.io.Serializable; * established when it is constructed (see {@link #IntegerSyntax(int) * IntegerSyntax(int)}). Once constructed, an integer attribute's * value is immutable. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java b/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java index af8258090ba..ad9a0d7217a 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,6 @@ package javax.print.attribute; * PrintRequestAttribute PrintRequestAttribute} as well as PrintJobAttribute, * the client may include the attribute in a attribute set to * specify the attribute's value for the Print Job. - *

    * * @see PrintRequestAttributeSet * @see PrintJobAttributeSet diff --git a/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java index 5bce73513e9..4c920a1b48a 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java index 78fe37ccb76..48249480e60 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,6 @@ package javax.print.attribute; * as well as PrintRequestAttribute, the client may include the * attribute in a Doc}'s attribute set to specify * a job setting which pertains just to that doc. - *

    * * @see DocAttributeSet * @see PrintRequestAttributeSet diff --git a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java index eac683b194c..bde6c0cce8b 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java index 8ac2b656d18..f09b38870ed 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ package javax.print.attribute; * of a Print Service or some other characteristic of a Print Service. A Print * Service instance adds a number of PrintServiceAttributes to a Print * service's attribute set to report the Print Service's status. - *

    * * @see PrintServiceAttributeSet * diff --git a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java index badde734218..3d3296ed405 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java b/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java index 1089381d1c6..7e9c40835b5 100644 --- a/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,7 +78,6 @@ import java.io.Serializable; * mind, there is no guarantee that the conversion factor for the client's units * will be an exact integer. If the conversion factor isn't an exact integer, * resolution values in the client's units won't be stored precisely. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java index 0aed773fe6e..8ba9303135a 100644 --- a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,6 @@ import java.util.Vector; * Class SetOfIntegerSyntax has operations to return the set's members in * canonical array form, to test whether a given integer is a member of the * set, and to iterate through the members of the set. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java index 0f6a5dfe6c4..76832508c94 100644 --- a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,7 +77,6 @@ import java.io.Serializable; * client's units will be an exact integer. If the conversion factor isn't an * exact integer, resolution values in the client's units won't be stored * precisely. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java b/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java index 61e4bd57e62..ca8736b1315 100644 --- a/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ package javax.print.attribute; * which is a SupportedValuesAttribute giving the legal values a client may * specify for the {@link javax.print.attribute.standard.Copies Copies} * attribute. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/TextSyntax.java b/jdk/src/share/classes/javax/print/attribute/TextSyntax.java index 20e27fa314f..7b91de24d0f 100644 --- a/jdk/src/share/classes/javax/print/attribute/TextSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/TextSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,6 @@ import java.util.Locale; * includes a locale to indicate the natural language. Thus, a text attribute * always represents a localized string. Once constructed, a text attribute's * value is immutable. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/URISyntax.java b/jdk/src/share/classes/javax/print/attribute/URISyntax.java index 118b1c0cd8d..770ba8a9592 100644 --- a/jdk/src/share/classes/javax/print/attribute/URISyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/URISyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.net.URI; * Class URISyntax is an abstract base class providing the common * implementation of all attributes whose value is a Uniform Resource * Identifier (URI). Once constructed, a URI attribute's value is immutable. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/package.html b/jdk/src/share/classes/javax/print/attribute/package.html index fa9851655a8..aeedb0df2c2 100644 --- a/jdk/src/share/classes/javax/print/attribute/package.html +++ b/jdk/src/share/classes/javax/print/attribute/package.html @@ -3,7 +3,7 @@ javax.print.attribute package