diff --git a/doc/building.html b/doc/building.html index 09ea7dc7f725a1cde571bd091dad93063f867426..4745af2a1d748fa6d8fb3f9856f8eab235a72002 100644 --- a/doc/building.html +++ b/doc/building.html @@ -273,7 +273,7 @@ Linux -gcc 10.2.0 +gcc 11.2.0 macOS @@ -281,14 +281,14 @@ Windows -Microsoft Visual Studio 2019 update 16.7.2 +Microsoft Visual Studio 2022 update 17.1.0

All compilers are expected to be able to compile to the C99 language standard, as some C99 features are used in the source code. Microsoft Visual Studio doesn't fully support C99 so in practice shared code is limited to using C99 features that it does support.

gcc

The minimum accepted version of gcc is 5.0. Older versions will generate a warning by configure and are unlikely to work.

-

The JDK is currently known to be able to compile with at least version 10.2 of gcc.

+

The JDK is currently known to be able to compile with at least version 11.2 of gcc.

In general, any version between these two should be usable.

clang

The minimum accepted version of clang is 3.5. Older versions will not be accepted by configure.

diff --git a/doc/building.md b/doc/building.md index e83c2bada21233592123f0691f55b83631d7aede..f3b0ee10522ab540287a0bf582cf10edd93015b3 100644 --- a/doc/building.md +++ b/doc/building.md @@ -329,9 +329,9 @@ issues. Operating system Toolchain version ------------------ ------------------------------------------------------- - Linux gcc 10.2.0 + Linux gcc 11.2.0 macOS Apple Xcode 10.1 (using clang 10.0.0) - Windows Microsoft Visual Studio 2019 update 16.7.2 + Windows Microsoft Visual Studio 2022 update 17.1.0 All compilers are expected to be able to compile to the C99 language standard, as some C99 features are used in the source code. Microsoft Visual Studio @@ -343,7 +343,7 @@ features that it does support. The minimum accepted version of gcc is 5.0. Older versions will generate a warning by `configure` and are unlikely to work. -The JDK is currently known to be able to compile with at least version 10.2 of +The JDK is currently known to be able to compile with at least version 11.2 of gcc. In general, any version between these two should be usable. diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index 453b9fbc14bc135c688e692612d510b6dea08390..f0dfad09eb8f76153a30b3926a85b5d8a6cb2f2c 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -51,6 +51,7 @@
  • <atomic>
  • Uniform Initialization
  • Local Function Objects
  • +
  • Inheriting constructors
  • Additional Permitted Features
  • Excluded Features
  • Undecided Features
  • @@ -210,7 +211,7 @@ while ( test_foo(args...) ) { // No, excess spaces around controlRationale: Other than to implement exceptions (which HotSpot doesn't use), most potential uses of RTTI are better done via virtual functions. Some of the remainder can be replaced by bespoke mechanisms. The cost of the additional runtime data structures needed to support RTTI are deemed not worthwhile, given the alternatives.

    Memory Allocation

    Do not use the standard global allocation and deallocation functions (operator new and related functions). Use of these functions by HotSpot code is disabled for some platforms.

    -

    Rationale: HotSpot often uses "resource" or "arena" allocation. Even where heap allocation is used, the standard global functions are avoided in favor of wrappers around malloc and free that support the VM's Native Memory Tracking (NMT) feature.

    +

    Rationale: HotSpot often uses "resource" or "arena" allocation. Even where heap allocation is used, the standard global functions are avoided in favor of wrappers around malloc and free that support the VM's Native Memory Tracking (NMT) feature. Typically, uses of the global operator new are inadvertent and therefore often associated with memory leaks.

    Native memory allocation failures are often treated as non-recoverable. The place where "out of memory" is (first) detected may be an innocent bystander, unrelated to the actual culprit.

    Class Inheritance

    Use public single inheritance.

    @@ -270,8 +271,8 @@ while ( test_foo(args...) ) { // No, excess spaces around controlThe underlying type of a scoped-enum should also be specified explicitly if conversions may be applied to values of that type.

    Due to bugs in certain (very old) compilers, there is widespread use of enums and avoidance of in-class initialization of static integral constant members. Compilers having such bugs are no longer supported. Except where an enum is semantically appropriate, new code should use integral constants.

    thread_local

    -

    Do not use thread_local (n2659); instead, use the HotSpot macro THREAD_LOCAL. The initializer must be a constant expression.

    -

    As was discussed in the review for JDK-8230877, thread_local allows dynamic initialization and destruction semantics. However, that support requires a run-time penalty for references to non-function-local thread_local variables defined in a different translation unit, even if they don't need dynamic initialization. Dynamic initialization and destruction of namespace-scoped thread local variables also has the same ordering problems as for ordinary namespace-scoped variables.

    +

    Avoid use of thread_local (n2659); and instead, use the HotSpot macro THREAD_LOCAL, for which the initializer must be a constant expression. When thread_local must be used, use the Hotspot macro APPROVED_CPP_THREAD_LOCAL to indicate that the use has been given appropriate consideration.

    +

    As was discussed in the review for JDK-8230877, thread_local allows dynamic initialization and destruction semantics. However, that support requires a run-time penalty for references to non-function-local thread_local variables defined in a different translation unit, even if they don't need dynamic initialization. Dynamic initialization and destruction of non-local thread_local variables also has the same ordering problems as for ordinary non-local variables. So we avoid use of thread_local in general, limiting its use to only those cases where dynamic initialization or destruction are essential. See JDK-8282469 for further discussion.

    nullptr

    Prefer nullptr (n2431) to NULL. Don't use (constexpr or literal) 0 for pointers.

    For historical reasons there are widespread uses of both NULL and of integer 0 as a pointer value.

    @@ -405,6 +406,10 @@ while ( test_foo(args...) ) { // No, excess spaces around control
  • Make () more optional for lambdas (p1102r2)
  • +

    Inheriting constructors

    +

    Do not use inheriting constructors (n2540).

    +

    C++11 provides simple syntax allowing a class to inherit the constructors of a base class. Unfortunately there are a number of problems with the original specification, and C++17 contains significant revisions (p0136r1 opens with a list of 8 Core Issues). Since HotSpot doesn't support use of C++17, use of inherited constructors could run into those problems. Such uses might also change behavior in a future HotSpot update to use C++17 or later, potentially in subtle ways that could lead to hard to diagnose problems. Because of this, HotSpot code must not use inherited constructors.

    +

    Note that gcc7 provides the -fnew-inheriting-ctors option to use the p0136r1 semantics. This is enabled by default when using C++17 or later. It is also enabled by default for fabi-version=11 (introduced by gcc7) or higher when using C++11/14, as the change is considered a Defect Report that applies to those versions. Earlier versions of gcc don't have that option, and other supported compilers may not have anything similar.

    Additional Permitted Features

    Excluded Features

    - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see #showDialog @@ -683,7 +683,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.ERROR_OPTION if an error occurs or the * dialog is dismissed * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see #showDialog @@ -743,7 +743,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.ERROR_OPTION if an error occurs or the * dialog is dismissed * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -800,7 +800,7 @@ public class JFileChooser extends JComponent implements Accessible { * @param parent the parent component of the dialog; * can be null * @return a new JDialog containing this instance - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 @@ -924,7 +924,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.CUSTOM_DIALOG * * - * @exception IllegalArgumentException if dialogType is + * @throws IllegalArgumentException if dialogType is * not legal * * @see #getDialogType @@ -1311,7 +1311,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.FILES_AND_DIRECTORIES * * - * @exception IllegalArgumentException if mode is an + * @throws IllegalArgumentException if mode is an * illegal file selection mode * * @see #getFileSelectionMode diff --git a/src/java.desktop/share/classes/javax/swing/JFrame.java b/src/java.desktop/share/classes/javax/swing/JFrame.java index 339268fd16547916f1cc56974a350ce3a69ccd42..9b37ae77ab00876b2de41f11834a50b1f194f6e5 100644 --- a/src/java.desktop/share/classes/javax/swing/JFrame.java +++ b/src/java.desktop/share/classes/javax/swing/JFrame.java @@ -169,7 +169,7 @@ public class JFrame extends Frame implements WindowConstants, * This constructor sets the component's locale property to the value * returned by JComponent.getDefaultLocale. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see Component#setSize @@ -193,7 +193,7 @@ public class JFrame extends Frame implements WindowConstants, * to construct the new Frame; * if gc is null, the system * default GraphicsConfiguration is assumed - * @exception IllegalArgumentException if gc is not from + * @throws IllegalArgumentException if gc is not from * a screen device. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true. * @see java.awt.GraphicsEnvironment#isHeadless @@ -213,7 +213,7 @@ public class JFrame extends Frame implements WindowConstants, * returned by JComponent.getDefaultLocale. * * @param title the title for the frame - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see Component#setSize @@ -239,7 +239,7 @@ public class JFrame extends Frame implements WindowConstants, * to construct the new JFrame with; * if gc is null, the system * default GraphicsConfiguration is assumed - * @exception IllegalArgumentException if gc is not from + * @throws IllegalArgumentException if gc is not from * a screen device. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true. * @see java.awt.GraphicsEnvironment#isHeadless @@ -357,7 +357,7 @@ public class JFrame extends Frame implements WindowConstants, * * @param operation the operation which should be performed when the * user closes the frame - * @exception IllegalArgumentException if defaultCloseOperation value + * @throws IllegalArgumentException if defaultCloseOperation value * isn't one of the above valid values * @see #addWindowListener * @see #getDefaultCloseOperation @@ -540,10 +540,10 @@ public class JFrame extends Frame implements WindowConstants, * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer @@ -668,7 +668,7 @@ public class JFrame extends Frame implements WindowConstants, * * @param contentPane the contentPane object for this frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see #getContentPane * @see RootPaneContainer#setContentPane @@ -696,7 +696,7 @@ public class JFrame extends Frame implements WindowConstants, * This method is called by the constructor. * @param layeredPane the layeredPane object for this frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane diff --git a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java index 62efd03c0db844aad94f0065eab55a3c4330fba7..9caa5f966e305112392f4e972ff678dce1328a98 100644 --- a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java +++ b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java @@ -497,10 +497,10 @@ public class JInternalFrame extends JComponent implements * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer @@ -628,7 +628,7 @@ public class JInternalFrame extends JComponent implements * * @param c the content pane for this internal frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see RootPaneContainer#getContentPane */ @@ -657,7 +657,7 @@ public class JInternalFrame extends JComponent implements * * @param layered the JLayeredPane for this internal frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see RootPaneContainer#setLayeredPane */ @@ -794,7 +794,7 @@ public class JInternalFrame extends JComponent implements * * @param b must be true * - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame * * @see #isClosed() @@ -906,7 +906,7 @@ public class JInternalFrame extends JComponent implements * * @param b a boolean, where true means to iconify this internal frame and * false means to de-iconify it - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame * * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED @@ -985,7 +985,7 @@ public class JInternalFrame extends JComponent implements * * @param b a boolean, where true maximizes this internal frame and false * restores it - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame */ @BeanProperty(description @@ -1047,7 +1047,7 @@ public class JInternalFrame extends JComponent implements * @param selected a boolean, where true means this internal frame * should become selected (currently active) * and false means it should become deselected - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame * * @see #isShowing diff --git a/src/java.desktop/share/classes/javax/swing/JLabel.java b/src/java.desktop/share/classes/javax/swing/JLabel.java index 8dff4a8fd25b3ba8eacd741730138d189071d537..eed6a157cc1c05333e505f804986ba72650c09d7 100644 --- a/src/java.desktop/share/classes/javax/swing/JLabel.java +++ b/src/java.desktop/share/classes/javax/swing/JLabel.java @@ -551,7 +551,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @since 1.4 * @param index Index into the String to underline - * @exception IllegalArgumentException will be thrown if index + * @throws IllegalArgumentException will be thrown if index * is >= length of the text, or < -1 */ @BeanProperty(visualUpdate = true, description @@ -595,7 +595,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @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, + * @throws IllegalArgumentException if key isn't LEFT, CENTER, RIGHT, * LEADING or TRAILING. * @see #setHorizontalTextPosition * @see #setHorizontalAlignment @@ -622,7 +622,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @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. + * @throws IllegalArgumentException if key isn't TOP, CENTER, or BOTTOM. * @see #setVerticalAlignment * @see #setVerticalTextPosition */ @@ -1637,7 +1637,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param i zero-based index of the key bindings * @return a javax.lang.Object which specifies the key binding - * @exception IllegalArgumentException if the index is + * @throws IllegalArgumentException if the index is * out of bounds * @see #getAccessibleKeyBindingCount */ diff --git a/src/java.desktop/share/classes/javax/swing/JLayer.java b/src/java.desktop/share/classes/javax/swing/JLayer.java index 0ade190ce42fb0c8a5896020af33b1229050faf9..c2076299e442620d55fd514fa003e8d66739cd38 100644 --- a/src/java.desktop/share/classes/javax/swing/JLayer.java +++ b/src/java.desktop/share/classes/javax/swing/JLayer.java @@ -316,7 +316,7 @@ public final class JLayer * a {@code JLayer}. * * @param mgr the specified layout manager - * @exception IllegalArgumentException this method is not supported + * @throws IllegalArgumentException this method is not supported */ public void setLayout(LayoutManager mgr) { if (mgr != null) { diff --git a/src/java.desktop/share/classes/javax/swing/JList.java b/src/java.desktop/share/classes/javax/swing/JList.java index ac4a1e3fe3a6ff67d6b3b0047c3cab8734502b77..220f86aca4ee4fe86b85483913febb4be35642fa 100644 --- a/src/java.desktop/share/classes/javax/swing/JList.java +++ b/src/java.desktop/share/classes/javax/swing/JList.java @@ -445,7 +445,7 @@ public class JList extends JComponent implements Scrollable, Accessible * allowing for tooltips to be provided by the cell renderers. * * @param dataModel the model for the list - * @exception IllegalArgumentException if the model is {@code null} + * @throws IllegalArgumentException if the model is {@code null} */ public JList(ListModel dataModel) { @@ -1202,7 +1202,7 @@ public class JList extends JComponent implements Scrollable, Accessible * list's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -1493,7 +1493,7 @@ public class JList extends JComponent implements Scrollable, Accessible * Position.Bias.Forward or Position.Bias.Backward. * @return the index of the next list element that * starts with the prefix; otherwise {@code -1} - * @exception IllegalArgumentException if prefix is {@code null} + * @throws IllegalArgumentException if prefix is {@code null} * or startIndex is out of bounds * @since 1.4 */ @@ -1695,7 +1695,7 @@ public class JList extends JComponent implements Scrollable, Accessible * * @param model the ListModel that provides the * list of items for display - * @exception IllegalArgumentException if model is + * @throws IllegalArgumentException if model is * null * @see #getModel * @see #clearSelection @@ -1910,7 +1910,7 @@ public class JList extends JComponent implements Scrollable, Accessible * * @param selectionModel the ListSelectionModel that * implements the selections - * @exception IllegalArgumentException if selectionModel + * @throws IllegalArgumentException if selectionModel * is null * @see #getSelectionModel */ diff --git a/src/java.desktop/share/classes/javax/swing/JMenu.java b/src/java.desktop/share/classes/javax/swing/JMenu.java index dbac4812ca821e3470adee0ae7b829e45f69fe72..1565440969aa89cf9c1be9aa97453d9a21987f79 100644 --- a/src/java.desktop/share/classes/javax/swing/JMenu.java +++ b/src/java.desktop/share/classes/javax/swing/JMenu.java @@ -508,7 +508,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * to manage the idiosyncrasies of the various UI implementations. * * @param d the number of milliseconds to delay - * @exception IllegalArgumentException if d + * @throws IllegalArgumentException if d * is less than 0 */ @BeanProperty(bound = false, expert = true, description @@ -674,7 +674,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param s the text for the menu item to add * @param pos an integer specifying the position at which to add the * new menu item - * @exception IllegalArgumentException when the value of + * @throws IllegalArgumentException when the value of * pos < 0 */ public void insert(String s, int pos) { @@ -693,7 +693,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param pos an integer specifying the position at which to add the * new JMenuitem * @return the new menu item - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0 */ public JMenuItem insert(JMenuItem mi, int pos) { @@ -713,7 +713,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param pos an integer specifying the position at which to add the * new menu item * @return the new menu item - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0 */ public JMenuItem insert(Action a, int pos) { @@ -734,7 +734,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @param index an integer specifying the position at which to * insert the menu separator - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * index < 0 */ public void insertSeparator(int index) { @@ -755,7 +755,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param pos an integer specifying the position * @return the menu item at the specified position; or null * if the item as the specified position is not a menu item - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * {@code pos} < 0 */ public JMenuItem getItem(int pos) { @@ -790,7 +790,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * yet implemented. * * @return true if the menu can be torn off, else false - * @exception Error if invoked -- this method is not yet implemented + * @throws Error if invoked -- this method is not yet implemented */ @BeanProperty(bound = false) public boolean isTearOff() { @@ -812,7 +812,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * Removes the menu item at the specified index from this menu. * * @param pos the position of the item to be removed - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0, or if pos * is greater than the number of menu items */ @@ -1024,7 +1024,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * notification on this event type. The event instance * is created lazily. * - * @exception Error if there is a null listener + * @throws Error if there is a null listener * @see EventListenerList */ protected void fireMenuSelected() { @@ -1054,7 +1054,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * notification on this event type. The event instance * is created lazily. * - * @exception Error if there is a null listener + * @throws Error if there is a null listener * @see EventListenerList */ protected void fireMenuDeselected() { @@ -1084,7 +1084,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * notification on this event type. The event instance * is created lazily. * - * @exception Error if there is a null listener + * @throws Error if there is a null listener * @see EventListenerList */ protected void fireMenuCanceled() { @@ -1238,7 +1238,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @param o the new component orientation of this menu and * the components contained within it. - * @exception NullPointerException if orientation is null. + * @throws NullPointerException if orientation is null. * @see java.awt.Component#setComponentOrientation * @see java.awt.Component#getComponentOrientation * @since 1.4 @@ -1275,7 +1275,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param keyStroke the keystroke combination which will invoke * the JMenuItem's actionlisteners * without navigating the menu hierarchy - * @exception Error if invoked -- this method is not defined for JMenu. + * @throws Error if invoked -- this method is not defined for JMenu. * Use setMnemonic instead */ public void setAccelerator(KeyStroke keyStroke) { diff --git a/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/src/java.desktop/share/classes/javax/swing/JOptionPane.java index 99eee90347ba2e2b8ad21258e1e2dfb5bc3d13bd..28a547dc2cb9d2abaa39bcc13f3afb2488be65b7 100644 --- a/src/java.desktop/share/classes/javax/swing/JOptionPane.java +++ b/src/java.desktop/share/classes/javax/swing/JOptionPane.java @@ -435,7 +435,7 @@ public class JOptionPane extends JComponent implements Accessible * the screen. * * @param message the Object to display - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @return user's input @@ -471,7 +471,7 @@ public class JOptionPane extends JComponent implements Accessible * @param parentComponent the parent Component for the * dialog * @param message the Object to display - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @return user's input @@ -523,7 +523,7 @@ public class JOptionPane extends JComponent implements Accessible * QUESTION_MESSAGE, * or PLAIN_MESSAGE * @return user's input - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -566,7 +566,7 @@ public class JOptionPane extends JComponent implements Accessible * field * @return user's input, or null meaning the user * canceled the input - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -609,7 +609,7 @@ public class JOptionPane extends JComponent implements Accessible * or if the parentComponent has no * Frame, a default Frame is used * @param message the Object to display - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -637,7 +637,7 @@ public class JOptionPane extends JComponent implements Accessible * WARNING_MESSAGE, * QUESTION_MESSAGE, * or PLAIN_MESSAGE - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -666,7 +666,7 @@ public class JOptionPane extends JComponent implements Accessible * or PLAIN_MESSAGE * @param icon an icon to display in the dialog that helps the user * identify the kind of message that is being displayed - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -690,7 +690,7 @@ public class JOptionPane extends JComponent implements Accessible * default Frame is used * @param message the Object to display * @return an integer indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -718,7 +718,7 @@ public class JOptionPane extends JComponent implements Accessible * YES_NO_CANCEL_OPTION, * or OK_CANCEL_OPTION * @return an int indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -757,7 +757,7 @@ public class JOptionPane extends JComponent implements Accessible * QUESTION_MESSAGE, * or PLAIN_MESSAGE * @return an integer indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -795,7 +795,7 @@ public class JOptionPane extends JComponent implements Accessible * or PLAIN_MESSAGE * @param icon the icon to display in the dialog * @return an int indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -856,7 +856,7 @@ public class JOptionPane extends JComponent implements Accessible * @return an integer indicating the option chosen by the user, * or CLOSED_OPTION if the user closed * the dialog - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -919,7 +919,7 @@ public class JOptionPane extends JComponent implements Accessible * no Frame, a default Frame is used * @param title the title string for the dialog * @return a new JDialog containing this instance - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -946,7 +946,7 @@ public class JOptionPane extends JComponent implements Accessible * * @param title the title string for the dialog * @return a new JDialog containing this instance - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -1508,7 +1508,7 @@ public class JOptionPane extends JComponent implements Accessible * frame's title bar * @return a JInternalFrame containing a * JOptionPane - * @exception RuntimeException if parentComponent does + * @throws RuntimeException if parentComponent does * not have a valid parent */ public JInternalFrame createInternalFrame(Component parentComponent, @@ -1600,7 +1600,7 @@ public class JOptionPane extends JComponent implements Accessible * or getRootFrame * if the component is null, * or does not have a valid Frame parent - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see #getRootFrame @@ -1626,7 +1626,7 @@ public class JOptionPane extends JComponent implements Accessible * frame if the component is null, * or does not have a valid * Frame or Dialog parent - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -1683,7 +1683,7 @@ public class JOptionPane extends JComponent implements Accessible * which a frame is not provided. * * @return the default Frame to use - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see #setRootFrame @@ -2050,7 +2050,7 @@ public class JOptionPane extends JComponent implements Accessible * ERROR_MESSAGE, INFORMATION_MESSAGE, * WARNING_MESSAGE, * QUESTION_MESSAGE, or PLAIN_MESSAGE - * @exception RuntimeException if newType is not one of the + * @throws RuntimeException if newType is not one of the * legal values listed above * @see #getMessageType @@ -2096,7 +2096,7 @@ public class JOptionPane extends JComponent implements Accessible * YES_NO_OPTION, * YES_NO_CANCEL_OPTION, * or OK_CANCEL_OPTION - * @exception RuntimeException if newType is not one of + * @throws RuntimeException if newType is not one of * the legal values listed above * * @see #getOptionType diff --git a/src/java.desktop/share/classes/javax/swing/JPasswordField.java b/src/java.desktop/share/classes/javax/swing/JPasswordField.java index 577998cb3367c9abf49eeb9938a77bd0cb435e20..c6450d0605afc08edbd0c942c2f22a0199a00cec 100644 --- a/src/java.desktop/share/classes/javax/swing/JPasswordField.java +++ b/src/java.desktop/share/classes/javax/swing/JPasswordField.java @@ -288,7 +288,7 @@ public class JPasswordField extends JTextField { * @param offs the offset >= 0 * @param len the length >= 0 * @return the text - * @exception BadLocationException if the offset or length are invalid + * @throws BadLocationException if the offset or length are invalid */ @Deprecated public String getText(int offs, int len) throws BadLocationException { diff --git a/src/java.desktop/share/classes/javax/swing/JPopupMenu.java b/src/java.desktop/share/classes/javax/swing/JPopupMenu.java index ef9ad42ef81d1f1978b1b6c7dbf49fd430009e07..a6811fad5eb7a23b46c5b58da726a56b1a96f016 100644 --- a/src/java.desktop/share/classes/javax/swing/JPopupMenu.java +++ b/src/java.desktop/share/classes/javax/swing/JPopupMenu.java @@ -475,7 +475,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * Removes the component at the specified index from this popup menu. * * @param pos the position of the item to be removed - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0, or if the value of * pos is greater than the * number of items @@ -573,7 +573,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @param a the Action object to insert * @param index specifies the position at which to insert the * Action, where 0 is the first - * @exception IllegalArgumentException if index < 0 + * @throws IllegalArgumentException if index < 0 * @see Action */ public void insert(Action a, int index) { @@ -589,7 +589,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @param component the Component to insert * @param index specifies the position at which * to insert the component, where 0 is the first - * @exception IllegalArgumentException if index < 0 + * @throws IllegalArgumentException if index < 0 */ public void insert(Component component, int index) { if (index < 0) { diff --git a/src/java.desktop/share/classes/javax/swing/JProgressBar.java b/src/java.desktop/share/classes/javax/swing/JProgressBar.java index 90945bb67e3add75f083db2f727cf939589fd695..edba6e4a5da2ae84725a527865f28a3c073e7e24 100644 --- a/src/java.desktop/share/classes/javax/swing/JProgressBar.java +++ b/src/java.desktop/share/classes/javax/swing/JProgressBar.java @@ -394,7 +394,7 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * is {@code SwingConstants.HORIZONTAL}. * * @param newOrientation HORIZONTAL or VERTICAL - * @exception IllegalArgumentException if newOrientation + * @throws IllegalArgumentException if newOrientation * is an illegal value * @see #getOrientation */ diff --git a/src/java.desktop/share/classes/javax/swing/JRootPane.java b/src/java.desktop/share/classes/javax/swing/JRootPane.java index dcc6d6bb4efae6915c99cebb001881617a3fb9f8..48e06a917fc59ce01b710f1f182c9c4aef7b3a00 100644 --- a/src/java.desktop/share/classes/javax/swing/JRootPane.java +++ b/src/java.desktop/share/classes/javax/swing/JRootPane.java @@ -578,7 +578,7 @@ public class JRootPane extends JComponent implements Accessible { * replace it with an opaque JComponent. * * @param content the Container to use for component-contents - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null */ public void setContentPane(Container content) { @@ -605,7 +605,7 @@ public class JRootPane extends JComponent implements Accessible { * typically holds a content pane and an optional JMenuBar. * * @param layered the JLayeredPane to use - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null */ public void setLayeredPane(JLayeredPane layered) { @@ -647,7 +647,7 @@ public class JRootPane extends JComponent implements Accessible { * * @param glass the Component to use as the glass pane * for this JRootPane - * @exception NullPointerException if the glass parameter is + * @throws NullPointerException if the glass parameter is * null */ public void setGlassPane(Component glass) { diff --git a/src/java.desktop/share/classes/javax/swing/JScrollBar.java b/src/java.desktop/share/classes/javax/swing/JScrollBar.java index 6bb997a6150321932bd17b41c9a2e6b1f6bcb4ac..ba65f21a95430851e6b7983f8cd87c4495fa4338 100644 --- a/src/java.desktop/share/classes/javax/swing/JScrollBar.java +++ b/src/java.desktop/share/classes/javax/swing/JScrollBar.java @@ -155,7 +155,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * That way, when the user jumps the knob to an adjacent position, * one or two lines of the original contents remain in view. * - * @exception IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL + * @throws IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL * * @see #setOrientation * @see #setValue @@ -279,7 +279,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * HORIZONTAL. * * @param orientation an orientation of the {@code JScrollBar} - * @exception IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL + * @throws IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL * @see #getOrientation */ @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { diff --git a/src/java.desktop/share/classes/javax/swing/JScrollPane.java b/src/java.desktop/share/classes/javax/swing/JScrollPane.java index 2c3302178df99dd6d677d949ae8972e6d827839c..3d5385a34d1e411ba3c46ae83dbaffbdf90afd84 100644 --- a/src/java.desktop/share/classes/javax/swing/JScrollPane.java +++ b/src/java.desktop/share/classes/javax/swing/JScrollPane.java @@ -418,7 +418,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * will invoke syncWithScrollPane on it. * * @param layout the specified layout manager - * @exception ClassCastException if layout is not a + * @throws ClassCastException if layout is not a * ScrollPaneLayout * @see java.awt.Container#getLayout * @see java.awt.Container#setLayout @@ -476,7 +476,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * * * @param policy one of the three values listed above - * @exception IllegalArgumentException if policy + * @throws IllegalArgumentException if policy * is not one of the legal values shown above * @see #getVerticalScrollBarPolicy */ @@ -521,7 +521,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * * * @param policy one of the three values listed above - * @exception IllegalArgumentException if policy + * @throws IllegalArgumentException if policy * is not one of the legal values shown above * @see #getHorizontalScrollBarPolicy */ @@ -1195,7 +1195,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce *
  • upperLeft *
  • upperRight * - * @exception IllegalArgumentException if corner key is invalid + * @throws IllegalArgumentException if corner key is invalid */ public void setCorner(String key, Component corner) { diff --git a/src/java.desktop/share/classes/javax/swing/JSeparator.java b/src/java.desktop/share/classes/javax/swing/JSeparator.java index 69d17382acd7b0bf490b0637608cc44292a79793..10a724a7e2ec430dd8ca6cd17f9636a6e7314b40 100644 --- a/src/java.desktop/share/classes/javax/swing/JSeparator.java +++ b/src/java.desktop/share/classes/javax/swing/JSeparator.java @@ -97,7 +97,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * @param orientation an integer specifying * SwingConstants.HORIZONTAL or * SwingConstants.VERTICAL - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is neither SwingConstants.HORIZONTAL nor * SwingConstants.VERTICAL */ @@ -190,7 +190,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * The default value of this property is HORIZONTAL. * @param orientation either SwingConstants.HORIZONTAL * or SwingConstants.VERTICAL - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is neither SwingConstants.HORIZONTAL * nor SwingConstants.VERTICAL * diff --git a/src/java.desktop/share/classes/javax/swing/JSlider.java b/src/java.desktop/share/classes/javax/swing/JSlider.java index 0d826fe7e49e1f910d4a6c1a623a62c06b1df8c9..4682acb8a54dfd4b7e2a63ea81219c0aafa8eec8 100644 --- a/src/java.desktop/share/classes/javax/swing/JSlider.java +++ b/src/java.desktop/share/classes/javax/swing/JSlider.java @@ -920,7 +920,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @return a new {@code Hashtable} of labels * @see #setLabelTable * @see #setPaintLabels - * @exception IllegalArgumentException if {@code start} is + * @throws IllegalArgumentException if {@code start} is * out of range, or if {@code increment} is less than or equal * to zero */ diff --git a/src/java.desktop/share/classes/javax/swing/JSpinner.java b/src/java.desktop/share/classes/javax/swing/JSpinner.java index a371c557439019959b7a5113bd7755619d0a0049..245212131f2ec2ee960fa0ca3b607400f0b7815a 100644 --- a/src/java.desktop/share/classes/javax/swing/JSpinner.java +++ b/src/java.desktop/share/classes/javax/swing/JSpinner.java @@ -1015,7 +1015,7 @@ public class JSpinner extends JComponent implements Accessible * on the new JFormattedTextField. * * @param spinner the spinner whose model this editor will monitor - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerDateModel * * @see #getModel @@ -1039,7 +1039,7 @@ public class JSpinner extends JComponent implements Accessible * @param dateFormatPattern the initial pattern for the * SimpleDateFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerDateModel * * @see #getModel @@ -1064,7 +1064,7 @@ public class JSpinner extends JComponent implements Accessible * will monitor * @param format DateFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerDateModel * * @see #getModel @@ -1202,7 +1202,7 @@ public class JSpinner extends JComponent implements Accessible * on the new JFormattedTextField. * * @param spinner the spinner whose model this editor will monitor - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerNumberModel * * @see #getModel @@ -1225,7 +1225,7 @@ public class JSpinner extends JComponent implements Accessible * @param decimalFormatPattern the initial pattern for the * DecimalFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerNumberModel or if * decimalFormatPattern is not a legal * argument to DecimalFormat @@ -1251,7 +1251,7 @@ public class JSpinner extends JComponent implements Accessible * @param format the initial pattern for the * DecimalFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerNumberModel * * @see #getTextField @@ -1346,7 +1346,7 @@ public class JSpinner extends JComponent implements Accessible * on the new JFormattedTextField. * * @param spinner the spinner whose model this editor will monitor - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerListModel * * @see #getModel diff --git a/src/java.desktop/share/classes/javax/swing/JSplitPane.java b/src/java.desktop/share/classes/javax/swing/JSplitPane.java index bd5e85ed4a6436d87c7e6c3fbd5df641746c4118..5a3cfef943e9ecd8908bbf86abe60a0c8ae1309a 100644 --- a/src/java.desktop/share/classes/javax/swing/JSplitPane.java +++ b/src/java.desktop/share/classes/javax/swing/JSplitPane.java @@ -262,7 +262,7 @@ public class JSplitPane extends JComponent implements Accessible * * @param newOrientation JSplitPane.HORIZONTAL_SPLIT or * JSplitPane.VERTICAL_SPLIT - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT. */ @ConstructorProperties({"orientation"}) @@ -281,7 +281,7 @@ public class JSplitPane extends JComponent implements Accessible * @param newContinuousLayout a boolean, true for the components to * redraw continuously as the divider changes position, false * to wait until the divider position stops changing to redraw - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public JSplitPane(int newOrientation, @@ -304,7 +304,7 @@ public class JSplitPane extends JComponent implements Accessible * appear on the right * of a horizontally-split pane, or at the bottom of a * vertically-split pane - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of: HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public JSplitPane(int newOrientation, @@ -334,7 +334,7 @@ public class JSplitPane extends JComponent implements Accessible * appear on the right * of a horizontally-split pane, or at the bottom of a * vertically-split pane - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public JSplitPane(int newOrientation, @@ -622,7 +622,7 @@ public class JSplitPane extends JComponent implements Accessible * * * @param orientation an integer specifying the orientation - * @exception IllegalArgumentException if orientation is not one of: + * @throws IllegalArgumentException if orientation is not one of: * HORIZONTAL_SPLIT or VERTICAL_SPLIT. */ @BeanProperty(enumerationValues = { @@ -701,7 +701,7 @@ public class JSplitPane extends JComponent implements Accessible * extra space. * * @param value as described above - * @exception IllegalArgumentException if value is < 0 or > 1 + * @throws IllegalArgumentException if value is < 0 or > 1 * @since 1.3 */ @BeanProperty(description @@ -754,7 +754,7 @@ public class JSplitPane extends JComponent implements Accessible * @param proportionalLocation a double-precision floating point value * that specifies a percentage, from zero (top/left) to 1.0 * (bottom/right) - * @exception IllegalArgumentException if the specified location is < 0 + * @throws IllegalArgumentException if the specified location is < 0 * or > 1.0 */ @BeanProperty(description @@ -964,7 +964,7 @@ public class JSplitPane extends JComponent implements Accessible * (position) for this component * @param index an integer specifying the index in the container's * list. - * @exception IllegalArgumentException if the constraints + * @throws IllegalArgumentException if the constraints * object does not match an existing component * @see java.awt.Container#addImpl(Component, Object, int) */ diff --git a/src/java.desktop/share/classes/javax/swing/JTabbedPane.java b/src/java.desktop/share/classes/javax/swing/JTabbedPane.java index 4acf4f8a930d4d8e4615a2d3bc88a663ecd9b1fa..2bdd93a7e8db08dc51082f939a85a56b7df23fde 100644 --- a/src/java.desktop/share/classes/javax/swing/JTabbedPane.java +++ b/src/java.desktop/share/classes/javax/swing/JTabbedPane.java @@ -215,7 +215,7 @@ public class JTabbedPane extends JComponent * * @param tabPlacement the placement for the tabs relative to the content * @param tabLayoutPolicy the policy for laying out tabs when all tabs will not fit on one run - * @exception IllegalArgumentException if tab placement or tab layout policy are not + * @throws IllegalArgumentException if tab placement or tab layout policy are not * one of the above supported values * @see #addTab * @since 1.4 @@ -505,7 +505,7 @@ public class JTabbedPane extends JComponent * The default value, if not set, is SwingConstants.TOP. * * @param tabPlacement the placement for the tabs relative to the content - * @exception IllegalArgumentException if tab placement value isn't one + * @throws IllegalArgumentException if tab placement value isn't one * of the above valid values */ @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { @@ -561,7 +561,7 @@ public class JTabbedPane extends JComponent * ignored. * * @param tabLayoutPolicy the policy used to layout the tabs - * @exception IllegalArgumentException if layoutPolicy value isn't one + * @throws IllegalArgumentException if layoutPolicy value isn't one * of the above valid values * @see #getTabLayoutPolicy * @since 1.4 @@ -609,7 +609,7 @@ public class JTabbedPane extends JComponent * the results will be implementation defined. * * @param index the index to be selected - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < -1 || index >= tab count)} * * @see #getSelectedIndex @@ -696,7 +696,7 @@ public class JTabbedPane extends JComponent * corresponding to the specified component. * * @param c the selected {@code Component} for this {@code TabbedPane} - * @exception IllegalArgumentException if component not found in tabbed + * @throws IllegalArgumentException if component not found in tabbed * pane * @see #getSelectedComponent */ @@ -963,7 +963,7 @@ public class JTabbedPane extends JComponent * its visibility is reset to true to ensure it will be visible * if added to other containers. * @param index the index of the tab to be removed - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #addTab @@ -1084,7 +1084,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the component to remove from the * tabbedpane - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * @see #addTab * @see #removeTabAt @@ -1148,7 +1148,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the title at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * @see #setTitleAt */ @@ -1161,7 +1161,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the icon at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setIconAt @@ -1180,7 +1180,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the icon at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setDisabledIconAt @@ -1198,7 +1198,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return a string containing the tool tip text at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setToolTipTextAt @@ -1214,7 +1214,7 @@ public class JTabbedPane extends JComponent * @param index the index of the item being queried * @return the Color of the tab background at * index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setBackgroundAt @@ -1229,7 +1229,7 @@ public class JTabbedPane extends JComponent * @param index the index of the item being queried * @return the Color of the tab foreground at * index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setForegroundAt @@ -1245,7 +1245,7 @@ public class JTabbedPane extends JComponent * @param index the index of the item being queried * @return true if the tab at index is enabled; * false otherwise - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setEnabledAt @@ -1259,7 +1259,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the Component at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setComponentAt @@ -1278,7 +1278,7 @@ public class JTabbedPane extends JComponent * @param tabIndex the index of the tab that the mnemonic refers to * @return the key code which represents the mnemonic; * -1 if a mnemonic is not specified for the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * (tabIndex < 0 || * tabIndex >= tab count) * @see #setDisplayedMnemonicIndexAt(int,int) @@ -1299,7 +1299,7 @@ public class JTabbedPane extends JComponent * @param tabIndex the index of the tab that the mnemonic refers to * @return index representing mnemonic character if one exists; * otherwise returns -1 - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * (tabIndex < 0 || * tabIndex >= tab count) * @see #setDisplayedMnemonicIndexAt(int,int) @@ -1324,7 +1324,7 @@ public class JTabbedPane extends JComponent * index, or null if tab at * index is not currently visible in the UI, * or if there is no UI set on this tabbedpane - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} */ public Rectangle getBoundsAt(int index) { @@ -1346,7 +1346,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the title should be set * @param title the title to be displayed in the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getTitleAt @@ -1386,7 +1386,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the icon should be set * @param icon the icon to be displayed in the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setDisabledIconAt @@ -1428,7 +1428,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the disabled icon should be set * @param disabledIcon the icon to be displayed in the tab when disabled - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getDisabledIconAt @@ -1451,7 +1451,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the tooltip text should be set * @param toolTipText the tooltip text to be displayed for the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getToolTipTextAt @@ -1486,7 +1486,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the background should be set * @param background the color to be displayed in the tab's background - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getBackgroundAt @@ -1517,7 +1517,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the foreground should be set * @param foreground the color to be displayed as the tab's foreground - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getForegroundAt @@ -1542,7 +1542,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index which should be enabled/disabled * @param enabled whether or not the tab should be enabled - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #isEnabledAt @@ -1562,7 +1562,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where this component is being placed * @param component the component for the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getComponentAt @@ -1638,10 +1638,10 @@ public class JTabbedPane extends JComponent * @since 1.4 * @param tabIndex the index of the tab that the mnemonic refers to * @param mnemonicIndex index into the String to underline - * @exception IndexOutOfBoundsException if tabIndex is + * @throws IndexOutOfBoundsException if tabIndex is * out of range ({@code tabIndex < 0 || tabIndex >= tab * count}) - * @exception IllegalArgumentException will be thrown if + * @throws IllegalArgumentException will be thrown if * mnemonicIndex is >= length of the tab * title , or < -1 * @see #setMnemonicAt(int,int) @@ -1678,7 +1678,7 @@ public class JTabbedPane extends JComponent * @since 1.4 * @param tabIndex the index of the tab that the mnemonic refers to * @param mnemonic the key code which represents the mnemonic - * @exception IndexOutOfBoundsException if tabIndex is out + * @throws IndexOutOfBoundsException if tabIndex is out * of range ({@code tabIndex < 0 || tabIndex >= tab count}) * @see #getMnemonicAt(int) * @see #setDisplayedMnemonicIndexAt(int,int) @@ -2001,7 +2001,7 @@ public class JTabbedPane extends JComponent * * @param i zero-based index of child * @return the Accessible child of the object - * @exception IllegalArgumentException if index is out of bounds + * @throws IllegalArgumentException if index is out of bounds */ public Accessible getAccessibleChild(int i) { if (i < 0 || i >= getTabCount()) { @@ -2426,9 +2426,9 @@ public class JTabbedPane extends JComponent * @param index the tab index where the component should be set * @param component the component to render the title for the * specified tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} - * @exception IllegalArgumentException if component has already been + * @throws IllegalArgumentException if component has already been * added to this JTabbedPane * * @see #getTabComponentAt @@ -2456,7 +2456,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the tab component at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setTabComponentAt diff --git a/src/java.desktop/share/classes/javax/swing/JTable.java b/src/java.desktop/share/classes/javax/swing/JTable.java index c70ec2f935e49ac93c4e23980b4dfb03fe4da7c7..5d27be294541dcf88d0cf3176c229678956062a6 100644 --- a/src/java.desktop/share/classes/javax/swing/JTable.java +++ b/src/java.desktop/share/classes/javax/swing/JTable.java @@ -991,7 +991,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * the row margin. * * @param rowHeight new row height - * @exception IllegalArgumentException if rowHeight is + * @throws IllegalArgumentException if rowHeight is * less than 1 * @see #getRowHeight */ @@ -1037,7 +1037,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param row the row whose height is being changed * @param rowHeight new row height, in pixels - * @exception IllegalArgumentException if rowHeight is + * @throws IllegalArgumentException if rowHeight is * less than 1 * @since 1.3 */ @@ -1126,7 +1126,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * The default color is look and feel dependent. * * @param gridColor the new color of the grid lines - * @exception IllegalArgumentException if gridColor is null + * @throws IllegalArgumentException if gridColor is null * @see #getGridColor */ @BeanProperty(description @@ -1485,7 +1485,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * table's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -2220,7 +2220,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Selects the rows from index0 to index1, * inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getRowCount()-1] * @param index0 one end of the interval @@ -2234,7 +2234,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Selects the columns from index0 to index1, * inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getColumnCount()-1] * @param index0 one end of the interval @@ -2248,7 +2248,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Adds the rows from index0 to index1, inclusive, to * the current selection. * - * @exception IllegalArgumentException if index0 or index1 + * @throws IllegalArgumentException if index0 or index1 * lie outside [0, getRowCount()-1] * @param index0 one end of the interval * @param index1 the other end of the interval @@ -2261,7 +2261,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Adds the columns from index0 to index1, * inclusive, to the current selection. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getColumnCount()-1] * @param index0 one end of the interval @@ -2274,7 +2274,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable /** * Deselects the rows from index0 to index1, inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getRowCount()-1] * @param index0 one end of the interval @@ -2287,7 +2287,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable /** * Deselects the columns from index0 to index1, inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getColumnCount()-1] * @param index0 one end of the interval @@ -2596,7 +2596,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * equals. * * @return the TableColumn object that matches the identifier - * @exception IllegalArgumentException if identifier is null or no TableColumn has this identifier + * @throws IllegalArgumentException if identifier is null or no TableColumn has this identifier * * @param identifier the identifier object */ @@ -8355,7 +8355,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned - * @exception IllegalComponentStateException if the + * @throws IllegalComponentStateException if the * Component does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the @@ -9161,7 +9161,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned - * @exception IllegalComponentStateException if the + * @throws IllegalComponentStateException if the * Component does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the diff --git a/src/java.desktop/share/classes/javax/swing/JTextArea.java b/src/java.desktop/share/classes/javax/swing/JTextArea.java index ecc9342f05a0dd4c9bca710f4a09449312cb18c2..03b3bc7e9bd20979b5e8dffd1379718f2a1fb21b 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextArea.java +++ b/src/java.desktop/share/classes/javax/swing/JTextArea.java @@ -166,7 +166,7 @@ public class JTextArea extends JTextComponent { * * @param rows the number of rows >= 0 * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if the rows or columns + * @throws IllegalArgumentException if the rows or columns * arguments are negative. */ public JTextArea(int rows, int columns) { @@ -180,7 +180,7 @@ public class JTextArea extends JTextComponent { * @param text the text to be displayed, or null * @param rows the number of rows >= 0 * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if the rows or columns + * @throws IllegalArgumentException if the rows or columns * arguments are negative. */ public JTextArea(String text, int rows, int columns) { @@ -206,7 +206,7 @@ public class JTextArea extends JTextComponent { * @param text the text to be displayed, null if none * @param rows the number of rows >= 0 * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if the rows or columns + * @throws IllegalArgumentException if the rows or columns * arguments are negative. */ public JTextArea(Document doc, String text, int rows, int columns) { @@ -370,7 +370,7 @@ public class JTextArea extends JTextComponent { * * @param offset the offset >= 0 * @return the line number >= 0 - * @exception BadLocationException thrown if the offset is + * @throws BadLocationException thrown if the offset is * less than zero or greater than the document length. */ public int getLineOfOffset(int offset) throws BadLocationException { @@ -401,7 +401,7 @@ public class JTextArea extends JTextComponent { * * @param line the line number to translate >= 0 * @return the offset >= 0 - * @exception BadLocationException thrown if the line is + * @throws BadLocationException thrown if the line is * less than zero or greater or equal to the number of * lines contained in the document (as reported by * getLineCount). @@ -424,7 +424,7 @@ public class JTextArea extends JTextComponent { * * @param line the line >= 0 * @return the offset >= 0 - * @exception BadLocationException Thrown if the line is + * @throws BadLocationException Thrown if the line is * less than zero or greater or equal to the number of * lines contained in the document (as reported by * getLineCount). @@ -452,7 +452,7 @@ public class JTextArea extends JTextComponent { * * @param str the text to insert * @param pos the position at which to insert >= 0 - * @exception IllegalArgumentException if pos is an + * @throws IllegalArgumentException if pos is an * invalid position in the model * @see TextComponent#setText * @see #replaceRange @@ -493,7 +493,7 @@ public class JTextArea extends JTextComponent { * @param str the text to use as the replacement * @param start the start position >= 0 * @param end the end position >= start - * @exception IllegalArgumentException if part of the range is an + * @throws IllegalArgumentException if part of the range is an * invalid position in the model * @see #insert */ @@ -532,7 +532,7 @@ public class JTextArea extends JTextComponent { * setting the new value. * * @param rows the number of rows >= 0 - * @exception IllegalArgumentException if rows is less than 0 + * @throws IllegalArgumentException if rows is less than 0 * @see #getRows */ @BeanProperty(bound = false, description @@ -576,7 +576,7 @@ public class JTextArea extends JTextComponent { * after setting the new value. * * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if columns is less than 0 + * @throws IllegalArgumentException if columns is less than 0 * @see #getColumns */ @BeanProperty(bound = false, description @@ -726,7 +726,7 @@ public class JTextArea extends JTextComponent { * @param direction Less than zero to scroll up/left, * greater than zero for down/right. * @return The "unit" increment for scrolling in the specified direction - * @exception IllegalArgumentException for an invalid orientation + * @throws IllegalArgumentException for an invalid orientation * @see JScrollBar#setUnitIncrement * @see #getRowHeight * @see #getColumnWidth diff --git a/src/java.desktop/share/classes/javax/swing/JTextField.java b/src/java.desktop/share/classes/javax/swing/JTextField.java index 3abe09d056542f18aebb4b8dc2c5d62779d77721..0d66209d8af5bc075f43b00addc84061378817c3 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextField.java +++ b/src/java.desktop/share/classes/javax/swing/JTextField.java @@ -242,7 +242,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * the preferred width >= 0; if columns * is set to zero, the preferred width will be whatever * naturally results from the component implementation - * @exception IllegalArgumentException if columns < 0 + * @throws IllegalArgumentException if columns < 0 */ public JTextField(Document doc, String text, int columns) { if (columns < 0) { @@ -343,7 +343,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * and a PropertyChange event ("horizontalAlignment") is fired. * * @param alignment the alignment - * @exception IllegalArgumentException if alignment + * @throws IllegalArgumentException if alignment * is not a valid key */ @BeanProperty(preferred = true, enumerationValues = { @@ -393,7 +393,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * and then invalidate the layout. * * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if columns + * @throws IllegalArgumentException if columns * is less than 0 */ @BeanProperty(bound = false, description diff --git a/src/java.desktop/share/classes/javax/swing/JTextPane.java b/src/java.desktop/share/classes/javax/swing/JTextPane.java index 41e16034c23fb0a56b311b6902ddaf96c8abddb9..228181f31f76a5c31c204860d652d92ef2cea19c 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextPane.java +++ b/src/java.desktop/share/classes/javax/swing/JTextPane.java @@ -138,7 +138,7 @@ public class JTextPane extends JEditorPane { * must be a StyledDocument. * * @param doc the document to display/edit - * @exception IllegalArgumentException if doc can't + * @throws IllegalArgumentException if doc can't * be narrowed to a StyledDocument which is the * required type of model for this text component */ @@ -480,7 +480,7 @@ public class JTextPane extends JEditorPane { * establishes the content type of the editor. * * @param kit the desired editor behavior - * @exception IllegalArgumentException if kit is not a + * @throws IllegalArgumentException if kit is not a * StyledEditorKit */ public final void setEditorKit(EditorKit kit) { diff --git a/src/java.desktop/share/classes/javax/swing/JToolBar.java b/src/java.desktop/share/classes/javax/swing/JToolBar.java index 114ef0d169c2a8c0c97c01f858c237f3fbd9a119..4d93a1bceefe453f48a4aa746d74bf65b9725ec2 100644 --- a/src/java.desktop/share/classes/javax/swing/JToolBar.java +++ b/src/java.desktop/share/classes/javax/swing/JToolBar.java @@ -142,7 +142,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * @param name the name of the tool bar * @param orientation the initial orientation -- it must be * either HORIZONTAL or VERTICAL - * @exception IllegalArgumentException if orientation is neither + * @throws IllegalArgumentException if orientation is neither * HORIZONTAL nor VERTICAL * @since 1.3 */ @@ -406,7 +406,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * * @param o the new orientation -- either HORIZONTAL or * VERTICAL - * @exception IllegalArgumentException if orientation is neither + * @throws IllegalArgumentException if orientation is neither * HORIZONTAL nor VERTICAL * @see #getOrientation */ diff --git a/src/java.desktop/share/classes/javax/swing/JTree.java b/src/java.desktop/share/classes/javax/swing/JTree.java index ae90ea8be8bec502faf56b15683af34a8d75a161..e6e591bad27ca8843dbf796fb40d7f2dca988068 100644 --- a/src/java.desktop/share/classes/javax/swing/JTree.java +++ b/src/java.desktop/share/classes/javax/swing/JTree.java @@ -1251,7 +1251,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * tree's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -3087,7 +3087,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * Position.Bias.Forward or Position.Bias.Backward. * @return the TreePath of the next tree element that * starts with the prefix; otherwise null - * @exception IllegalArgumentException if prefix is null + * @throws IllegalArgumentException if prefix is null * or startingRow is out of bounds * @since 1.4 */ @@ -5053,7 +5053,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return This component's locale. If this component does not have * a locale, the locale of its parent is returned. - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet * been added to a containment hierarchy such that the locale can be * determined from the containing parent. diff --git a/src/java.desktop/share/classes/javax/swing/JViewport.java b/src/java.desktop/share/classes/javax/swing/JViewport.java index e3974a84f27761730a95371f7e6968cd1c9c8e31..ff082acc694bdfd768c69ae95842c2182f1f0d75 100644 --- a/src/java.desktop/share/classes/javax/swing/JViewport.java +++ b/src/java.desktop/share/classes/javax/swing/JViewport.java @@ -565,7 +565,7 @@ public class JViewport extends JComponent implements Accessible * a JViewPort. * * @param border the Border to set - * @exception IllegalArgumentException this method is not implemented + * @throws IllegalArgumentException this method is not implemented */ public final void setBorder(Border border) { if (border != null) { diff --git a/src/java.desktop/share/classes/javax/swing/JWindow.java b/src/java.desktop/share/classes/javax/swing/JWindow.java index 69269c9f284ce1354a7fcadc6db024ee7192f483..a306ea6d4ea1b95e2291032005d4583e25a2afbf 100644 --- a/src/java.desktop/share/classes/javax/swing/JWindow.java +++ b/src/java.desktop/share/classes/javax/swing/JWindow.java @@ -387,10 +387,10 @@ public class JWindow extends Window implements Accessible, * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer @@ -504,7 +504,7 @@ public class JWindow extends Window implements Accessible, * * @param contentPane the new contentPane * - * @exception IllegalComponentStateException (a runtime + * @throws IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see #getContentPane * @see RootPaneContainer#setContentPane @@ -532,7 +532,7 @@ public class JWindow extends Window implements Accessible, * * @param layeredPane the new layeredPane object * - * @exception IllegalComponentStateException (a runtime + * @throws IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane diff --git a/src/java.desktop/share/classes/javax/swing/OverlayLayout.java b/src/java.desktop/share/classes/javax/swing/OverlayLayout.java index 0067f6fd6bd54bab9fe7b8461f4917852bcc1579..71ca34f1aa069ab14f5c2d49310d8e18b45c808c 100644 --- a/src/java.desktop/share/classes/javax/swing/OverlayLayout.java +++ b/src/java.desktop/share/classes/javax/swing/OverlayLayout.java @@ -217,7 +217,7 @@ public class OverlayLayout implements LayoutManager2,Serializable { * * @param target the container to lay out * - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * constructor */ public void layoutContainer(Container target) { diff --git a/src/java.desktop/share/classes/javax/swing/Popup.java b/src/java.desktop/share/classes/javax/swing/Popup.java index 605ecd6fd78099b72d97f605246788da84c9de0a..15c90ad3be775215efc26bc6b7dd3e44020425f2 100644 --- a/src/java.desktop/share/classes/javax/swing/Popup.java +++ b/src/java.desktop/share/classes/javax/swing/Popup.java @@ -82,7 +82,7 @@ public class Popup { * @param contents Contents of the Popup * @param x Initial x screen coordinate * @param y Initial y screen coordinate - * @exception IllegalArgumentException if contents is null + * @throws IllegalArgumentException if contents is null */ protected Popup(Component owner, Component contents, int x, int y) { this(); diff --git a/src/java.desktop/share/classes/javax/swing/PopupFactory.java b/src/java.desktop/share/classes/javax/swing/PopupFactory.java index 462675fa828587cbe6b08bc2f35151a32b4d9fa4..a30aba6f2fc0a6d359f997c619bdb76567ad0930 100644 --- a/src/java.desktop/share/classes/javax/swing/PopupFactory.java +++ b/src/java.desktop/share/classes/javax/swing/PopupFactory.java @@ -127,7 +127,7 @@ public class PopupFactory { * factory is null. * * @param factory Shared PopupFactory - * @exception IllegalArgumentException if factory is null + * @throws IllegalArgumentException if factory is null * @see #getPopup */ public static void setSharedInstance(PopupFactory factory) { @@ -186,7 +186,7 @@ public class PopupFactory { * @param contents Contents of the Popup * @param x Initial x screen coordinate * @param y Initial y screen coordinate - * @exception IllegalArgumentException if contents is null + * @throws IllegalArgumentException if contents is null * @return Popup containing Contents */ public Popup getPopup(Component owner, Component contents, diff --git a/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java b/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java index 8733d5b3cfef510a19889614ae5ff76e41f43f39..6f2d1eda4b674a4899e0b8d9adb39b440709c343 100644 --- a/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java +++ b/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java @@ -794,7 +794,7 @@ public class ProgressMonitor implements Accessible * @return this component's locale. If this component does not have * a locale, the locale of its parent is returned. * - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet been * added to a containment hierarchy such that the locale can be * determined from the containing parent. diff --git a/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java b/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java index 76dc2286f8725085cba8ce80a279f5150033a25d..b05e0c52e554784c2cb6ff6453d687c3b920cf0b 100644 --- a/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java +++ b/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java @@ -103,7 +103,7 @@ public interface RootPaneContainer * Generally implemented with * getRootPane().setContentPane(contentPane); * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @param contentPane the Container to use for the contents of this * JRootPane @@ -134,7 +134,7 @@ public interface RootPaneContainer * getRootPane().setLayeredPane(layeredPane); * * @param layeredPane the layered pane - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see #getLayeredPane * @see JRootPane#getLayeredPane diff --git a/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java b/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java index 9f9e66606664bbd0cb6cdd55fccefe71b3960a5b..0b8d8576f1469f1f60c25c36875599de1a91d973 100644 --- a/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java +++ b/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java @@ -230,7 +230,7 @@ public class ScrollPaneLayout * * @param s the component identifier * @param c the component to be added - * @exception IllegalArgumentException if s is an invalid key + * @throws IllegalArgumentException if s is an invalid key */ public void addLayoutComponent(String s, Component c) { @@ -328,7 +328,7 @@ public class ScrollPaneLayout * with the Swing 1.0.2 (and earlier) versions of this class. * * @param x an integer giving the display policy - * @exception IllegalArgumentException if x is an invalid + * @throws IllegalArgumentException if x is an invalid * vertical scroll bar policy, as listed above */ public void setVerticalScrollBarPolicy(int x) { @@ -366,7 +366,7 @@ public class ScrollPaneLayout * with the Swing 1.0.2 (and earlier) versions of this class. * * @param x an int giving the display policy - * @exception IllegalArgumentException if x is not a valid + * @throws IllegalArgumentException if x is not a valid * horizontal scrollbar policy, as listed above */ public void setHorizontalScrollBarPolicy(int x) { diff --git a/src/java.desktop/share/classes/javax/swing/SizeSequence.java b/src/java.desktop/share/classes/javax/swing/SizeSequence.java index 899a64570f3145d3ab0b51315cba10af4ebb6edf..c6877dc8b2b1b15ef75563017ba19fb9c3cd83d6 100644 --- a/src/java.desktop/share/classes/javax/swing/SizeSequence.java +++ b/src/java.desktop/share/classes/javax/swing/SizeSequence.java @@ -142,7 +142,7 @@ public class SizeSequence { * all initialized to have size 0. * * @param numEntries the number of sizes to track - * @exception NegativeArraySizeException if + * @throws NegativeArraySizeException if * numEntries < 0 */ public SizeSequence(int numEntries) { @@ -355,7 +355,7 @@ public class SizeSequence { * in the group * @param length the number of entries in the group * @param value the size to be assigned to each new entry - * @exception ArrayIndexOutOfBoundsException if the parameters + * @throws ArrayIndexOutOfBoundsException if the parameters * are outside of the range: * (0 <= start < (getSizes().length)) AND (length >= 0) */ diff --git a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java index 5e3965e69b8edf7601ec495dd0c1aaefe251352a..1d58541dfee4f2e20a4173b329249b6f2446e01f 100644 --- a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java +++ b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java @@ -1466,10 +1466,10 @@ public class SwingUtilities implements SwingConstants * java.awt.EventQueue.invokeAndWait(). * * @param doRun the instance of {@code Runnable} - * @exception InterruptedException if we're interrupted while waiting for + * @throws InterruptedException if we're interrupted while waiting for * the event dispatching thread to finish executing * doRun.run() - * @exception InvocationTargetException if an exception is thrown + * @throws InvocationTargetException if an exception is thrown * while running doRun * * @see #invokeLater @@ -1984,7 +1984,7 @@ public class SwingUtilities implements SwingConstants * Returns a toolkit-private, shared, invisible Frame * to be the owner for JDialogs and JWindows created with * {@code null} owners. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -2002,7 +2002,7 @@ public class SwingUtilities implements SwingConstants /** * Returns a SharedOwnerFrame's shutdown listener to dispose the SharedOwnerFrame * if it has no more displayable children. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ diff --git a/src/java.desktop/share/classes/javax/swing/Timer.java b/src/java.desktop/share/classes/javax/swing/Timer.java index 6b4f95be108038b04c2989d0cd6d393e97595f53..ced691f4e06d6398cd08dcce339fdcd9496bdcfa 100644 --- a/src/java.desktop/share/classes/javax/swing/Timer.java +++ b/src/java.desktop/share/classes/javax/swing/Timer.java @@ -341,7 +341,7 @@ public class Timer implements Serializable * on this timer, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType doesn't + * @throws ClassCastException if listenerType doesn't * specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/TransferHandler.java b/src/java.desktop/share/classes/javax/swing/TransferHandler.java index f2622880e7fa3e6576df41ee1f9bdc2e354f2444..445234e4bdab544bea5349cee36b18d69832ed42 100644 --- a/src/java.desktop/share/classes/javax/swing/TransferHandler.java +++ b/src/java.desktop/share/classes/javax/swing/TransferHandler.java @@ -1172,9 +1172,9 @@ public class TransferHandler implements Serializable { * * @param flavor the requested flavor for the data * @see DataFlavor#getRepresentationClass - * @exception IOException if the data is no longer available + * @throws IOException if the data is no longer available * in the requested flavor. - * @exception UnsupportedFlavorException if the requested data flavor is + * @throws UnsupportedFlavorException if the requested data flavor is * not supported. */ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { diff --git a/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java b/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java index 2f2163c89397b19e1aafe4e6c0e62b0392a2338c..9a42849251289866e0c0cb6a1aacd9408e7f2a51 100644 --- a/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java +++ b/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java @@ -161,7 +161,7 @@ public abstract class AbstractColorChooserPanel extends JPanel { * If you override this, be sure to call super. * * @param enclosingChooser the chooser to which the panel is to be added - * @exception RuntimeException if the chooser panel has already been + * @throws RuntimeException if the chooser panel has already been * installed */ public void installChooserPanel(JColorChooser enclosingChooser) { diff --git a/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java b/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java index 1be0228864c1e84410ef3138cbda74dc407aef99..81ae23930088de548cd41a41f61bd490b4122dc9 100644 --- a/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java +++ b/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java @@ -144,7 +144,7 @@ public class EventListenerList implements Serializable { * @param the type of {@code EventListener} to search for * @param t the type of {@code EventListener} classes to be returned * @return all of the listeners of the specified type. - * @exception ClassCastException if the supplied class + * @throws ClassCastException if the supplied class * is not assignable to EventListener * * @since 1.3 diff --git a/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java b/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java index cba6691ba58b7091c8db951004c8a299cea0f78e..3c96fdabffd641285c709b88670c38e2fb32eb87 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java @@ -49,7 +49,7 @@ public abstract class TextUI extends ComponentUI * @param t the text component for which this UI is installed * @param pos the local location in the model to translate >= 0 * @return the coordinates as a {@code Rectangle} - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * * @deprecated replaced by @@ -66,7 +66,7 @@ public abstract class TextUI extends ComponentUI * @param pos the local location in the model to translate >= 0 * @param bias the bias for the position * @return the coordinates as a {@code Rectangle} - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * * @deprecated replaced by @@ -86,7 +86,7 @@ public abstract class TextUI extends ComponentUI * @param pos the local location in the model to translate {@code >= 0} * @param bias the bias for the position * @return the coordinates as a {@code Rectangle2D} - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * * @since 9 @@ -178,8 +178,8 @@ public abstract class TextUI extends ComponentUI * @param biasRet an array to contain the bias for the returned position * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException for an invalid direction + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException for an invalid direction */ public abstract int getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java index 3e1108fb25bd2a6e005fc5f96651969936912055..5a7f88ff3cec4f59ab50b93fb2b691a2950918dd 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java @@ -585,9 +585,9 @@ public class BasicHTML { * position is a boundary of two views. * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, int p1, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java index 360e98eee7af162de68e894798021356165e92ff..92d5896bca299a5986512cf630a81717b6bed261 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -775,7 +775,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { * Returns the baseline for the specified tab. * * @param tab index of tab to get baseline for - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * (index < 0 || index >= tab count) * @return baseline or a value < 0 indicating there is no reasonable * baseline diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java index 2e67a99720a58451422a177acb6cccb919fcbe96..5d767d3b7034c81ad9a12b87536033d4c7783faa 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java @@ -345,7 +345,7 @@ public class BasicTextFieldUI extends BasicTextUI { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ @@ -367,9 +367,9 @@ public class BasicTextFieldUI extends BasicTextUI { * position is a boundary of two views. * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 6e98a57e5c31d266480b29822fe60203cdf961fc..881b9557b0c9909e4a593bef74987d6005459206 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -1045,7 +1045,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * @param tc the text component for which this UI is installed * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle, null if the model is not painted - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView * @@ -1067,7 +1067,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * @param tc the text component for which this UI is installed * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle, null if the model is not painted - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView * @@ -1626,9 +1626,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * position is a boundary of two views. * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException { @@ -1674,9 +1674,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * SwingConstants.NORTH, or SwingConstants.SOUTH. * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException for an invalid direction + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java index 544c2ebe73115e55bea3cbfa2d1325cc6fac0939..116226188c9da4ae9952ba95848723b53870ae63 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java @@ -130,9 +130,9 @@ class BasicTransferable implements Transferable, UIResource { * * @param flavor the requested flavor for the data * @see DataFlavor#getRepresentationClass - * @exception IOException if the data is no longer available + * @throws IOException if the data is no longer available * in the requested flavor. - * @exception UnsupportedFlavorException if the requested data flavor is + * @throws UnsupportedFlavorException if the requested data flavor is * not supported. */ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { diff --git a/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java b/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java index 886d0ad64b02faf26c2cc8a6a7bc419a1e019456..99208f3cd266f41470d933722ecbd7bc8e9d68e7 100644 --- a/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java @@ -331,7 +331,7 @@ public abstract class AbstractTableModel implements TableModel, Serializable * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java b/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java index ab5ff974eb9dd96e0ac0e59b852fece5ef314b91..e1a6264a4788ef0a279f58a8eb3d49cf003b3f99 100644 --- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java @@ -109,7 +109,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * event to its listeners. * * @param aColumn the TableColumn to be added - * @exception IllegalArgumentException if aColumn is + * @throws IllegalArgumentException if aColumn is * null * @see #removeColumn */ @@ -170,7 +170,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * * @param columnIndex the index of column to be moved * @param newIndex new index to move the column - * @exception IllegalArgumentException if column or + * @throws IllegalArgumentException if column or * newIndex * are not in the valid range */ @@ -258,7 +258,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * @return the index of the first column in the * tableColumns array whose identifier * is equal to identifier - * @exception IllegalArgumentException if identifier + * @throws IllegalArgumentException if identifier * is null, or if no * TableColumn has this * identifier @@ -368,7 +368,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * an exception is thrown. * * @param newModel the new selection model - * @exception IllegalArgumentException if newModel + * @throws IllegalArgumentException if newModel * is null * @see #getSelectionModel */ @@ -636,7 +636,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * FooListeners on this model, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java b/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java index 08dfc85b0a961ea795bc2aedbf7f991cdfb28237..cdb3f29b76a11efe3f7a78b1590560ecdea5794f 100644 --- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java @@ -375,7 +375,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * * @param row the row index of the row to be inserted * @param rowData optional data of the row being added - * @exception ArrayIndexOutOfBoundsException if the row was invalid + * @throws ArrayIndexOutOfBoundsException if the row was invalid */ public void insertRow(int row, Vector rowData) { dataVector.insertElementAt(rowData, row); @@ -390,7 +390,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * * @param row the row index of the row to be inserted * @param rowData optional data of the row being added - * @exception ArrayIndexOutOfBoundsException if the row was invalid + * @throws ArrayIndexOutOfBoundsException if the row was invalid */ public void insertRow(int row, Object[] rowData) { insertRow(row, convertToVector(rowData)); @@ -438,7 +438,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param start the starting row index to be moved * @param end the ending row index to be moved * @param to the destination of the rows to be moved - * @exception ArrayIndexOutOfBoundsException if any of the elements + * @throws ArrayIndexOutOfBoundsException if any of the elements * would be moved out of the table's range * */ @@ -463,7 +463,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * of the row being removed will be sent to all the listeners. * * @param row the row index of the row to be removed - * @exception ArrayIndexOutOfBoundsException if the row was invalid + * @throws ArrayIndexOutOfBoundsException if the row was invalid */ public void removeRow(int row) { dataVector.removeElementAt(row); @@ -652,7 +652,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param row the row whose value is to be queried * @param column the column whose value is to be queried * @return the value Object at the specified cell - * @exception ArrayIndexOutOfBoundsException if an invalid row or + * @throws ArrayIndexOutOfBoundsException if an invalid row or * column was given */ public Object getValueAt(int row, int column) { @@ -669,7 +669,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param aValue the new value; this can be null * @param row the row whose value is to be changed * @param column the column whose value is to be changed - * @exception ArrayIndexOutOfBoundsException if an invalid row or + * @throws ArrayIndexOutOfBoundsException if an invalid row or * column was given */ public void setValueAt(Object aValue, int row, int column) { diff --git a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java index f36b5646e3d4ffc22728865f8eb171863d8c3ce9..561d6a71c75493b962a6447e30cfbf731c36c3b6 100644 --- a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java +++ b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java @@ -550,7 +550,7 @@ public class JTableHeader extends JComponent implements TableColumnModelListener * for listener notifications from the new column model. * * @param columnModel the new data source for this table - * @exception IllegalArgumentException + * @throws IllegalArgumentException * if newModel is null * @see #getColumnModel */ diff --git a/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java b/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java index eaaa8447ef701f93ce3b08aeef3a0c9f5c109c32..4cf4870b5e3543787deb710cb20c927fc3374627 100644 --- a/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java @@ -79,7 +79,7 @@ public interface TableColumnModel * * @param columnIndex the index of column to be moved * @param newIndex index of the column's new location - * @exception IllegalArgumentException if columnIndex or + * @throws IllegalArgumentException if columnIndex or * newIndex * are not in the valid range */ @@ -119,7 +119,7 @@ public interface TableColumnModel * @param columnIdentifier the identifier object * @return the index of the first table column * whose identifier is equal to identifier - * @exception IllegalArgumentException if identifier + * @throws IllegalArgumentException if identifier * is null, or no * TableColumn has this * identifier diff --git a/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java b/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java index 1b97006bc34723021fef05e40aad70554481f4c5..db19b81e8e50471cb04fb52d0e3e08e4b19230da 100644 --- a/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java @@ -344,7 +344,7 @@ public abstract class AbstractDocument implements Document, Serializable { * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * @@ -604,7 +604,7 @@ public abstract class AbstractDocument implements Document, Serializable { * * @param offs the starting offset >= 0 * @param len the number of characters to remove >= 0 - * @exception BadLocationException the given remove position is not a valid + * @throws BadLocationException the given remove position is not a valid * position within the document * @see Document#remove */ @@ -674,7 +674,7 @@ public abstract class AbstractDocument implements Document, Serializable { * null * is legal, and typically treated as an empty attributeset, * but exact interpretation is left to the subclass - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document * @since 1.4 */ @@ -718,7 +718,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param offs the starting offset >= 0 * @param str the string to insert; does nothing with null/empty strings * @param a the attributes for the inserted content - * @exception BadLocationException the given insert position is not a valid + * @throws BadLocationException the given insert position is not a valid * position within the document * @see Document#insertString */ @@ -792,7 +792,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param offset the starting offset >= 0 * @param length the number of characters to retrieve >= 0 * @return the text - * @exception BadLocationException the range given includes a position + * @throws BadLocationException the range given includes a position * that is not a valid position within the document * @see Document#getText */ @@ -833,7 +833,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param offset the starting offset >= 0 * @param length the number of characters to retrieve >= 0 * @param txt the Segment object to retrieve the text into - * @exception BadLocationException the range given includes a position + * @throws BadLocationException the range given includes a position * that is not a valid position within the document */ public void getText(int offset, int length, Segment txt) throws BadLocationException { @@ -854,7 +854,7 @@ public abstract class AbstractDocument implements Document, Serializable { * * @param offs the position in the model >= 0 * @return the position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see Document#createPosition */ @@ -1354,7 +1354,7 @@ public abstract class AbstractDocument implements Document, Serializable { * Document will be left in a locked state so that no * reading or writing can be done. * - * @exception IllegalStateException thrown on illegal lock + * @throws IllegalStateException thrown on illegal lock * attempt. If the document is implemented properly, this can * only happen if a document listener attempts to mutate the * document. This situation violates the bean event model @@ -1633,7 +1633,7 @@ public abstract class AbstractDocument implements Document, Serializable { * * @param offset the offset in the content >= 0 * @return a Position - * @exception BadLocationException for an invalid offset + * @throws BadLocationException for an invalid offset */ public Position createPosition(int offset) throws BadLocationException; @@ -1652,7 +1652,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @return if the implementation supports a history mechanism, * a reference to an Edit implementation will be returned, * otherwise returns null - * @exception BadLocationException thrown if the area covered by + * @throws BadLocationException thrown if the area covered by * the arguments is not contained in the character sequence */ public UndoableEdit insertString(int where, String str) throws BadLocationException; @@ -1666,7 +1666,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @return If the implementation supports a history mechanism, * a reference to an Edit implementation will be returned, * otherwise null. - * @exception BadLocationException Thrown if the area covered by + * @throws BadLocationException Thrown if the area covered by * the arguments is not contained in the character sequence. */ public UndoableEdit remove(int where, int nitems) throws BadLocationException; @@ -1677,7 +1677,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param where Offset into the sequence to fetch >= 0. * @param len number of characters to copy >= 0. * @return the string - * @exception BadLocationException Thrown if the area covered by + * @throws BadLocationException Thrown if the area covered by * the arguments is not contained in the character sequence. */ public String getString(int where, int len) throws BadLocationException; @@ -1688,7 +1688,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param where the starting offset >= 0 * @param len the number of characters >= 0 * @param txt the target location to copy into - * @exception BadLocationException Thrown if the area covered by + * @throws BadLocationException Thrown if the area covered by * the arguments is not contained in the character sequence. */ public void getChars(int where, int len, Segment txt) throws BadLocationException; @@ -2819,7 +2819,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { writeLock(); @@ -2843,7 +2843,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { writeLock(); @@ -3187,7 +3187,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); @@ -3204,7 +3204,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); diff --git a/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java b/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java index 0ca0fecb5a845fc33616b35b175cdce1df1e7c55..07a8301f0b5e4aebbe4e932d48a21f82e089c2cd 100644 --- a/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java +++ b/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java @@ -270,7 +270,7 @@ public abstract class AbstractWriter { * when encountered. * * @param elem an Element - * @exception BadLocationException if pos represents an invalid + * @throws BadLocationException if pos represents an invalid * location within the document * @return the text as a String */ @@ -286,8 +286,8 @@ public abstract class AbstractWriter { * out. * * @param elem an Element. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void text(Element elem) throws BadLocationException, @@ -462,7 +462,7 @@ public abstract class AbstractWriter { * line is empty, this will not make it so that the current line is * still considered empty. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void indent() throws IOException { int max = getIndentLevel() * getIndentSpace(); @@ -485,7 +485,7 @@ public abstract class AbstractWriter { * the write method that takes a char[]. * * @param ch a char. - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void write(char ch) throws IOException { if (tempChars == null) { @@ -500,7 +500,7 @@ public abstract class AbstractWriter { * write method that takes a char[]. * * @param content a String. - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void write(String content) throws IOException { if (content == null) { @@ -671,7 +671,7 @@ public abstract class AbstractWriter { * pairs. It throws an IOException when encountered. * * @param attr an AttributeSet. - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeAttributes(AttributeSet attr) throws IOException { diff --git a/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java b/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java index a9e4c58fbaa931e5911bbb29db58c7b6af1b43bc..ac0dd40b28a6f6607c2cb472ab370198298c0beb 100644 --- a/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java +++ b/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java @@ -640,7 +640,7 @@ public class AsyncBoxView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getPreferredSpan(int axis) { float margin = getInsetSpan(axis); @@ -665,7 +665,7 @@ public class AsyncBoxView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMinimumSpan(int axis) { if (axis == this.axis) { @@ -693,7 +693,7 @@ public class AsyncBoxView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMaximumSpan(int axis) { if (axis == this.axis) { @@ -773,9 +773,9 @@ public class AsyncBoxView extends View { * next character represented by the offset, in case the * position is a boundary of two views. * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException { @@ -864,9 +864,9 @@ public class AsyncBoxView extends View { * @param biasRet an array contain the bias that was checked * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException if direction is invalid + * @throws IllegalArgumentException if direction is invalid */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/text/BoxView.java b/src/java.desktop/share/classes/javax/swing/text/BoxView.java index afaefacccf5457dcf74c8cfdcf67a4c6e06cf99b..cc21e03902173279df746ef44f86d0d619e2218e 100644 --- a/src/java.desktop/share/classes/javax/swing/text/BoxView.java +++ b/src/java.desktop/share/classes/javax/swing/text/BoxView.java @@ -293,7 +293,7 @@ public class BoxView extends CompositeView { * @param axis may be either View.X_AXIS or * View.Y_AXIS * @return the weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { checkRequests(axis); @@ -473,7 +473,7 @@ public class BoxView extends CompositeView { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document * @see View#modelToView */ @@ -519,7 +519,7 @@ public class BoxView extends CompositeView { * origin and 1.0 indicates alignment to the full span * away from the origin; an alignment of 0.5 would be the * center of the view - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getAlignment(int axis) { checkRequests(axis); @@ -540,7 +540,7 @@ public class BoxView extends CompositeView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getPreferredSpan(int axis) { checkRequests(axis); @@ -563,7 +563,7 @@ public class BoxView extends CompositeView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMinimumSpan(int axis) { checkRequests(axis); @@ -586,7 +586,7 @@ public class BoxView extends CompositeView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMaximumSpan(int axis) { checkRequests(axis); @@ -919,7 +919,7 @@ public class BoxView extends CompositeView { /** * Checks the request cache and update if needed. * @param axis the axis being studied - * @exception IllegalArgumentException if axis is + * @throws IllegalArgumentException if axis is * neither View.X_AXIS nor View.Y_AXIS */ void checkRequests(int axis) { diff --git a/src/java.desktop/share/classes/javax/swing/text/ComponentView.java b/src/java.desktop/share/classes/javax/swing/text/ComponentView.java index a4aaa30e512bcc585064331d7b8f9de209a54735..0d8743f86edad48cebe44313e9a291cad5408f2e 100644 --- a/src/java.desktop/share/classes/javax/swing/text/ComponentView.java +++ b/src/java.desktop/share/classes/javax/swing/text/ComponentView.java @@ -132,7 +132,7 @@ public class ComponentView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getPreferredSpan(int axis) { if ((axis != X_AXIS) && (axis != Y_AXIS)) { @@ -160,7 +160,7 @@ public class ComponentView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getMinimumSpan(int axis) { if ((axis != X_AXIS) && (axis != Y_AXIS)) { @@ -188,7 +188,7 @@ public class ComponentView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getMaximumSpan(int axis) { if ((axis != X_AXIS) && (axis != Y_AXIS)) { @@ -325,7 +325,7 @@ public class ComponentView extends View { * @param pos the position to convert >=0 * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/CompositeView.java b/src/java.desktop/share/classes/javax/swing/text/CompositeView.java index 343c02feddc17be09cd220ef71e32e1dd87be07a..5220395d35ad05fb2615d3ff92d9768f27c1b433 100644 --- a/src/java.desktop/share/classes/javax/swing/text/CompositeView.java +++ b/src/java.desktop/share/classes/javax/swing/text/CompositeView.java @@ -244,7 +244,7 @@ public abstract class CompositeView extends View { * @param b a bias value of either Position.Bias.Forward * or Position.Bias.Backward * @return the bounding box of the given position - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document * @see View#modelToView */ @@ -294,9 +294,9 @@ public abstract class CompositeView extends View { * position is a boundary of two views * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException { @@ -458,9 +458,9 @@ public abstract class CompositeView extends View { * @param biasRet an array containing the bias that was checked * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException if direction is invalid + * @throws IllegalArgumentException if direction is invalid */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) @@ -715,8 +715,8 @@ public abstract class CompositeView extends View { * @param biasRet an array containing the bias that was checked * @return the location within the model that best represents the next * north or south location - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException if direction is invalid + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException if direction is invalid * @see #getNextVisualPositionFrom */ protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b, @@ -748,8 +748,8 @@ public abstract class CompositeView extends View { * @param biasRet an array containing the bias that was checked * @return the location within the model that best represents the next * west or east location - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException if direction is invalid + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException if direction is invalid * @see #getNextVisualPositionFrom */ protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b, diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java b/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java index a980268bd941d503ffa44a23386abc6cebb86b0e..ff4d37224e370f9f3fa43a694503aa1d7e958466 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java @@ -870,7 +870,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java index ee1db4739ceaf27c0b8c72ecdb5c3a802b2c9135..2d9971d3794300630524e3c92ebae0f89550a5e8 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java @@ -142,8 +142,8 @@ public class DefaultEditorKit extends EditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(InputStream in, Document doc, int pos) @@ -161,8 +161,8 @@ public class DefaultEditorKit extends EditorKit { * @param pos The location in the document to fetch the * content >=0. * @param len The amount to write out >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void write(OutputStream out, Document doc, int pos, int len) @@ -193,8 +193,8 @@ public class DefaultEditorKit extends EditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(Reader in, Document doc, int pos) @@ -303,8 +303,8 @@ public class DefaultEditorKit extends EditorKit { * @param pos The location in the document to fetch the * content from >=0. * @param len The amount to write out >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos is not within 0 and + * @throws IOException on any I/O error + * @throws BadLocationException if pos is not within 0 and * the length of the document. */ public void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java b/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java index 4e874ec1f007433bff147c63cd7ab12889161afb..0465b9157e28f959a68041861eb69c132fef5a12 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java @@ -110,7 +110,7 @@ public class DefaultHighlighter extends LayeredHighlighter { * @param p the painter to use to actually render the highlight * @return an object that can be used as a tag * to refer to the highlight - * @exception BadLocationException if the specified location is invalid + * @throws BadLocationException if the specified location is invalid */ public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter p) throws BadLocationException { if (p0 < 0) { @@ -222,7 +222,7 @@ public class DefaultHighlighter extends LayeredHighlighter { * @param tag the highlight tag * @param p0 the beginning of the range >= 0 * @param p1 the end of the range >= p0 - * @exception BadLocationException if the specified location is invalid + * @throws BadLocationException if the specified location is invalid */ public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException { if (p0 < 0) { diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java b/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java index f549f522ff2b7513449091c0a64ca8aebe4636ac..5d373177eaf0b96295e672c2bfaaa3da3c8a41b9 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java @@ -182,7 +182,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * * @param offset the starting offset >= 0 * @param data the element data - * @exception BadLocationException for an invalid starting offset + * @throws BadLocationException for an invalid starting offset */ protected void insert(int offset, ElementSpec[] data) throws BadLocationException { if (data == null || data.length == 0) { @@ -2548,7 +2548,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); @@ -2562,7 +2562,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); @@ -2604,7 +2604,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); @@ -2614,7 +2614,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); diff --git a/src/java.desktop/share/classes/javax/swing/text/Document.java b/src/java.desktop/share/classes/javax/swing/text/Document.java index e0f4ac791d5e8962a593fcb51f8dea61351cef15..09f162733cfcb97bd959e44827c11bb0690e1d83 100644 --- a/src/java.desktop/share/classes/javax/swing/text/Document.java +++ b/src/java.desktop/share/classes/javax/swing/text/Document.java @@ -453,7 +453,7 @@ public interface Document { * * @param offs the offset from the beginning >= 0 * @param len the number of characters to remove >= 0 - * @exception BadLocationException some portion of the removal range + * @throws BadLocationException some portion of the removal range * was not a valid part of the document. The location in the exception * is the first bad position encountered. * @see javax.swing.event.DocumentEvent @@ -490,7 +490,7 @@ public interface Document { * @param str the string to insert * @param a the attributes to associate with the inserted * content. This may be null if there are no attributes. - * @exception BadLocationException the given insert position is not a valid + * @throws BadLocationException the given insert position is not a valid * position within the document * @see javax.swing.event.DocumentEvent * @see javax.swing.event.DocumentListener @@ -507,7 +507,7 @@ public interface Document { * start of the text >= 0 * @param length the length of the desired string >= 0 * @return the text, in a String of length >= 0 - * @exception BadLocationException some portion of the given range + * @throws BadLocationException some portion of the given range * was not a valid part of the document. The location in the exception * is the first bad position encountered. */ @@ -546,7 +546,7 @@ public interface Document { * @param length the length of the desired string >= 0 * @param txt the Segment object to return the text in * - * @exception BadLocationException Some portion of the given range + * @throws BadLocationException Some portion of the given range * was not a valid part of the document. The location in the exception * is the first bad position encountered. */ @@ -582,7 +582,7 @@ public interface Document { * * @param offs the offset from the start of the document >= 0 * @return the position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document */ public Position createPosition(int offs) throws BadLocationException; diff --git a/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java b/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java index 5f69882ff8ef9733f66560f0ad1aa21071bcc342..d0334bce45e11a324d515c45d1dfb19f1bcc8f78 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java +++ b/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java @@ -75,7 +75,7 @@ public class DocumentFilter { * @param fb FilterBypass that can be used to mutate Document * @param offset the offset from the beginning >= 0 * @param length the number of characters to remove >= 0 - * @exception BadLocationException some portion of the removal range + * @throws BadLocationException some portion of the removal range * was not a valid part of the document. The location in the exception * is the first bad position encountered. */ @@ -97,7 +97,7 @@ public class DocumentFilter { * @param string the string to insert * @param attr the attributes to associate with the inserted * content. This may be null if there are no attributes. - * @exception BadLocationException the given insert position is not a + * @throws BadLocationException the given insert position is not a * valid position within the document */ public void insertString(FilterBypass fb, int offset, String string, @@ -117,7 +117,7 @@ public class DocumentFilter { * @param text Text to insert, null indicates no text to insert * @param attrs AttributeSet indicating attributes of inserted text, * null is legal. - * @exception BadLocationException the given insert position is not a + * @throws BadLocationException the given insert position is not a * valid position within the document */ public void replace(FilterBypass fb, int offset, int length, String text, @@ -153,7 +153,7 @@ public class DocumentFilter { * * @param offset the offset from the beginning >= 0 * @param length the number of characters to remove >= 0 - * @exception BadLocationException some portion of the removal range + * @throws BadLocationException some portion of the removal range * was not a valid part of the document. The location in the * exception is the first bad position encountered. */ @@ -169,7 +169,7 @@ public class DocumentFilter { * @param string the string to insert * @param attr the attributes to associate with the inserted * content. This may be null if there are no attributes. - * @exception BadLocationException the given insert position is not a + * @throws BadLocationException the given insert position is not a * valid position within the document */ public abstract void insertString(int offset, String string, @@ -186,7 +186,7 @@ public class DocumentFilter { * @param string Text to insert, null indicates no text to insert * @param attrs AttributeSet indicating attributes of inserted text, * null is legal. - * @exception BadLocationException the given insert is not a + * @throws BadLocationException the given insert is not a * valid position within the document */ public abstract void replace(int offset, int length, String string, diff --git a/src/java.desktop/share/classes/javax/swing/text/EditorKit.java b/src/java.desktop/share/classes/javax/swing/text/EditorKit.java index 9163a6361e4cc3cc77a3fc153d170c97c241c9e1..cd491fb5bac4b5abff14c9c00129a65588b01051 100644 --- a/src/java.desktop/share/classes/javax/swing/text/EditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/EditorKit.java @@ -141,8 +141,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void read(InputStream in, Document doc, int pos) @@ -157,8 +157,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param pos The location in the document to fetch the * content from >= 0. * @param len The amount to write out >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void write(OutputStream out, Document doc, int pos, int len) @@ -178,8 +178,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void read(Reader in, Document doc, int pos) @@ -199,8 +199,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param pos The location in the document to fetch the * content >= 0. * @param len The amount to write out >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/text/FieldView.java b/src/java.desktop/share/classes/javax/swing/text/FieldView.java index 936a78700beb40346c5bf38e1507c1b56eae4556..b5ad636994527f59113ebb51eb2b28c07961aff2 100644 --- a/src/java.desktop/share/classes/javax/swing/text/FieldView.java +++ b/src/java.desktop/share/classes/javax/swing/text/FieldView.java @@ -258,7 +258,7 @@ public class FieldView extends PlainView { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/GapContent.java b/src/java.desktop/share/classes/javax/swing/text/GapContent.java index c59c350541b117fad90cd1c992cb4d5fe88d5836..6c96b2b0ec3db8db94b91ebc0101385de3caabae 100644 --- a/src/java.desktop/share/classes/javax/swing/text/GapContent.java +++ b/src/java.desktop/share/classes/javax/swing/text/GapContent.java @@ -130,7 +130,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0, < length() * @param str the non-null string to insert * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#insertString */ public UndoableEdit insertString(int where, String str) throws BadLocationException { @@ -148,7 +148,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0, where + nitems < length() * @param nitems the number of characters to remove >= 0 * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#remove */ public UndoableEdit remove(int where, int nitems) throws BadLocationException { @@ -168,7 +168,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0 * @param len the length to retrieve >= 0 * @return a string representing the content - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getString */ public String getString(int where, int len) throws BadLocationException { @@ -186,7 +186,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0, where + len <= length() * @param len the number of characters to retrieve >= 0 * @param chars the Segment object to return the characters in - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getChars */ public void getChars(int where, int len, Segment chars) throws BadLocationException { @@ -237,7 +237,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * * @param offset the offset to track >= 0 * @return the position - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid */ public Position createPosition(int offset) throws BadLocationException { while ( queue.poll() != null ) { diff --git a/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java b/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java index 3a070bb4040f605712ffd4fbb9bc1087575871ac..59e2a9da491cff09b9c29de942560dc87e922289 100644 --- a/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java +++ b/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java @@ -231,8 +231,8 @@ class GlyphPainter2 extends GlyphView.GlyphPainter { * SwingConstants.NORTH, or SwingConstants.SOUTH. * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException - * @exception IllegalArgumentException for an invalid direction + * @throws BadLocationException + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b, Shape a, diff --git a/src/java.desktop/share/classes/javax/swing/text/GlyphView.java b/src/java.desktop/share/classes/javax/swing/text/GlyphView.java index b075356593c595e667935f58a5d6846ada4b8aae..8a4828f62d54775aea6d64560722dddd8bbdfd82 100644 --- a/src/java.desktop/share/classes/javax/swing/text/GlyphView.java +++ b/src/java.desktop/share/classes/javax/swing/text/GlyphView.java @@ -637,7 +637,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * @param b either Position.Bias.Forward * or Position.Bias.Backward * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ @@ -885,9 +885,9 @@ public class GlyphView extends View implements TabableView, Cloneable { * SwingConstants.NORTH, or SwingConstants.SOUTH. * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException for an invalid direction + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, @@ -1199,7 +1199,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * or Position.Bias.Backward * @param a Bounds of the View * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ @@ -1283,8 +1283,8 @@ public class GlyphView extends View implements TabableView, Cloneable { * is returned as the zero-th element of this array * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException for an invalid direction + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b, Shape a, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/text/Highlighter.java b/src/java.desktop/share/classes/javax/swing/text/Highlighter.java index 10243f10cdd9b34d9e2e6a7c907bee56f0ccbd15..7913e47b948c28e232e89975be00d0b798948fc0 100644 --- a/src/java.desktop/share/classes/javax/swing/text/Highlighter.java +++ b/src/java.desktop/share/classes/javax/swing/text/Highlighter.java @@ -70,7 +70,7 @@ public interface Highlighter { * @param p1 the end of the range >= p0 * @param p the painter to use for the actual highlighting * @return an object that refers to the highlight - * @exception BadLocationException for an invalid range specification + * @throws BadLocationException for an invalid range specification */ public Object addHighlight(int p0, int p1, HighlightPainter p) throws BadLocationException; @@ -95,7 +95,7 @@ public interface Highlighter { * @param tag which highlight to change * @param p0 the beginning of the range >= 0 * @param p1 the end of the range >= p0 - * @exception BadLocationException for an invalid range specification + * @throws BadLocationException for an invalid range specification */ public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException; diff --git a/src/java.desktop/share/classes/javax/swing/text/IconView.java b/src/java.desktop/share/classes/javax/swing/text/IconView.java index c908e973753cc385e1c8f2ba0c4b406a95a8f4e2..76cb653c9ae0d14484400b1c99dbfb46ac5f602b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/IconView.java +++ b/src/java.desktop/share/classes/javax/swing/text/IconView.java @@ -81,7 +81,7 @@ public class IconView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getPreferredSpan(int axis) { switch (axis) { @@ -123,7 +123,7 @@ public class IconView extends View { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java index cbdd308cc84b81dc0b516a9da0ad7d9d25e5105c..d618dc6a2a1989db5a22684e4d6e99340980c433 100644 --- a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java +++ b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java @@ -672,7 +672,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * component's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -1358,7 +1358,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @param offs the offset ≥ 0 * @param len the length ≥ 0 * @return the text - * @exception BadLocationException if the offset or length are invalid + * @throws BadLocationException if the offset or length are invalid */ public String getText(int offs, int len) throws BadLocationException { return getDocument().getText(offs, len); @@ -1376,7 +1376,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @return the coordinates as a rectangle, with (r.x, r.y) as the location * in the coordinate system, or null if the component does * not yet have a positive size. - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView * @@ -1400,7 +1400,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @return the coordinates as a rectangle, with (r.x, r.y) as the location * in the coordinate system, or null if the component does * not yet have a positive size. - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView2D * @@ -1545,7 +1545,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * an exception is thrown. * * @param pos the position - * @exception IllegalArgumentException if the value supplied + * @throws IllegalArgumentException if the value supplied * for position is less than zero or greater * than the component's text length * @see #setCaretPosition @@ -1617,7 +1617,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * of documents (such as html for example) might be * able to make use of this information; if non-null, * it is added as a property of the document - * @exception IOException as thrown by the stream being + * @throws IOException as thrown by the stream being * used to initialize * @see EditorKit#createDefaultDocument * @see #setDocument @@ -1643,7 +1643,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * text. * * @param out the output stream - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ public void write(Writer out) throws IOException { Document doc = getDocument(); @@ -1672,7 +1672,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * an exception is thrown. * * @param position the position - * @exception IllegalArgumentException if the value supplied + * @throws IllegalArgumentException if the value supplied * for position is less than zero or greater * than the component's text length */ @@ -1743,7 +1743,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * use DocumentListener. * * @return the text - * @exception NullPointerException if the document is null + * @throws NullPointerException if the document is null * @see #setText */ public String getText() { @@ -1763,7 +1763,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * null or the document empty, returns null. * * @return the text - * @exception IllegalArgumentException if the selection doesn't + * @throws IllegalArgumentException if the selection doesn't * have a valid mapping into the document for some reason * @see #setText */ @@ -2013,7 +2013,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @param direction less than zero to scroll up/left, greater than * zero for down/right * @return the "unit" increment for scrolling in the specified direction - * @exception IllegalArgumentException for an invalid orientation + * @throws IllegalArgumentException for an invalid orientation * @see JScrollBar#setUnitIncrement */ public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { @@ -2043,7 +2043,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @param direction less than zero to scroll up/left, greater than zero * for down/right * @return the "block" increment for scrolling in the specified direction - * @exception IllegalArgumentException for an invalid orientation + * @throws IllegalArgumentException for an invalid orientation * @see JScrollBar#setBlockIncrement */ public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { diff --git a/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java b/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java index 648625e8974f7b8e832412561aa4e99226105caa..a7d85a71e02d130cb67b4508862c0f1bccd1a22e 100644 --- a/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java +++ b/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java @@ -105,8 +105,8 @@ public class NavigationFilter { * @param biasRet Used to return resulting Bias of next position * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException if direction + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException if direction * doesn't have one of the legal values above */ public int getNextVisualPositionFrom(JTextComponent text, int pos, diff --git a/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java b/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java index f8d0e390cb2a84e9c1f0042dcf213a8d70ddb80a..e24583af13b140a8ec5557169a34161549e21053 100644 --- a/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java +++ b/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java @@ -876,7 +876,7 @@ public class ParagraphView extends FlowView implements TabExpander { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/PasswordView.java b/src/java.desktop/share/classes/javax/swing/text/PasswordView.java index 38bb0eec13ea1c1f0bf5daeb926ea454e192c0ca..bdf8d5cdfe64c6aedb7c7b03cdb7dc1fe04fc71f 100644 --- a/src/java.desktop/share/classes/javax/swing/text/PasswordView.java +++ b/src/java.desktop/share/classes/javax/swing/text/PasswordView.java @@ -61,7 +61,7 @@ public class PasswordView extends FieldView { * @param p0 the starting offset in the model >= 0 * @param p1 the ending offset in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if p0 or p1 are out of range + * @throws BadLocationException if p0 or p1 are out of range * * @deprecated replaced by * {@link #drawUnselectedText(Graphics2D, float, float, int, int)} @@ -131,7 +131,7 @@ public class PasswordView extends FieldView { * @param p0 the starting offset in the model >= 0 * @param p1 the ending offset in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if p0 or p1 are out of range + * @throws BadLocationException if p0 or p1 are out of range * * @deprecated replaced by * {@link #drawSelectedText(Graphics2D, float, float, int, int)} @@ -240,7 +240,7 @@ public class PasswordView extends FieldView { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java b/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java index cd397d12a684b17707be2299a5c96f10d5a5d5d9..ad6a0bdf2d3e9b7448830fbcd979569db8bd2792 100644 --- a/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java @@ -107,7 +107,7 @@ public class PlainDocument extends AbstractDocument { * @param offs the starting offset >= 0 * @param str the string to insert; does nothing with null/empty strings * @param a the attributes for the inserted content - * @exception BadLocationException the given insert position is not a valid + * @throws BadLocationException the given insert position is not a valid * position within the document * @see Document#insertString */ diff --git a/src/java.desktop/share/classes/javax/swing/text/PlainView.java b/src/java.desktop/share/classes/javax/swing/text/PlainView.java index 725dec9bb7dd783bb356b2f7392778638cc33693..0c245196d995420f2b8dd0cb786374ba3822d889 100644 --- a/src/java.desktop/share/classes/javax/swing/text/PlainView.java +++ b/src/java.desktop/share/classes/javax/swing/text/PlainView.java @@ -179,7 +179,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= 0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawUnselectedText(Graphics2D, float, float, int, int)} @@ -224,7 +224,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model {@code >= 0} * @param p1 the ending position in the model {@code >= 0} * @return the X location of the end of the range {@code >= 0} - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -245,7 +245,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= 0 * @return the location of the end of the range - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawSelectedText(Graphics2D, float, float, int, int)} @@ -294,7 +294,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model {@code >= 0} * @param p1 the ending position in the model {@code >= 0} * @return the location of the end of the range - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -351,7 +351,7 @@ public class PlainView extends View implements TabExpander { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getPreferredSpan(int axis) { updateMetrics(); @@ -468,7 +468,7 @@ public class PlainView extends View implements TabExpander { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/StringContent.java b/src/java.desktop/share/classes/javax/swing/text/StringContent.java index 7f154df38edffce7203667f93ff9980c0c6268ba..04bd4d7e0b464880b01f3857a57fd6c7c1cb6a8b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/StringContent.java +++ b/src/java.desktop/share/classes/javax/swing/text/StringContent.java @@ -90,7 +90,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 && < length() * @param str the non-null string to insert * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#insertString */ public UndoableEdit insertString(int where, String str) throws BadLocationException { @@ -111,7 +111,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 * @param nitems the number of characters to remove >= 0 * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#remove */ public UndoableEdit remove(int where, int nitems) throws BadLocationException { @@ -134,7 +134,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 * @param len the length to retrieve >= 0 * @return a string representing the content; may be empty - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getString */ public String getString(int where, int len) throws BadLocationException { @@ -150,7 +150,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 * @param len the number of characters to retrieve >= 0 * @param chars the Segment object to return the characters in - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getChars */ public void getChars(int where, int len, Segment chars) throws BadLocationException { @@ -168,7 +168,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * * @param offset the offset to create a position for >= 0 * @return the position - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid */ public Position createPosition(int offset) throws BadLocationException { // some small documents won't have any sticky positions diff --git a/src/java.desktop/share/classes/javax/swing/text/StyleContext.java b/src/java.desktop/share/classes/javax/swing/text/StyleContext.java index 9e01aecd3fb6dc3c5cef3abdfdebf0368cf9c77f..70da1356b99557b11cb9a83540ee0c45b144962c 100644 --- a/src/java.desktop/share/classes/javax/swing/text/StyleContext.java +++ b/src/java.desktop/share/classes/javax/swing/text/StyleContext.java @@ -579,7 +579,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * Context-specific handling of writing out attributes * @param out the output stream * @param a the attribute set - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ public void writeAttributes(ObjectOutputStream out, AttributeSet a) throws IOException { @@ -591,9 +591,9 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * @param in the object stream to read the attribute data from. * @param a the attribute set to place the attribute * definitions in. - * @exception ClassNotFoundException passed upward if encountered + * @throws ClassNotFoundException passed upward if encountered * when reading the object stream. - * @exception IOException passed upward if encountered when + * @throws IOException passed upward if encountered when * reading the object stream. */ public void readAttributes(ObjectInputStream in, @@ -613,7 +613,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * * @param out the output stream * @param a the attribute set - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ public static void writeAttributeSet(ObjectOutputStream out, AttributeSet a) throws IOException { @@ -660,9 +660,9 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * @param in the object stream to read the attribute data from. * @param a the attribute set to place the attribute * definitions in. - * @exception ClassNotFoundException passed upward if encountered + * @throws ClassNotFoundException passed upward if encountered * when reading the object stream. - * @exception IOException passed upward if encountered when + * @throws IOException passed upward if encountered when * reading the object stream. */ public static void readAttributeSet(ObjectInputStream in, @@ -1077,7 +1077,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * Returns the next element of this enumeration. * * @return the next element of this enumeration. - * @exception NoSuchElementException if no more elements exist. + * @throws NoSuchElementException if no more elements exist. * @since 1.0 */ public Object nextElement() { diff --git a/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java index 00ad982cbf45d939dd91fc37146f1018b8eee6b5..a4984efce6c0f609443a661a1c1ed82923def864 100644 --- a/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java @@ -411,7 +411,7 @@ public class StyledEditorKit extends DefaultEditorKit { * * @param e the editor * @return the document - * @exception IllegalArgumentException for the wrong document type + * @throws IllegalArgumentException for the wrong document type */ protected final StyledDocument getStyledDocument(JEditorPane e) { Document d = e.getDocument(); @@ -426,7 +426,7 @@ public class StyledEditorKit extends DefaultEditorKit { * * @param e the editor pane * @return the kit - * @exception IllegalArgumentException for the wrong document type + * @throws IllegalArgumentException for the wrong document type */ protected final StyledEditorKit getStyledEditorKit(JEditorPane e) { EditorKit k = e.getEditorKit(); diff --git a/src/java.desktop/share/classes/javax/swing/text/TableView.java b/src/java.desktop/share/classes/javax/swing/text/TableView.java index bd1c677ffaec7d48d74ba615dc23f52490775e0f..d18bd5a93db49bd3db24cb1b0e69c4da2836edd5 100644 --- a/src/java.desktop/share/classes/javax/swing/text/TableView.java +++ b/src/java.desktop/share/classes/javax/swing/text/TableView.java @@ -805,7 +805,7 @@ public abstract class TableView extends BoxView { * * @param axis may be either View.X_AXIS or View.Y_AXIS * @return the resize weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { return 1; diff --git a/src/java.desktop/share/classes/javax/swing/text/Utilities.java b/src/java.desktop/share/classes/javax/swing/text/Utilities.java index ae93b5a40b5f01dc1a79ec277bcf0cfbfc9a27c8..62f323f076aa5ac23eb7481f07935b43e940bb96 100644 --- a/src/java.desktop/share/classes/javax/swing/text/Utilities.java +++ b/src/java.desktop/share/classes/javax/swing/text/Utilities.java @@ -683,7 +683,7 @@ public class Utilities { * @param offs the offset in the document >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ @SuppressWarnings("deprecation") public static final int getRowStart(JTextComponent c, int offs) throws BadLocationException { @@ -714,7 +714,7 @@ public class Utilities { * @param offs the offset in the document >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ @SuppressWarnings("deprecation") public static final int getRowEnd(JTextComponent c, int offs) throws BadLocationException { @@ -747,7 +747,7 @@ public class Utilities { * @param x the X coordinate >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @deprecated replaced by * {@link #getPositionAbove(JTextComponent, int, float)} @@ -802,7 +802,7 @@ public class Utilities { * @param x the X coordinate {@code >= 0} * @return the position {@code >= 0} if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @since 9 */ @@ -822,7 +822,7 @@ public class Utilities { * @param x the X coordinate >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @deprecated replaced by * {@link #getPositionBelow(JTextComponent, int, float)} @@ -878,7 +878,7 @@ public class Utilities { * @param x the X coordinate {@code >= 0} * @return the position {@code >= 0} if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @since 9 */ @@ -894,7 +894,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word start >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getWordStart(JTextComponent c, int offs) throws BadLocationException { Document doc = c.getDocument(); @@ -928,7 +928,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word end >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException { Document doc = c.getDocument(); @@ -961,7 +961,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word start >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getNextWord(JTextComponent c, int offs) throws BadLocationException { int nextWord; @@ -1039,7 +1039,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word start >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getPreviousWord(JTextComponent c, int offs) throws BadLocationException { int prevWord; @@ -1271,8 +1271,8 @@ public class Utilities { * @param biasRet an array contain the bias that was checked * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException - * @exception IllegalArgumentException if direction is invalid + * @throws BadLocationException + * @throws IllegalArgumentException if direction is invalid */ static int getNextVisualPositionFrom(View v, int pos, Position.Bias b, Shape alloc, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/text/View.java b/src/java.desktop/share/classes/javax/swing/text/View.java index a3ad927e3a8e5185d471f53677be8715f96a1e43..eb10efb0e83fb36f933dd46c20a72b74da601604 100644 --- a/src/java.desktop/share/classes/javax/swing/text/View.java +++ b/src/java.desktop/share/classes/javax/swing/text/View.java @@ -495,9 +495,9 @@ public abstract class View implements SwingConstants { * @param biasRet the returned bias * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException if direction + * @throws IllegalArgumentException if direction * doesn't have one of the legal values above */ @SuppressWarnings("deprecation") @@ -585,9 +585,9 @@ public abstract class View implements SwingConstants { * * @return the bounding box, in view coordinate space, * of the character at the specified position - * @exception BadLocationException if the specified position does + * @throws BadLocationException if the specified position does * not represent a valid location in the associated document - * @exception IllegalArgumentException if b is not one of the + * @throws IllegalArgumentException if b is not one of the * legal Position.Bias values listed above * @see View#viewToModel */ @@ -615,9 +615,9 @@ public abstract class View implements SwingConstants { * @param a the area of the view, which encompasses the requested region * @return the bounding box which is a union of the region specified * by the first and last character positions - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException if b0 or + * @throws IllegalArgumentException if b0 or * b1 are not one of the * legal Position.Bias values listed above * @see View#viewToModel @@ -1337,7 +1337,7 @@ public abstract class View implements SwingConstants { * @param pos the position to convert >= 0 * @param a the allocated region in which to render * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document * @see View#modelToView * @deprecated diff --git a/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java b/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java index b229fa69f9f88c1ddeccf9a9508a4b3cc79104ca..d3587c8b40b4bd56b40dc98cb399ac8f6d9e8a50 100644 --- a/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java +++ b/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java @@ -207,7 +207,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawUnselectedText(Graphics2D, float, float, int, int)} @@ -252,7 +252,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -272,7 +272,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the location of the end of the range. - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawSelectedText(Graphics2D, float, float, int, int)} @@ -320,7 +320,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the location of the end of the range. - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -748,7 +748,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/ZoneView.java b/src/java.desktop/share/classes/javax/swing/text/ZoneView.java index 1deb927fb6e5fdc558c75710c8a6caef5cff7598..595eafc336bd9ec71cb7df0da0f6c118665a4d2b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/ZoneView.java +++ b/src/java.desktop/share/classes/javax/swing/text/ZoneView.java @@ -134,7 +134,7 @@ public class ZoneView extends BoxView { * * @param mzl the desired maximum number of zones * to be actively loaded, must be greater than 0 - * @exception IllegalArgumentException if mzl is < 1 + * @throws IllegalArgumentException if mzl is < 1 */ public void setMaxZonesLoaded(int mzl) { if (mzl < 1) { @@ -579,7 +579,7 @@ public class ZoneView extends BoxView { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java b/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java index 12cd5a74a721795e3814091d2bdd31621d3491e9..77623a541e00d3aa059c2d2483ae9765d1e95dbf 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java @@ -384,7 +384,7 @@ class AccessibleHTML implements Accessible { * @return this component's locale. If this component does not have * a locale, the locale of its parent is returned. * - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet been * added to a containment hierarchy such that the locale can be * determined from the containing parent. diff --git a/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java b/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java index 524a57d93c1ee47ddfd762d46b56effeff90459f..dc2a5e22477128b73508d6f9de47acbfc1b9cd07 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java @@ -300,7 +300,7 @@ public class BlockView extends BoxView { * * @param axis may be either X_AXIS or Y_AXIS * @return the weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { switch (axis) { @@ -356,7 +356,7 @@ public class BlockView extends BoxView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getPreferredSpan(int axis) { return super.getPreferredSpan(axis); @@ -372,7 +372,7 @@ public class BlockView extends BoxView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMinimumSpan(int axis) { return super.getMinimumSpan(axis); @@ -388,7 +388,7 @@ public class BlockView extends BoxView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMaximumSpan(int axis) { return super.getMaximumSpan(axis); diff --git a/src/java.desktop/share/classes/javax/swing/text/html/FormView.java b/src/java.desktop/share/classes/javax/swing/text/html/FormView.java index 467651a9d98d2071c3aa6c5165eb92d3e45f800d..b0855832a1d3924b9299b1afaec5c1fc8b4ac570 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/FormView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/FormView.java @@ -380,7 +380,7 @@ public class FormView extends ComponentView implements ActionListener { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getMaximumSpan(int axis) { switch (axis) { diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java b/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java index 885f0b7f2c9d63411d4b0210a5d22c957531db11..29a7fce803df876197d20c091f96452bc1163b9d 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java @@ -245,7 +245,7 @@ class HRuleView extends View { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java index 46d84e3cadcc31da718c032f2d172a431dc3501a..f4bbb772e78c70d50035a5b751e156abae21226a 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java @@ -427,7 +427,7 @@ public class HTMLDocument extends DefaultStyledDocument { * * @param offset the starting offset * @param data the element data - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document. */ protected void insert(int offset, ElementSpec[] data) throws BadLocationException { diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java index 8d78819b0e8d4e169bf6894804976c50fcf784e2..a5c1067f03f1f4fb25918668b6a2302d5bb77fb7 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java @@ -298,10 +298,10 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * @param doc the destination for the insertion * @param pos the location in the document to place the * content - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document - * @exception RuntimeException (will eventually be a BadLocationException) + * @throws RuntimeException (will eventually be a BadLocationException) * if pos is invalid */ public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException { @@ -337,7 +337,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * * @throws BadLocationException if {@code offset} is invalid * @throws IOException on I/O error - * @exception RuntimeException (will eventually be a BadLocationException) + * @throws RuntimeException (will eventually be a BadLocationException) * if pos is invalid */ public void insertHTML(HTMLDocument doc, int offset, String html, @@ -367,8 +367,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * @param pos the location in the document to fetch the * content * @param len the amount to write out - * @exception IOException on any I/O error - * @exception BadLocationException if {@code pos} represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if {@code pos} represents an invalid * location within the document */ public void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java index c11214d71e3bce696dcef6900888ad0eabf6ce92..270e46153098e93549e69cb4006b2dd97c5a759c 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java @@ -125,8 +125,8 @@ public class HTMLWriter extends AbstractWriter { * Element tree and controls the writing out of * all the tags and its attributes. * - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. * */ @@ -248,7 +248,7 @@ public class HTMLWriter extends AbstractWriter { * HTML.Attribute.ENDTAG. * * @param attr an AttributeSet - * @exception IOException on any I/O error + * @throws IOException on any I/O error * */ protected void writeAttributes(AttributeSet attr) throws IOException { @@ -273,8 +273,8 @@ public class HTMLWriter extends AbstractWriter { * corresponding end tag). * * @param elem an Element - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void emptyTag(Element elem) throws BadLocationException, IOException { @@ -451,8 +451,8 @@ public class HTMLWriter extends AbstractWriter { * element. * * @param attr an AttributeSet - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void textAreaContent(AttributeSet attr) throws BadLocationException, IOException { @@ -485,8 +485,8 @@ public class HTMLWriter extends AbstractWriter { * out. * * @param elem an Element - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void text(Element elem) throws BadLocationException, IOException { @@ -523,7 +523,7 @@ public class HTMLWriter extends AbstractWriter { * Writes out the content of the SELECT form element. * * @param attr the AttributeSet associated with the form element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void selectContent(AttributeSet attr) throws IOException { Object model = attr.getAttribute(StyleConstants.ModelAttribute); @@ -552,7 +552,7 @@ public class HTMLWriter extends AbstractWriter { /** * Writes out the content of the Option form element. * @param option an Option - * @exception IOException on any I/O error + * @throws IOException on any I/O error * */ protected void writeOption(Option option) throws IOException { @@ -580,7 +580,7 @@ public class HTMLWriter extends AbstractWriter { * Writes out an end tag for the element. * * @param elem an Element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void endTag(Element elem) throws IOException { if (synthesizedElement(elem)) { @@ -615,8 +615,8 @@ public class HTMLWriter extends AbstractWriter { * Writes out comments. * * @param elem an Element - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void comment(Element elem) throws BadLocationException, IOException { @@ -637,8 +637,8 @@ public class HTMLWriter extends AbstractWriter { * Writes out comment string. * * @param string the comment - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ void writeComment(String string) throws IOException { @@ -712,7 +712,7 @@ public class HTMLWriter extends AbstractWriter { * written out. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeEmbeddedTags(AttributeSet attr) throws IOException { @@ -767,7 +767,7 @@ public class HTMLWriter extends AbstractWriter { * end tag is written out. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException { diff --git a/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java b/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java index 6f0a7cbdff41431d09ea34caa4183ed216fb074a..7d2583509c16a4be9fd0c2001c70e67c3ef43af3 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java @@ -557,7 +557,7 @@ public class ImageView extends View { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java b/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java index caa8dd07051938e66e38691ca7fd785fae5d788e..712cb350ee95d5e3036c3bf5963085c2078740e0 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java @@ -128,8 +128,8 @@ public class MinimalHTMLWriter extends AbstractWriter { * Generates HTML output * from a StyledDocument. * - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. * */ @@ -152,7 +152,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * The attribute name and value are separated by a colon. * Each pair is separated by a semicolon. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeAttributes(AttributeSet attr) throws IOException { Enumeration attributeNames = attr.getAttributeNames(); @@ -178,7 +178,7 @@ public class MinimalHTMLWriter extends AbstractWriter { /** * Writes out text. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void text(Element elem) throws IOException, BadLocationException { String contentStr = getText(elem); @@ -196,7 +196,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * indented. Also increments the indent level. * * @param tag a start tag - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeStartTag(String tag) throws IOException { indent(); @@ -211,7 +211,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * indented. Also decrements the indent level. * * @param endTag an end tag - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeEndTag(String endTag) throws IOException { decrIndent(); @@ -230,7 +230,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * document is viewable in applications/browsers * that do not support the tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeHeader() throws IOException { writeStartTag(""); @@ -248,7 +248,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * Writes out all the named styles as the * content of the <style> tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeStyles() throws IOException { /* @@ -338,7 +338,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * that all other tags that have been opened are * appropriately closed off. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeEndParagraph() throws IOException { writeEndMask(fontMask); @@ -359,7 +359,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * style. * * @param elem an element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeStartParagraph(Element elem) throws IOException { AttributeSet attr = elem.getAttributes(); @@ -377,7 +377,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * elements. * * @param elem an element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeLeaf(Element elem) throws IOException { indent(); @@ -434,8 +434,8 @@ public class MinimalHTMLWriter extends AbstractWriter { * * @param elem an element * @param needsIndenting indention will be added if {@code needsIndenting} is {@code true} - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void writeContent(Element elem, boolean needsIndenting) @@ -457,7 +457,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * text based on its attribute settings. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeHTMLTags(AttributeSet attr) throws IOException { @@ -522,7 +522,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * Writes out start tags <u>, <i>, and <b> based on * the mask settings. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void writeStartMask(int mask) throws IOException { if (mask != 0) { @@ -542,7 +542,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * Writes out end tags for <u>, <i>, and <b> based on * the mask settings. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void writeEndMask(int mask) throws IOException { if (mask != 0) { @@ -569,7 +569,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * attributes just like inline styles. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeNonHTMLAttributes(AttributeSet attr) throws IOException { @@ -636,7 +636,7 @@ public class MinimalHTMLWriter extends AbstractWriter { *

    * Writes out an end tag for the <font> tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void endFontTag() throws IOException { write(NEWLINE); @@ -655,7 +655,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * new start tag. * * @param style a font style - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void startFontTag(String style) throws IOException { boolean callIndent = false; @@ -676,7 +676,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * any enclosing font tag before writing out a * new start tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void startSpanTag(String style) throws IOException { boolean callIndent = false; @@ -693,7 +693,7 @@ public class MinimalHTMLWriter extends AbstractWriter { /** * Writes out an end tag for the <span> tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void endSpanTag() throws IOException { write(NEWLINE); diff --git a/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java b/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java index 2b84b54b3e162ddb924c985c7d2d63f5fb7b53d8..c7f0ff34a9bd1ff62f6b33197a7e26b20a04cf5c 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java @@ -464,7 +464,7 @@ class OptionListModel extends DefaultListModel implements ListSelectionMod * listenerLists are not duplicated. * * @return a clone of the receiver - * @exception CloneNotSupportedException if the receiver does not + * @throws CloneNotSupportedException if the receiver does not * both (a) implement the Cloneable interface * and (b) define a clone method */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java index 9ce35f47ee9eb420129ac6aef21a54da87209670..35002f9fff27e7887fa672a2bdfd8bc3b89bb9e4 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java @@ -1886,7 +1886,7 @@ public class StyleSheet extends StyleContext { * used to get the AttributeSet, and may be used to * resolve percentage arguments. * @return the inset needed for the margin, border and padding. - * @exception IllegalArgumentException for an invalid direction + * @throws IllegalArgumentException for an invalid direction */ public float getInset(int side, View v) { AttributeSet a = v.getAttributes(); diff --git a/src/java.desktop/share/classes/javax/swing/text/html/TableView.java b/src/java.desktop/share/classes/javax/swing/text/html/TableView.java index c088bf0eb9a773ed0b0a280d39402dc6d95da1db..11b383acd3187ed587cf97eea3a1351d8ddb6e4c 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/TableView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/TableView.java @@ -1611,7 +1611,7 @@ import javax.swing.text.*; * * @param axis may be either View.X_AXIS or View.Y_AXIS * @return the resize weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { return 1; diff --git a/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java index 794c2cfee40b3b4dea5bac1ff444f6c6d76ff0bf..f841d9119f50924268f966eaf953e5243b90db1f 100644 --- a/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java @@ -70,8 +70,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(InputStream in, Document doc, int pos) throws IOException, BadLocationException { @@ -97,8 +97,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param pos The location in the document to fetch the * content. * @param len The amount to write out. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void write(OutputStream out, Document doc, int pos, int len) @@ -117,8 +117,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(Reader in, Document doc, int pos) @@ -143,8 +143,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param pos The location in the document to fetch the * content. * @param len The amount to write out. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java index 7735895502ecce78574ffbbf314c928975b9ec26..11efb12e7a288791f7b721e2c31b5f33319fdb5f 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java @@ -174,12 +174,12 @@ public class DefaultMutableTreeNode implements Cloneable, * @param newChild the MutableTreeNode to insert under this node * @param childIndex the index in this node's child array * where this node is to be inserted - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * childIndex is out of bounds - * @exception IllegalArgumentException if + * @throws IllegalArgumentException if * newChild is null or is an * ancestor of this node - * @exception IllegalStateException if this node does not allow + * @throws IllegalStateException if this node does not allow * children * @see #isNodeDescendant */ @@ -211,7 +211,7 @@ public class DefaultMutableTreeNode implements Cloneable, * * @param childIndex the index in this node's child array * of the child to remove - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * childIndex is out of bounds */ public void remove(int childIndex) { @@ -247,7 +247,7 @@ public class DefaultMutableTreeNode implements Cloneable, * Returns the child at the specified index in this node's child array. * * @param index an index into this node's child array - * @exception ArrayIndexOutOfBoundsException if index + * @throws ArrayIndexOutOfBoundsException if index * is out of bounds * @return the TreeNode in this node's child array at the specified index */ @@ -278,7 +278,7 @@ public class DefaultMutableTreeNode implements Cloneable, * where n is the number of children. * * @param aChild the TreeNode to search for among this node's children - * @exception IllegalArgumentException if aChild + * @throws IllegalArgumentException if aChild * is null * @return an int giving the index of the node in this node's child * array, or -1 if the specified node is a not @@ -382,7 +382,7 @@ public class DefaultMutableTreeNode implements Cloneable, * null parent. * * @param aChild a child of this node to remove - * @exception IllegalArgumentException if aChild + * @throws IllegalArgumentException if aChild * is null or is not a child of this node */ public void remove(MutableTreeNode aChild) { @@ -412,9 +412,9 @@ public class DefaultMutableTreeNode implements Cloneable, * * @see #insert * @param newChild node to add as a child of this node - * @exception IllegalArgumentException if newChild + * @throws IllegalArgumentException if newChild * is null - * @exception IllegalStateException if this node does not allow + * @throws IllegalStateException if this node does not allow * children */ public void add(MutableTreeNode newChild) { @@ -846,7 +846,7 @@ public class DefaultMutableTreeNode implements Cloneable, * @param ancestor the node to start enumeration from * @see #isNodeAncestor * @see #isNodeDescendant - * @exception IllegalArgumentException if ancestor is + * @throws IllegalArgumentException if ancestor is * not an ancestor of this node * @return an enumeration for following the path from an ancestor of * this node to this one @@ -890,7 +890,7 @@ public class DefaultMutableTreeNode implements Cloneable, * throws NoSuchElementException. * * @return the first child of this node - * @exception NoSuchElementException if this node has no children + * @throws NoSuchElementException if this node has no children */ public TreeNode getFirstChild() { if (getChildCount() == 0) { @@ -905,7 +905,7 @@ public class DefaultMutableTreeNode implements Cloneable, * throws NoSuchElementException. * * @return the last child of this node - * @exception NoSuchElementException if this node has no children + * @throws NoSuchElementException if this node has no children */ public TreeNode getLastChild() { if (getChildCount() == 0) { @@ -925,7 +925,7 @@ public class DefaultMutableTreeNode implements Cloneable, * * @param aChild the child node to look for next child after it * @see #children - * @exception IllegalArgumentException if aChild is + * @throws IllegalArgumentException if aChild is * null or is not a child of this node * @return the child of this node that immediately follows * aChild @@ -957,7 +957,7 @@ public class DefaultMutableTreeNode implements Cloneable, * and is O(n) where n is the number of children. * * @param aChild the child node to look for previous child before it - * @exception IllegalArgumentException if aChild is null + * @throws IllegalArgumentException if aChild is null * or is not a child of this node * @return the child of this node that immediately precedes * aChild diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java index 4cdec3f6b381895d6c1bf98e8c489a1e43933ccf..511cde568c0929e9b189bf4ea4a850a6ee7f6fb3 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java @@ -672,7 +672,7 @@ public class DefaultTreeModel implements Serializable, TreeModel { * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java index e1bdc4fc94b3952bdf3856f43dc80d3979e1361c..ff7ed27302dcbbd9a5841e09c028fbe68e9e6cc0 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java @@ -679,7 +679,7 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * @@ -1187,7 +1187,7 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS * This method does not duplicate * selection listeners and property listeners. * - * @exception CloneNotSupportedException never thrown by instances of + * @throws CloneNotSupportedException never thrown by instances of * this class */ public Object clone() throws CloneNotSupportedException { diff --git a/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java b/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java index 7184557d1e77afb39045042080962bba6a1c6e47..94f5eb69a74ad19bc0f1fb3d22128e7005013c39 100644 --- a/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java +++ b/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java @@ -102,7 +102,7 @@ public class AbstractUndoableEdit implements UndoableEdit, Serializable { * operation represented by this edit. Override should begin with * a call to super. * - * @exception CannotUndoException if canUndo + * @throws CannotUndoException if canUndo * returns false * @see #canUndo */ @@ -134,7 +134,7 @@ public class AbstractUndoableEdit implements UndoableEdit, Serializable { * Subclasses should override to redo the operation represented by * this edit. Override should begin with a call to super. * - * @exception CannotRedoException if canRedo + * @throws CannotRedoException if canRedo * returns false * @see #canRedo */ diff --git a/src/java.desktop/share/classes/sun/awt/AppContext.java b/src/java.desktop/share/classes/sun/awt/AppContext.java index 6ed0b2b325efc7c3a95c893c67f9d18cc99f5bb9..741b52d8bae4a71de7106c392f9e239c2e4702d4 100644 --- a/src/java.desktop/share/classes/sun/awt/AppContext.java +++ b/src/java.desktop/share/classes/sun/awt/AppContext.java @@ -391,7 +391,7 @@ public final class AppContext { * This method must be called from a Thread which is not contained * within this AppContext. * - * @exception IllegalThreadStateException if the current thread is + * @throws IllegalThreadStateException if the current thread is * contained within this AppContext * @since 1.2 */ @@ -660,7 +660,7 @@ public final class AppContext { * @param value the value. * @return the previous value of the specified key in this * AppContext, or {@code null} if it did not have one. - * @exception NullPointerException if the key or value is + * @throws NullPointerException if the key or value is * {@code null}. * @see #get(Object) * @since 1.2 diff --git a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java index e2e7ab3e5ae1bf488d9728a6c05c7e35b7e40e60..45035042992ea1dbd942a520feba3011beb59138 100644 --- a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java +++ b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -960,7 +960,9 @@ public abstract class FontConfiguration { return fc.newEncoder(); } - if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) { + if (!charsetName.startsWith("sun.awt.") && + !charsetName.equals("default") && + !charsetName.startsWith("sun.font.")) { fc = Charset.forName(charsetName); } else { @SuppressWarnings("removal") diff --git a/src/java.desktop/share/classes/sun/awt/im/InputContext.java b/src/java.desktop/share/classes/sun/awt/im/InputContext.java index c35d17bfae3611114bb36694888975065cce65c2..237164a9d421cd5fee56d0c9895ce91a1e4fc365 100644 --- a/src/java.desktop/share/classes/sun/awt/im/InputContext.java +++ b/src/java.desktop/share/classes/sun/awt/im/InputContext.java @@ -133,7 +133,7 @@ public class InputContext extends java.awt.im.InputContext /** * @see java.awt.im.InputContext#selectInputMethod - * @exception NullPointerException when the locale is null. + * @throws NullPointerException when the locale is null. */ public synchronized boolean selectInputMethod(Locale locale) { if (locale == null) { @@ -206,7 +206,7 @@ public class InputContext extends java.awt.im.InputContext /** * @see java.awt.im.InputContext#reconvert * @since 1.3 - * @exception UnsupportedOperationException when input method is null + * @throws UnsupportedOperationException when input method is null */ public synchronized void reconvert() { InputMethod inputMethod = getInputMethod(); @@ -610,7 +610,7 @@ public class InputContext extends java.awt.im.InputContext /** * @see java.awt.im.InputContext#removeNotify - * @exception NullPointerException when the component is null. + * @throws NullPointerException when the component is null. */ public synchronized void removeNotify(Component component) { if (component == null) { @@ -662,7 +662,7 @@ public class InputContext extends java.awt.im.InputContext /** * @see java.awt.im.InputContext#dispose - * @exception IllegalStateException when the currentClientComponent is not null + * @throws IllegalStateException when the currentClientComponent is not null */ public synchronized void dispose() { if (currentClientComponent != null) { @@ -723,7 +723,7 @@ public class InputContext extends java.awt.im.InputContext /** * @see java.awt.im.InputContext#setCompositionEnabled(boolean) - * @exception UnsupportedOperationException when input method is null + * @throws UnsupportedOperationException when input method is null */ public void setCompositionEnabled(boolean enable) { InputMethod inputMethod = getInputMethod(); @@ -736,7 +736,7 @@ public class InputContext extends java.awt.im.InputContext /** * @see java.awt.im.InputContext#isCompositionEnabled - * @exception UnsupportedOperationException when input method is null + * @throws UnsupportedOperationException when input method is null */ public boolean isCompositionEnabled() { InputMethod inputMethod = getInputMethod(); @@ -749,7 +749,7 @@ public class InputContext extends java.awt.im.InputContext /** * @return a string with information about the current input method. - * @exception UnsupportedOperationException when input method is null + * @throws UnsupportedOperationException when input method is null */ public String getInputMethodInfo() { InputMethod inputMethod = getInputMethod(); diff --git a/src/java.desktop/share/classes/sun/awt/im/InputMethodAdapter.java b/src/java.desktop/share/classes/sun/awt/im/InputMethodAdapter.java index dfc31799bfb037a5a798edb943545d4dea82298b..b70f5bbbf712e862125b6a2bb0ddd08c727e4086 100644 --- a/src/java.desktop/share/classes/sun/awt/im/InputMethodAdapter.java +++ b/src/java.desktop/share/classes/sun/awt/im/InputMethodAdapter.java @@ -93,7 +93,7 @@ public abstract class InputMethodAdapter implements InputMethod { /** * Starts reconvertion. An implementing host adapter has to override * this method if it can support reconvert(). - * @exception UnsupportedOperationException when the adapter does not override + * @throws UnsupportedOperationException when the adapter does not override * the method. */ public void reconvert() { diff --git a/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java b/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java index 882881f13b95833590389c36c1befa1984e8f255..0afae4060c07822ce2bcf3792e412fb9bf9cbd13 100644 --- a/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java @@ -634,7 +634,7 @@ public class ByteBandedRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public WritableRaster createWritableChild (int x, int y, @@ -689,7 +689,7 @@ public class ByteBandedRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild (int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java b/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java index 6a92748330cb7d239e362b763b6449f3e9a379fd..3ec93b741e7cb65a87c9eac567226916aa96ed1e 100644 --- a/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java @@ -759,7 +759,7 @@ public class ByteComponentRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild(int x, int y, @@ -788,7 +788,7 @@ public class ByteComponentRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent Raster. */ public WritableRaster createWritableChild(int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java b/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java index 796f0835972ab4416059faf8b87ead8b87822530..f0dedd9775a3aeb20546fd60c67dfeb01959964b 100644 --- a/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java @@ -1195,7 +1195,7 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild(int x, int y, @@ -1224,7 +1224,7 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent Raster. */ public WritableRaster createWritableChild(int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java b/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java index d721eee57390d2898cfa2ac41412624f11c165d5..cadc390e6e9cba8879353e95ac4251d8a20ac3d9 100644 --- a/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java @@ -143,7 +143,7 @@ public class BytePackedRaster extends SunWritableRaster { * @param origin The Point that specifies the origin. * @param parent The parent (if any) of this raster. * - * @exception RasterFormatException if the parameters do not conform + * @throws RasterFormatException if the parameters do not conform * to requirements of this Raster type. */ public BytePackedRaster(SampleModel sampleModel, @@ -1258,7 +1258,7 @@ public class BytePackedRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild(int x, int y, @@ -1286,7 +1286,7 @@ public class BytePackedRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent Raster. */ public WritableRaster createWritableChild(int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java b/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java index 3b110e77eca55b94814a1898434bcc1e29547403..e918a285aaaaeda2a0e170b5e4941af1c4c5742d 100644 --- a/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java @@ -535,7 +535,7 @@ public class IntegerComponentRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public WritableRaster createWritableChild (int x, int y, @@ -589,7 +589,7 @@ public class IntegerComponentRaster extends SunWritableRaster { * @param x0 Translated X origin of the subRaster. * @param y0 Translated Y origin of the subRaster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild (int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java b/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java index cb84024ae22d37f4994270cee70d347105acd1ad..b00b03011306b7efb69f8a40e88cb71c19c734f3 100644 --- a/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java @@ -447,7 +447,7 @@ public class IntegerInterleavedRaster extends IntegerComponentRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public WritableRaster createWritableChild (int x, int y, @@ -501,7 +501,7 @@ public class IntegerInterleavedRaster extends IntegerComponentRaster { * @param x0 Translated X origin of the subRaster. * @param y0 Translated Y origin of the subRaster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild (int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java b/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java index d84039265676354feda99d862b1adbd3e6c757cb..17d24e276860a166256d9a7669d516d98b62a6b5 100644 --- a/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java @@ -633,7 +633,7 @@ public class ShortBandedRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent Raster. */ public WritableRaster createWritableChild(int x, int y, @@ -689,7 +689,7 @@ public class ShortBandedRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild (int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java b/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java index 3e95f652d331ad1f5f3eb615e709afb4d7ef61c3..b24b664826fc26d7454420cbe7a3838f812827c9 100644 --- a/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java @@ -693,7 +693,7 @@ public class ShortComponentRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild (int x, int y, @@ -722,7 +722,7 @@ public class ShortComponentRaster extends SunWritableRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent Raster. */ public WritableRaster createWritableChild(int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java b/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java index d4926bb295eedd872e9e25f45b80441fc91da6a2..327adf9ac98a02ff7ffcdbe0c7e4ab38bc060bc9 100644 --- a/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java +++ b/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java @@ -666,7 +666,7 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent raster. */ public Raster createChild (int x, int y, @@ -695,7 +695,7 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * @param x0 Translated X origin of the subraster. * @param y0 Translated Y origin of the subraster. * @param bandList Array of band indices. - * @exception RasterFormatException + * @throws RasterFormatException * if the specified bounding box is outside of the parent Raster. */ public WritableRaster createWritableChild(int x, int y, diff --git a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java index 3aa91dcb6006f31bb0e7ed32719098c4b69407a8..1f95995a222ae3258d6038e296bd6114ebe5c15e 100644 --- a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java +++ b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java @@ -253,13 +253,12 @@ public abstract class ShellFolder extends File { /** * Return a shell folder from a file object - * @exception FileNotFoundException if file does not exist + * @throws FileNotFoundException if file does not exist */ public static ShellFolder getShellFolder(File file) throws FileNotFoundException { if (file instanceof ShellFolder) { return (ShellFolder)file; } - if (!Files.exists(Paths.get(file.getPath()), LinkOption.NOFOLLOW_LINKS)) { throw new FileNotFoundException(); } diff --git a/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java b/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java index 98f93cc3ec7027fa9942a230d7889addeb9ea0df..202a55a8135bd55d46296aefb8127d180ab96d99 100644 --- a/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java +++ b/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java @@ -113,7 +113,7 @@ public class IdentityArrayList extends AbstractList * Constructs an empty list with the specified initial capacity. * * @param initialCapacity the initial capacity of the list - * @exception IllegalArgumentException if the specified initial capacity + * @throws IllegalArgumentException if the specified initial capacity * is negative */ public IdentityArrayList(int initialCapacity) { diff --git a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java index 193a8a38587ecc7c989956ea8a94b463d5c32408..5c681b454b9deae5bb39b5c29da942886dcc5277 100644 --- a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java +++ b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java @@ -409,7 +409,7 @@ public final class SunGraphics2D * drawback of the workaround is that the resulting * clip and device origin cannot be "enforced". * - * @exception IllegalStateException If the Graphics + * @throws IllegalStateException If the Graphics * to be constrained has a complex transform. */ @Override diff --git a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java index 61450e49553f7c788d39ebe30da208ac6cbeba84..01a24adfda43fe58bb3d2464a6a06a3d354e2046 100644 --- a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java +++ b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java @@ -418,7 +418,7 @@ public class PSPrinterJob extends RasterPrinterJob { * print job interactively. * @return false if the user cancels the dialog and * true otherwise. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ diff --git a/src/java.desktop/share/classes/sun/print/PrintJob2D.java b/src/java.desktop/share/classes/sun/print/PrintJob2D.java index 9083bd3e26965be3ba66460049c4f645a5dc2b7b..7a238383ce859a4fdb586cb63c1003d030facf00 100644 --- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java +++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java @@ -966,7 +966,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable { * @return PAGE_EXISTS if the page is rendered successfully * or NO_SUCH_PAGE if {@code pageIndex} specifies a * non-existent page. - * @exception java.awt.print.PrinterException + * @throws java.awt.print.PrinterException * thrown when the print job is terminated. */ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) diff --git a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java index 6ceeb48df85279161c11f8fb6327c4147a8059ef..ffdebb82d0ba221d3d039bbbfb2da2e15c90fd75 100644 --- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java +++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java @@ -714,7 +714,7 @@ public abstract class RasterPrinterJob extends PrinterJob { * is cancelled, or a new PageFormat object containing * the format indicated by the user if the dialog is * acknowledged - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.2 @@ -947,7 +947,7 @@ public abstract class RasterPrinterJob extends PrinterJob { * * @param attributes to store changed properties. * @return false if the user cancels the dialog and true otherwise. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -1100,7 +1100,7 @@ public abstract class RasterPrinterJob extends PrinterJob { * print job interactively. * @return false if the user cancels the dialog and * true otherwise. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -1183,7 +1183,7 @@ public abstract class RasterPrinterJob extends PrinterJob { * for the number of pages as well as the PageFormat and * Printable for each page. * @param document The document to be printed. It may not be null. - * @exception NullPointerException the Pageable passed in was null. + * @throws NullPointerException the Pageable passed in was null. * @see PageFormat * @see Printable */ @@ -1477,7 +1477,7 @@ public abstract class RasterPrinterJob extends PrinterJob { /** * Prints a set of pages. - * @exception java.awt.print.PrinterException an error in the print system + * @throws java.awt.print.PrinterException an error in the print system * caused the job to be aborted * @see java.awt.print.Book * @see java.awt.print.Pageable diff --git a/make/data/dtdbuilder/HTMLlat1.sgml b/src/java.desktop/share/data/dtdbuilder/HTMLlat1.sgml similarity index 100% rename from make/data/dtdbuilder/HTMLlat1.sgml rename to src/java.desktop/share/data/dtdbuilder/HTMLlat1.sgml diff --git a/make/data/dtdbuilder/HTMLspecial.sgml b/src/java.desktop/share/data/dtdbuilder/HTMLspecial.sgml similarity index 100% rename from make/data/dtdbuilder/HTMLspecial.sgml rename to src/java.desktop/share/data/dtdbuilder/HTMLspecial.sgml diff --git a/make/data/dtdbuilder/HTMLsymbol.sgml b/src/java.desktop/share/data/dtdbuilder/HTMLsymbol.sgml similarity index 100% rename from make/data/dtdbuilder/HTMLsymbol.sgml rename to src/java.desktop/share/data/dtdbuilder/HTMLsymbol.sgml diff --git a/make/data/dtdbuilder/html32.dtd b/src/java.desktop/share/data/dtdbuilder/html32.dtd similarity index 100% rename from make/data/dtdbuilder/html32.dtd rename to src/java.desktop/share/data/dtdbuilder/html32.dtd diff --git a/make/data/dtdbuilder/public.map b/src/java.desktop/share/data/dtdbuilder/public.map similarity index 100% rename from make/data/dtdbuilder/public.map rename to src/java.desktop/share/data/dtdbuilder/public.map diff --git a/make/data/x11wrappergen/sizes-32.txt b/src/java.desktop/unix/data/x11wrappergen/sizes-32.txt similarity index 100% rename from make/data/x11wrappergen/sizes-32.txt rename to src/java.desktop/unix/data/x11wrappergen/sizes-32.txt diff --git a/make/data/x11wrappergen/sizes-64.txt b/src/java.desktop/unix/data/x11wrappergen/sizes-64.txt similarity index 100% rename from make/data/x11wrappergen/sizes-64.txt rename to src/java.desktop/unix/data/x11wrappergen/sizes-64.txt diff --git a/make/data/x11wrappergen/xlibtypes.txt b/src/java.desktop/unix/data/x11wrappergen/xlibtypes.txt similarity index 100% rename from make/data/x11wrappergen/xlibtypes.txt rename to src/java.desktop/unix/data/x11wrappergen/xlibtypes.txt diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c index 051c9de88fa851296b8c4134c423f80ebd396af9..fd28f5c0ea6dc1d2fe33afffb7462e206da0c837 100644 --- a/src/java.desktop/unix/native/common/awt/fontpath.c +++ b/src/java.desktop/unix/native/common/awt/fontpath.c @@ -496,6 +496,7 @@ typedef FcResult (*FcPatternGetStringFuncType)(const FcPattern *p, FcChar8 ** s); typedef FcChar8* (*FcStrDirnameFuncType)(const FcChar8 *file); typedef void (*FcPatternDestroyFuncType)(FcPattern *p); +typedef void (*FcObjectSetDestroyFuncType)(FcObjectSet *os); typedef void (*FcFontSetDestroyFuncType)(FcFontSet *s); typedef FcPattern* (*FcNameParseFuncType)(const FcChar8 *name); typedef FcBool (*FcPatternAddStringFuncType)(FcPattern *p, @@ -542,6 +543,7 @@ static char **getFontConfigLocations() { FcPatternGetStringFuncType FcPatternGetString; FcStrDirnameFuncType FcStrDirname; FcPatternDestroyFuncType FcPatternDestroy; + FcObjectSetDestroyFuncType FcObjectSetDestroy; FcFontSetDestroyFuncType FcFontSetDestroy; FcConfig *fontconfig; @@ -571,6 +573,8 @@ static char **getFontConfigLocations() { (FcStrDirnameFuncType)dlsym(libfontconfig, "FcStrDirname"); FcPatternDestroy = (FcPatternDestroyFuncType)dlsym(libfontconfig, "FcPatternDestroy"); + FcObjectSetDestroy = + (FcObjectSetDestroyFuncType)dlsym(libfontconfig, "FcObjectSetDestroy"); FcFontSetDestroy = (FcFontSetDestroyFuncType)dlsym(libfontconfig, "FcFontSetDestroy"); @@ -580,6 +584,7 @@ static char **getFontConfigLocations() { FcFontList == NULL || FcStrDirname == NULL || FcPatternDestroy == NULL || + FcObjectSetDestroy == NULL || FcFontSetDestroy == NULL) { /* problem with the library: return. */ closeFontConfig(libfontconfig, JNI_FALSE); return NULL; @@ -636,6 +641,7 @@ static char **getFontConfigLocations() { cleanup: /* Free memory and close the ".so" */ + (*FcObjectSetDestroy)(objset); (*FcPatternDestroy)(pattern); closeFontConfig(libfontconfig, JNI_TRUE); return fontdirs; diff --git a/make/data/fontconfig/windows.fontconfig.properties b/src/java.desktop/windows/data/fontconfig/fontconfig.properties similarity index 100% rename from make/data/fontconfig/windows.fontconfig.properties rename to src/java.desktop/windows/data/fontconfig/fontconfig.properties diff --git a/src/java.management/share/classes/java/lang/management/ManagementFactory.java b/src/java.management/share/classes/java/lang/management/ManagementFactory.java index 13db85d0f094cc3b10e07d40500a662f15981cb2..375f0ebb719b18dd8ecc405843237c9bb03eebb1 100644 --- a/src/java.management/share/classes/java/lang/management/ManagementFactory.java +++ b/src/java.management/share/classes/java/lang/management/ManagementFactory.java @@ -936,8 +936,7 @@ public class ManagementFactory { all.add(new DefaultPlatformMBeanProvider()); return all; } - }, null, new FilePermission("<>", "read"), - new RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass")); + }, null, new FilePermission("<>", "read")); // load all platform components into a map var map = new HashMap>(); diff --git a/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java b/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java index 93779f0a811e3652fa8dda1e037144aa38ca467d..12472cabfccd363f3c0c155dcebb96e2f45eb099 100644 --- a/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java +++ b/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -203,15 +203,8 @@ public abstract class PlatformMBeanProvider { /** * Instantiates a new PlatformMBeanProvider. - * - * @throws SecurityException if the subclass (and calling code) does not - * have {@code RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass")} */ protected PlatformMBeanProvider () { - this(checkSubclassPermission()); - } - - private PlatformMBeanProvider(Void unused) { } /** @@ -222,13 +215,4 @@ public abstract class PlatformMBeanProvider { * MBeans provided by this provider. */ public abstract List> getPlatformComponentList(); - - private static Void checkSubclassPermission() { - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission(PlatformMBeanProvider.class.getName()+".subclass")); - } - return null; - } } diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java b/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java index 3c75f75519af56b00e322edfc2656831dc364a00..41144b132c087f982f71cde483a9e876f6820868 100644 --- a/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java +++ b/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -435,11 +435,10 @@ public final class StartTlsResponseImpl extends StartTlsResponse { /* * Pass up the cause of the failure */ - throw(SSLPeerUnverifiedException) - new SSLPeerUnverifiedException("hostname of the server '" + + throw new SSLPeerUnverifiedException("hostname of the server '" + hostname + "' does not match the hostname in the " + - "server's certificate.").initCause(e); + "server's certificate.", e); } } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java index 36af30050328367d2b59eb2a0f6a26b982e1d04e..8c9282c0579150b74ed2c0d80f6fa1de783afc92 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -144,14 +144,45 @@ final class Exchange { private volatile boolean closeRequested; void connection(HttpConnection connection) { - this.connection = connection; - if (closeRequested) closeConnection(); + boolean closeRequested; + synchronized (this) { + // check whether this new connection should be + // closed + closeRequested = this.closeRequested; + if (!closeRequested) { + this.connection = connection; + } else { + // assert this.connection == null + this.closeRequested = false; + } + } + if (closeRequested) closeConnection(connection); } void closeConnection() { - closeRequested = true; - HttpConnection connection = this.connection; - this.connection = null; + HttpConnection connection; + synchronized (this) { + connection = this.connection; + if (connection == null) { + closeRequested = true; + } else { + this.connection = null; + } + } + closeConnection(connection); + } + + HttpConnection disable() { + HttpConnection connection; + synchronized (this) { + connection = this.connection; + this.connection = null; + this.closeRequested = false; + } + return connection; + } + + private static void closeConnection(HttpConnection connection) { if (connection != null) { try { connection.close(); @@ -160,11 +191,6 @@ final class Exchange { } } } - - void disable() { - connection = null; - closeRequested = false; - } } // Called for 204 response - when no body is permitted @@ -524,8 +550,11 @@ final class Exchange { client.client2(), this, e::drainLeftOverBytes) .thenCompose((Http2Connection c) -> { + HttpConnection connection = connectionAborter.disable(); boolean cached = c.offerConnection(); - if (cached) connectionAborter.disable(); + if (!cached && connection != null) { + connectionAborter.connection(connection); + } Stream s = c.getStream(1); if (s == null) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java index 4101133a025d87c576bcbf4e2379f19034f6b540..c3861b2ad9fd3266b2610442501f7c123752df5f 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ package jdk.internal.net.http; import java.io.EOFException; import java.io.IOException; import java.io.UncheckedIOException; -import java.net.ConnectException; import java.net.InetSocketAddress; import java.net.URI; import java.util.Base64; @@ -101,7 +100,7 @@ class Http2ClientImpl { Http2Connection connection = connections.get(key); if (connection != null) { try { - if (connection.closed || !connection.reserveStream(true)) { + if (!connection.isOpen() || !connection.reserveStream(true)) { if (debug.on()) debug.log("removing found closed or closing connection: %s", connection); deleteConnection(connection); @@ -153,7 +152,7 @@ class Http2ClientImpl { */ boolean offerConnection(Http2Connection c) { if (debug.on()) debug.log("offering to the connection pool: %s", c); - if (c.closed || c.finalStream()) { + if (!c.isOpen() || c.finalStream()) { if (debug.on()) debug.log("skipping offered closed or closing connection: %s", c); return false; @@ -161,6 +160,11 @@ class Http2ClientImpl { String key = c.key(); synchronized(this) { + if (!c.isOpen()) { + if (debug.on()) + debug.log("skipping offered closed or closing connection: %s", c); + return false; + } Http2Connection c1 = connections.putIfAbsent(key, c); if (c1 != null) { c.setFinalStream(); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java index 6a07d755e69684ba34138b7697e128295d7eccf4..8cd9db1210a5e7c041ff73c88a80c7857ae6d91c 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -880,6 +880,10 @@ class Http2Connection { } } + boolean isOpen() { + return !closed && connection.channel().isOpen(); + } + void resetStream(int streamid, int code) { try { if (connection.channel().isOpen()) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java index 6394b7b3cfa18bdcd29ead3d5dd38450eef607ac..fc2596e0aa4ec05812d5e6345a43d9e0f0bc44cd 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -573,9 +573,7 @@ final class HttpClientImpl extends HttpClient implements Trackable { throw ce; } else if (throwable instanceof SSLHandshakeException) { // special case for SSLHandshakeException - SSLHandshakeException he = new SSLHandshakeException(msg); - he.initCause(throwable); - throw he; + throw new SSLHandshakeException(msg, throwable); } else if (throwable instanceof SSLException) { // any other SSLException is wrapped in a plain // SSLException diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java index 42174ef9c44feacbed750301ba1dbc14bd7162fb..e72ba9d33dc1e3a201bc3c0e08a44314b18ccaf1 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -592,9 +592,7 @@ public class SSLTube implements FlowTube { engine.isOutboundDone(), handshakeFailed); - SSLHandshakeException e = new SSLHandshakeException(handshakeFailed); - if (t != null) e.initCause(t); - return e; + return new SSLHandshakeException(handshakeFailed, t); } @Override diff --git a/make/data/jdwp/jdwp.spec b/src/java.se/share/data/jdwp/jdwp.spec similarity index 100% rename from make/data/jdwp/jdwp.spec rename to src/java.se/share/data/jdwp/jdwp.spec diff --git a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java index 21b48d58fc226816f5d0e8dd8d200acda5a7ee16..d0acdd5c6e241ba211ef6863905a29fcd2c91978 100644 --- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java +++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -146,8 +146,7 @@ public final class Krb5MechFactory implements MechanismFactory { SecurityManager sm = System.getSecurityManager(); if (sm != null) { String realm = (name.getKrb5PrincipalName()).getRealmAsString(); - String tgsPrincipal = - new String("krbtgt/" + realm + '@' + realm); + String tgsPrincipal = "krbtgt/" + realm + '@' + realm; ServicePermission perm = new ServicePermission(tgsPrincipal, "initiate"); try { diff --git a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java index ea2e24f6a8a060aaabb5ba210da0105e0a17f30c..b286f2c5844e70c83b0411884f3ba1b072a9c88f 100644 --- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java +++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ public class Krb5NameElement /** * Instantiates a new Krb5NameElement object. Internally it stores the * information provided by the input parameters so that they may later - * be used for output when a printable representaion of this name is + * be used for output when a printable representation of this name is * needed in GSS-API format rather than in Kerberos format. * */ @@ -158,7 +158,7 @@ public class Krb5NameElement // Look for @ as in service@host // Assumes host name will not have an escaped '@' - int separatorPos = gssNameStr.lastIndexOf('@', gssNameStr.length()); + int separatorPos = gssNameStr.lastIndexOf('@'); // Not really a separator if it is escaped. Then this is just part // of the principal name or service name diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java b/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java index 917f0449f179aef1b0d67255ff19aada3d8e60e7..58cc98c14ecd82c6f64c8a0989e220fe7684fffe 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -497,13 +497,13 @@ public class EncryptionKey } public String toString() { - return new String("EncryptionKey: keyType=" + keyType - + " kvno=" + kvno - + " keyValue (hex dump)=" - + (keyValue == null || keyValue.length == 0 ? - " Empty Key" : '\n' - + Krb5.hexDumper.encodeBuffer(keyValue) - + '\n')); + return "EncryptionKey: keyType=" + keyType + + " kvno=" + kvno + + " keyValue (hex dump)=" + + (keyValue == null || keyValue.length == 0 ? + " Empty Key" : '\n' + + Krb5.hexDumper.encodeBuffer(keyValue) + + '\n'); } /** diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/KrbCryptoException.java b/src/java.security.jgss/share/classes/sun/security/krb5/KrbCryptoException.java index 28522e8316dcc4c556abfbcd034ba73285ac6d05..eda5fcec397fc593eba8a8bfb0ec1ab668cc1061 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/KrbCryptoException.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/KrbCryptoException.java @@ -31,7 +31,7 @@ package sun.security.krb5; /** - * KrbCryptoExceptoin is a wrapper exception for exceptions thrown by JCE. + * KrbCryptoException is a wrapper exception for exceptions thrown by JCE. * * @author Yanni Zhang */ @@ -39,7 +39,7 @@ public class KrbCryptoException extends KrbException { private static final long serialVersionUID = -1657367919979982250L; - public KrbCryptoException (String s) { + public KrbCryptoException(String s) { super(s); } } diff --git a/src/java.sql/share/classes/java/sql/package-info.java b/src/java.sql/share/classes/java/sql/package-info.java index be494454a063d54accf73cc27c4d2787848f57bb..9e94e0b9393a1d5d46f2ef6f72ff6ab19cc0f490 100644 --- a/src/java.sql/share/classes/java/sql/package-info.java +++ b/src/java.sql/share/classes/java/sql/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -334,7 +334,7 @@ * *

    diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java index 93a4dd8d301f3726616266d0e3be1c588d7e5e37..126f5d152550b5b8a0f0089dd97a4266e44c7a6b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,6 +20,7 @@ package com.sun.org.apache.xml.internal.serializer; +import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xml.internal.serializer.dom3.DOMConstants; import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; import com.sun.org.apache.xml.internal.serializer.utils.Utils; @@ -54,7 +55,7 @@ import org.xml.sax.SAXException; * serializers (xml, html, text ...) that write output to a stream. * * @xsl.usage internal - * @LastModified: June 2021 + * @LastModified: Mar 2022 */ abstract public class ToStream extends SerializerBase { @@ -1745,13 +1746,19 @@ abstract public class ToStream extends SerializerBase { } else { - /* This if check is added to support control characters in XML 1.1. - * If a character is a Control Character within C0 and C1 range, it is desirable - * to write it out as Numeric Character Reference(NCR) regardless of XML Version - * being used for output document. + /* + * The check was added to support control characters in XML 1.1. + * It previously wrote Control Characters within C0 and C1 range + * as Numeric Character Reference(NCR) regardless of XML Version, + * which was incorrect as Control Characters are invalid in XML 1.0. */ - if (isCharacterInC0orC1Range(ch) || - (XMLVERSION11.equals(getVersion()) && isNELorLSEPCharacter(ch))) + boolean isVer11 = XMLVERSION11.equals(getVersion()); + if (!isVer11 && XMLChar.isInvalid(ch)) { + throw new org.xml.sax.SAXException(Utils.messages.createMessage( + MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, + new Object[]{Integer.toHexString(ch)})); + } + if (isCharacterInC0orC1Range(ch) || (isVer11 && isNELorLSEPCharacter(ch))) { writeCharRef(writer, ch); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java index 5cf8c5d5387f733eb2209ebc772fd6333721a88c..dbb4f1a46a4e08aa23ecbfd92a25d91c863c756c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java @@ -377,7 +377,7 @@ public class Enter extends JCTree.Visitor { ClassSymbol c = syms.enterClass(tree.modle, name, tree.packge); c.flatname = names.fromString(tree.packge + "." + name); c.classfile = c.sourcefile = tree.sourcefile; - c.completer = Completer.NULL_COMPLETER; + c.completer = Completer.NULL_COMPLETER; c.members_field = WriteableScope.create(c); tree.packge.package_info = c; tree.packge.sourcefile = tree.sourcefile; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index 0638da66a8969191b572a18375af6bee01790718..28662fe2dcc0667b64236aa13d3b88309b8bd970 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2054,7 +2054,7 @@ public class LambdaToMethod extends TreeTranslator { }; break; case CAPTURED_OUTER_THIS: - Name name = names.fromString(new String(sym.flatName().toString().replace('.', '$') + names.dollarThis)); + Name name = names.fromString(sym.flatName().toString().replace('.', '$') + names.dollarThis); ret = new VarSymbol(SYNTHETIC | FINAL | PARAMETER, name, types.erasure(sym.type), translatedSym) { @Override public Symbol baseSymbol() { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index 9dd94f742528edcd9fa68eef4c0d149eb65bf4b4..9174f0b7385dc098fd7c3cfb51d53d53040be025 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -300,10 +300,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea try { processorIterator = List.of(new PrintingProcessor()).iterator(); } catch (Throwable t) { - AssertionError assertError = - new AssertionError("Problem instantiating PrintingProcessor."); - assertError.initCause(t); - throw assertError; + throw new AssertionError("Problem instantiating PrintingProcessor.", t); } } else if (processors != null) { processorIterator = processors.iterator(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index fddd3e935e1d24ca0fe321be4827dc47eb1040cd..0308f6a647e0b0dd0cbfb012fb4d5716da76882c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -1565,9 +1565,6 @@ compiler.misc.diamond.anonymous.methods.implicitly.override=\ compiler.misc.source.unavailable=\ (source unavailable) -compiler.misc.base.membership=\ - all your base class are belong to us - # 0: string, 1: string, 2: boolean compiler.misc.x.print.processor.info=\ Processor {0} matches {1} and returns {2}. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java index acccd4d574cca6d84c64def724d947c956190912..bdfef06fd7c53143e0c02a38eeca949038371251 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -194,9 +194,7 @@ public class Pretty extends JCTree.Visitor { tree.accept(this); } } catch (UncheckedIOException ex) { - IOException e = new IOException(ex.getMessage()); - e.initCause(ex); - throw e; + throw new IOException(ex.getMessage(), ex); } finally { this.prec = prevPrec; } diff --git a/make/data/symbols/README b/src/jdk.compiler/share/data/symbols/README similarity index 100% rename from make/data/symbols/README rename to src/jdk.compiler/share/data/symbols/README diff --git a/make/data/symbols/include.list b/src/jdk.compiler/share/data/symbols/include.list similarity index 100% rename from make/data/symbols/include.list rename to src/jdk.compiler/share/data/symbols/include.list diff --git a/make/data/symbols/java.activation-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-8.sym.txt similarity index 100% rename from make/data/symbols/java.activation-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-8.sym.txt diff --git a/make/data/symbols/java.activation-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-9.sym.txt similarity index 100% rename from make/data/symbols/java.activation-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-9.sym.txt diff --git a/make/data/symbols/java.activation-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-A.sym.txt similarity index 100% rename from make/data/symbols/java.activation-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-A.sym.txt diff --git a/make/data/symbols/java.activation-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-B.sym.txt similarity index 100% rename from make/data/symbols/java.activation-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-B.sym.txt diff --git a/make/data/symbols/java.base-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-7.sym.txt similarity index 100% rename from make/data/symbols/java.base-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-7.sym.txt diff --git a/make/data/symbols/java.base-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-8.sym.txt similarity index 100% rename from make/data/symbols/java.base-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-8.sym.txt diff --git a/make/data/symbols/java.base-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-9.sym.txt similarity index 100% rename from make/data/symbols/java.base-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-9.sym.txt diff --git a/make/data/symbols/java.base-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-A.sym.txt similarity index 100% rename from make/data/symbols/java.base-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-A.sym.txt diff --git a/make/data/symbols/java.base-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-B.sym.txt similarity index 100% rename from make/data/symbols/java.base-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-B.sym.txt diff --git a/make/data/symbols/java.base-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-C.sym.txt similarity index 100% rename from make/data/symbols/java.base-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-C.sym.txt diff --git a/make/data/symbols/java.base-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-D.sym.txt similarity index 100% rename from make/data/symbols/java.base-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-D.sym.txt diff --git a/make/data/symbols/java.base-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-E.sym.txt similarity index 100% rename from make/data/symbols/java.base-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-E.sym.txt diff --git a/make/data/symbols/java.base-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-F.sym.txt similarity index 100% rename from make/data/symbols/java.base-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-F.sym.txt diff --git a/make/data/symbols/java.base-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-G.sym.txt similarity index 100% rename from make/data/symbols/java.base-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-G.sym.txt diff --git a/make/data/symbols/java.base-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-H.sym.txt similarity index 100% rename from make/data/symbols/java.base-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-H.sym.txt diff --git a/make/data/symbols/java.base-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-I.sym.txt similarity index 100% rename from make/data/symbols/java.base-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-I.sym.txt diff --git a/make/data/symbols/java.compiler-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-7.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-7.sym.txt diff --git a/make/data/symbols/java.compiler-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-8.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-8.sym.txt diff --git a/make/data/symbols/java.compiler-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-9.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-9.sym.txt diff --git a/make/data/symbols/java.compiler-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-A.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-A.sym.txt diff --git a/make/data/symbols/java.compiler-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-B.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-B.sym.txt diff --git a/make/data/symbols/java.compiler-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-C.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-C.sym.txt diff --git a/make/data/symbols/java.compiler-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-D.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-D.sym.txt diff --git a/make/data/symbols/java.compiler-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-E.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-E.sym.txt diff --git a/make/data/symbols/java.compiler-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-F.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-F.sym.txt diff --git a/make/data/symbols/java.compiler-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-G.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-G.sym.txt diff --git a/make/data/symbols/java.compiler-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-H.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-H.sym.txt diff --git a/make/data/symbols/java.compiler-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-I.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-I.sym.txt diff --git a/make/data/symbols/java.corba-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-8.sym.txt similarity index 100% rename from make/data/symbols/java.corba-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-8.sym.txt diff --git a/make/data/symbols/java.corba-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-9.sym.txt similarity index 100% rename from make/data/symbols/java.corba-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-9.sym.txt diff --git a/make/data/symbols/java.corba-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-A.sym.txt similarity index 100% rename from make/data/symbols/java.corba-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-A.sym.txt diff --git a/make/data/symbols/java.corba-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-B.sym.txt similarity index 100% rename from make/data/symbols/java.corba-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-B.sym.txt diff --git a/make/data/symbols/java.datatransfer-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-7.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-7.sym.txt diff --git a/make/data/symbols/java.datatransfer-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-8.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-8.sym.txt diff --git a/make/data/symbols/java.datatransfer-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-9.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-9.sym.txt diff --git a/make/data/symbols/java.datatransfer-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-A.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-A.sym.txt diff --git a/make/data/symbols/java.datatransfer-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-B.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-B.sym.txt diff --git a/make/data/symbols/java.datatransfer-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-G.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-G.sym.txt diff --git a/make/data/symbols/java.datatransfer-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-H.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-H.sym.txt diff --git a/make/data/symbols/java.datatransfer-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-I.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-I.sym.txt diff --git a/make/data/symbols/java.desktop-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-7.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-7.sym.txt diff --git a/make/data/symbols/java.desktop-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-8.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-8.sym.txt diff --git a/make/data/symbols/java.desktop-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-9.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-9.sym.txt diff --git a/make/data/symbols/java.desktop-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-A.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-A.sym.txt diff --git a/make/data/symbols/java.desktop-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-B.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-B.sym.txt diff --git a/make/data/symbols/java.desktop-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-C.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-C.sym.txt diff --git a/make/data/symbols/java.desktop-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-D.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-D.sym.txt diff --git a/make/data/symbols/java.desktop-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-E.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-E.sym.txt diff --git a/make/data/symbols/java.desktop-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-F.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-F.sym.txt diff --git a/make/data/symbols/java.desktop-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-G.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-G.sym.txt diff --git a/make/data/symbols/java.desktop-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-H.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-H.sym.txt diff --git a/make/data/symbols/java.desktop-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-I.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-I.sym.txt diff --git a/make/data/symbols/java.instrument-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-8.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-8.sym.txt diff --git a/make/data/symbols/java.instrument-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-9.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-9.sym.txt diff --git a/make/data/symbols/java.instrument-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-A.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-A.sym.txt diff --git a/make/data/symbols/java.instrument-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-B.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-B.sym.txt diff --git a/make/data/symbols/java.instrument-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-G.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-G.sym.txt diff --git a/make/data/symbols/java.instrument-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-H.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-H.sym.txt diff --git a/make/data/symbols/java.instrument-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-I.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-I.sym.txt diff --git a/make/data/symbols/java.logging-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-7.sym.txt similarity index 100% rename from make/data/symbols/java.logging-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-7.sym.txt diff --git a/make/data/symbols/java.logging-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-8.sym.txt similarity index 100% rename from make/data/symbols/java.logging-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-8.sym.txt diff --git a/make/data/symbols/java.logging-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-9.sym.txt similarity index 100% rename from make/data/symbols/java.logging-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-9.sym.txt diff --git a/make/data/symbols/java.logging-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-A.sym.txt similarity index 100% rename from make/data/symbols/java.logging-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-A.sym.txt diff --git a/make/data/symbols/java.logging-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-B.sym.txt similarity index 100% rename from make/data/symbols/java.logging-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-B.sym.txt diff --git a/make/data/symbols/java.logging-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-G.sym.txt similarity index 100% rename from make/data/symbols/java.logging-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-G.sym.txt diff --git a/make/data/symbols/java.logging-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-H.sym.txt similarity index 100% rename from make/data/symbols/java.logging-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-H.sym.txt diff --git a/make/data/symbols/java.logging-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-I.sym.txt similarity index 100% rename from make/data/symbols/java.logging-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-I.sym.txt diff --git a/make/data/symbols/java.management-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-7.sym.txt similarity index 100% rename from make/data/symbols/java.management-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-7.sym.txt diff --git a/make/data/symbols/java.management-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-8.sym.txt similarity index 100% rename from make/data/symbols/java.management-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-8.sym.txt diff --git a/make/data/symbols/java.management-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-9.sym.txt similarity index 100% rename from make/data/symbols/java.management-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-9.sym.txt diff --git a/make/data/symbols/java.management-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-A.sym.txt similarity index 100% rename from make/data/symbols/java.management-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-A.sym.txt diff --git a/make/data/symbols/java.management-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-B.sym.txt similarity index 100% rename from make/data/symbols/java.management-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-B.sym.txt diff --git a/make/data/symbols/java.management-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-D.sym.txt similarity index 100% rename from make/data/symbols/java.management-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-D.sym.txt diff --git a/make/data/symbols/java.management-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-G.sym.txt similarity index 100% rename from make/data/symbols/java.management-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-G.sym.txt diff --git a/make/data/symbols/java.management-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-H.sym.txt similarity index 100% rename from make/data/symbols/java.management-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-H.sym.txt diff --git a/make/data/symbols/java.management-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-I.sym.txt similarity index 100% rename from make/data/symbols/java.management-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-I.sym.txt diff --git a/make/data/symbols/java.management.rmi-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-8.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-8.sym.txt diff --git a/make/data/symbols/java.management.rmi-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-9.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-9.sym.txt diff --git a/make/data/symbols/java.management.rmi-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-A.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-A.sym.txt diff --git a/make/data/symbols/java.management.rmi-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-B.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-B.sym.txt diff --git a/make/data/symbols/java.management.rmi-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-D.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-D.sym.txt diff --git a/make/data/symbols/java.management.rmi-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-F.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-F.sym.txt diff --git a/make/data/symbols/java.management.rmi-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-G.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-G.sym.txt diff --git a/make/data/symbols/java.management.rmi-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-H.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-H.sym.txt diff --git a/make/data/symbols/java.management.rmi-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-I.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-I.sym.txt diff --git a/make/data/symbols/java.naming-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-7.sym.txt similarity index 100% rename from make/data/symbols/java.naming-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-7.sym.txt diff --git a/make/data/symbols/java.naming-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-8.sym.txt similarity index 100% rename from make/data/symbols/java.naming-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-8.sym.txt diff --git a/make/data/symbols/java.naming-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-9.sym.txt similarity index 100% rename from make/data/symbols/java.naming-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-9.sym.txt diff --git a/make/data/symbols/java.naming-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-A.sym.txt similarity index 100% rename from make/data/symbols/java.naming-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-A.sym.txt diff --git a/make/data/symbols/java.naming-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-B.sym.txt similarity index 100% rename from make/data/symbols/java.naming-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-B.sym.txt diff --git a/make/data/symbols/java.naming-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-C.sym.txt similarity index 100% rename from make/data/symbols/java.naming-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-C.sym.txt diff --git a/make/data/symbols/java.naming-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-F.sym.txt similarity index 100% rename from make/data/symbols/java.naming-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-F.sym.txt diff --git a/make/data/symbols/java.naming-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-G.sym.txt similarity index 100% rename from make/data/symbols/java.naming-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-G.sym.txt diff --git a/make/data/symbols/java.naming-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-H.sym.txt similarity index 100% rename from make/data/symbols/java.naming-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-H.sym.txt diff --git a/make/data/symbols/java.naming-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-I.sym.txt similarity index 100% rename from make/data/symbols/java.naming-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-I.sym.txt diff --git a/make/data/symbols/java.net.http-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-B.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-B.sym.txt diff --git a/make/data/symbols/java.net.http-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-D.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-D.sym.txt diff --git a/make/data/symbols/java.net.http-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-G.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-G.sym.txt diff --git a/make/data/symbols/java.net.http-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-I.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-I.sym.txt diff --git a/make/data/symbols/java.prefs-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-7.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-7.sym.txt diff --git a/make/data/symbols/java.prefs-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-8.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-8.sym.txt diff --git a/make/data/symbols/java.prefs-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-9.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-9.sym.txt diff --git a/make/data/symbols/java.prefs-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-A.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-A.sym.txt diff --git a/make/data/symbols/java.prefs-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-B.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-B.sym.txt diff --git a/make/data/symbols/java.rmi-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-7.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-7.sym.txt diff --git a/make/data/symbols/java.rmi-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-8.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-8.sym.txt diff --git a/make/data/symbols/java.rmi-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-9.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-9.sym.txt diff --git a/make/data/symbols/java.rmi-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-A.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-A.sym.txt diff --git a/make/data/symbols/java.rmi-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-B.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-B.sym.txt diff --git a/make/data/symbols/java.rmi-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-C.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-C.sym.txt diff --git a/make/data/symbols/java.rmi-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-F.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-F.sym.txt diff --git a/make/data/symbols/java.rmi-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-G.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-G.sym.txt diff --git a/make/data/symbols/java.rmi-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-H.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-H.sym.txt diff --git a/make/data/symbols/java.rmi-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-I.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-I.sym.txt diff --git a/make/data/symbols/java.scripting-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-7.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-7.sym.txt diff --git a/make/data/symbols/java.scripting-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-8.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-8.sym.txt diff --git a/make/data/symbols/java.scripting-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-9.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-9.sym.txt diff --git a/make/data/symbols/java.scripting-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-A.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-A.sym.txt diff --git a/make/data/symbols/java.scripting-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-B.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-B.sym.txt diff --git a/make/data/symbols/java.scripting-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-G.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-G.sym.txt diff --git a/make/data/symbols/java.scripting-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-H.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-H.sym.txt diff --git a/make/data/symbols/java.scripting-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-I.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-I.sym.txt diff --git a/make/data/symbols/java.se-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.se-9.sym.txt similarity index 100% rename from make/data/symbols/java.se-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se-9.sym.txt diff --git a/make/data/symbols/java.se-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.se-A.sym.txt similarity index 100% rename from make/data/symbols/java.se-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se-A.sym.txt diff --git a/make/data/symbols/java.se-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.se-B.sym.txt similarity index 100% rename from make/data/symbols/java.se-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se-B.sym.txt diff --git a/make/data/symbols/java.se.ee-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.se.ee-9.sym.txt similarity index 100% rename from make/data/symbols/java.se.ee-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se.ee-9.sym.txt diff --git a/make/data/symbols/java.se.ee-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.se.ee-A.sym.txt similarity index 100% rename from make/data/symbols/java.se.ee-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se.ee-A.sym.txt diff --git a/make/data/symbols/java.se.ee-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.se.ee-B.sym.txt similarity index 100% rename from make/data/symbols/java.se.ee-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se.ee-B.sym.txt diff --git a/make/data/symbols/java.security.jgss-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-7.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-7.sym.txt diff --git a/make/data/symbols/java.security.jgss-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-8.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-8.sym.txt diff --git a/make/data/symbols/java.security.jgss-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-9.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-9.sym.txt diff --git a/make/data/symbols/java.security.jgss-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-A.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-A.sym.txt diff --git a/make/data/symbols/java.security.jgss-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-B.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-B.sym.txt diff --git a/make/data/symbols/java.security.jgss-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-D.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-D.sym.txt diff --git a/make/data/symbols/java.security.jgss-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-G.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-G.sym.txt diff --git a/make/data/symbols/java.security.jgss-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-H.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-H.sym.txt diff --git a/make/data/symbols/java.security.jgss-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-I.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-I.sym.txt diff --git a/make/data/symbols/java.security.sasl-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-7.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-7.sym.txt diff --git a/make/data/symbols/java.security.sasl-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-8.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-8.sym.txt diff --git a/make/data/symbols/java.security.sasl-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-9.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-9.sym.txt diff --git a/make/data/symbols/java.security.sasl-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-A.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-A.sym.txt diff --git a/make/data/symbols/java.security.sasl-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-B.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-B.sym.txt diff --git a/make/data/symbols/java.security.sasl-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-G.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-G.sym.txt diff --git a/make/data/symbols/java.security.sasl-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-H.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-H.sym.txt diff --git a/make/data/symbols/java.security.sasl-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-I.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-I.sym.txt diff --git a/make/data/symbols/java.smartcardio-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-9.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-9.sym.txt diff --git a/make/data/symbols/java.smartcardio-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-A.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-A.sym.txt diff --git a/make/data/symbols/java.smartcardio-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-B.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-B.sym.txt diff --git a/make/data/symbols/java.smartcardio-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-G.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-G.sym.txt diff --git a/make/data/symbols/java.smartcardio-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-H.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-H.sym.txt diff --git a/make/data/symbols/java.smartcardio-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-I.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-I.sym.txt diff --git a/make/data/symbols/java.sql-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-7.sym.txt similarity index 100% rename from make/data/symbols/java.sql-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-7.sym.txt diff --git a/make/data/symbols/java.sql-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-8.sym.txt similarity index 100% rename from make/data/symbols/java.sql-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-8.sym.txt diff --git a/make/data/symbols/java.sql-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-9.sym.txt similarity index 100% rename from make/data/symbols/java.sql-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-9.sym.txt diff --git a/make/data/symbols/java.sql-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-A.sym.txt similarity index 100% rename from make/data/symbols/java.sql-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-A.sym.txt diff --git a/make/data/symbols/java.sql-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-B.sym.txt similarity index 100% rename from make/data/symbols/java.sql-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-B.sym.txt diff --git a/make/data/symbols/java.sql-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-G.sym.txt similarity index 100% rename from make/data/symbols/java.sql-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-G.sym.txt diff --git a/make/data/symbols/java.sql-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-H.sym.txt similarity index 100% rename from make/data/symbols/java.sql-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-H.sym.txt diff --git a/make/data/symbols/java.sql-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-I.sym.txt similarity index 100% rename from make/data/symbols/java.sql-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-I.sym.txt diff --git a/make/data/symbols/java.sql.rowset-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-7.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-7.sym.txt diff --git a/make/data/symbols/java.sql.rowset-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-8.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-8.sym.txt diff --git a/make/data/symbols/java.sql.rowset-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-9.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-9.sym.txt diff --git a/make/data/symbols/java.sql.rowset-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-A.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-A.sym.txt diff --git a/make/data/symbols/java.sql.rowset-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-B.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-B.sym.txt diff --git a/make/data/symbols/java.sql.rowset-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-G.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-G.sym.txt diff --git a/make/data/symbols/java.sql.rowset-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-H.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-H.sym.txt diff --git a/make/data/symbols/java.sql.rowset-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-I.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-I.sym.txt diff --git a/make/data/symbols/java.transaction-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-8.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-8.sym.txt diff --git a/make/data/symbols/java.transaction-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-9.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-9.sym.txt diff --git a/make/data/symbols/java.transaction-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-A.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-A.sym.txt diff --git a/make/data/symbols/java.transaction-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-B.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-B.sym.txt diff --git a/make/data/symbols/java.transaction.xa-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction.xa-B.sym.txt similarity index 100% rename from make/data/symbols/java.transaction.xa-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction.xa-B.sym.txt diff --git a/make/data/symbols/java.xml-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-7.sym.txt similarity index 100% rename from make/data/symbols/java.xml-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-7.sym.txt diff --git a/make/data/symbols/java.xml-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-8.sym.txt diff --git a/make/data/symbols/java.xml-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-9.sym.txt diff --git a/make/data/symbols/java.xml-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-A.sym.txt diff --git a/make/data/symbols/java.xml-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-B.sym.txt diff --git a/make/data/symbols/java.xml-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-C.sym.txt similarity index 100% rename from make/data/symbols/java.xml-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-C.sym.txt diff --git a/make/data/symbols/java.xml-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-D.sym.txt similarity index 100% rename from make/data/symbols/java.xml-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-D.sym.txt diff --git a/make/data/symbols/java.xml-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-E.sym.txt similarity index 100% rename from make/data/symbols/java.xml-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-E.sym.txt diff --git a/make/data/symbols/java.xml-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-F.sym.txt similarity index 100% rename from make/data/symbols/java.xml-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-F.sym.txt diff --git a/make/data/symbols/java.xml-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-G.sym.txt similarity index 100% rename from make/data/symbols/java.xml-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-G.sym.txt diff --git a/make/data/symbols/java.xml-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-H.sym.txt similarity index 100% rename from make/data/symbols/java.xml-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-H.sym.txt diff --git a/make/data/symbols/java.xml-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-I.sym.txt similarity index 100% rename from make/data/symbols/java.xml-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-I.sym.txt diff --git a/make/data/symbols/java.xml.bind-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-7.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-7.sym.txt diff --git a/make/data/symbols/java.xml.bind-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-8.sym.txt diff --git a/make/data/symbols/java.xml.bind-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-9.sym.txt diff --git a/make/data/symbols/java.xml.bind-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-A.sym.txt diff --git a/make/data/symbols/java.xml.bind-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-B.sym.txt diff --git a/make/data/symbols/java.xml.crypto-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-8.sym.txt diff --git a/make/data/symbols/java.xml.crypto-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-9.sym.txt diff --git a/make/data/symbols/java.xml.crypto-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-A.sym.txt diff --git a/make/data/symbols/java.xml.crypto-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-B.sym.txt diff --git a/make/data/symbols/java.xml.crypto-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-D.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-D.sym.txt diff --git a/make/data/symbols/java.xml.crypto-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-G.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-G.sym.txt diff --git a/make/data/symbols/java.xml.crypto-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-H.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-H.sym.txt diff --git a/make/data/symbols/java.xml.crypto-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-I.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-I.sym.txt diff --git a/make/data/symbols/java.xml.ws-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-8.sym.txt diff --git a/make/data/symbols/java.xml.ws-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-9.sym.txt diff --git a/make/data/symbols/java.xml.ws-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-A.sym.txt diff --git a/make/data/symbols/java.xml.ws-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-B.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-7.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-7.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-8.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-9.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-A.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-B.sym.txt diff --git a/make/data/symbols/jdk.accessibility-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-9.sym.txt diff --git a/make/data/symbols/jdk.accessibility-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-A.sym.txt diff --git a/make/data/symbols/jdk.accessibility-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-B.sym.txt diff --git a/make/data/symbols/jdk.accessibility-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-G.sym.txt diff --git a/make/data/symbols/jdk.accessibility-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-H.sym.txt diff --git a/make/data/symbols/jdk.accessibility-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-I.sym.txt diff --git a/make/data/symbols/jdk.attach-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-9.sym.txt diff --git a/make/data/symbols/jdk.attach-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-A.sym.txt diff --git a/make/data/symbols/jdk.attach-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-B.sym.txt diff --git a/make/data/symbols/jdk.attach-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-G.sym.txt diff --git a/make/data/symbols/jdk.attach-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-H.sym.txt diff --git a/make/data/symbols/jdk.attach-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-I.sym.txt diff --git a/make/data/symbols/jdk.charsets-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.charsets-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.charsets-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.charsets-9.sym.txt diff --git a/make/data/symbols/jdk.charsets-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.charsets-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.charsets-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.charsets-A.sym.txt diff --git a/make/data/symbols/jdk.charsets-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.charsets-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.charsets-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.charsets-B.sym.txt diff --git a/make/data/symbols/jdk.compiler-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-9.sym.txt diff --git a/make/data/symbols/jdk.compiler-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-A.sym.txt diff --git a/make/data/symbols/jdk.compiler-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-B.sym.txt diff --git a/make/data/symbols/jdk.compiler-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-C.sym.txt diff --git a/make/data/symbols/jdk.compiler-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-D.sym.txt diff --git a/make/data/symbols/jdk.compiler-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-E.sym.txt diff --git a/make/data/symbols/jdk.compiler-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-F.sym.txt diff --git a/make/data/symbols/jdk.compiler-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-G.sym.txt diff --git a/make/data/symbols/jdk.compiler-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-H.sym.txt diff --git a/make/data/symbols/jdk.compiler-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-I.sym.txt diff --git a/make/data/symbols/jdk.crypto.cryptoki-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.cryptoki-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-9.sym.txt diff --git a/make/data/symbols/jdk.crypto.cryptoki-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.cryptoki-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-A.sym.txt diff --git a/make/data/symbols/jdk.crypto.cryptoki-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.cryptoki-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-B.sym.txt diff --git a/make/data/symbols/jdk.crypto.ec-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.ec-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.ec-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.ec-9.sym.txt diff --git a/make/data/symbols/jdk.crypto.ec-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.ec-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.ec-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.ec-A.sym.txt diff --git a/make/data/symbols/jdk.crypto.ec-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.ec-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.ec-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.ec-B.sym.txt diff --git a/make/data/symbols/jdk.dynalink-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-9.sym.txt diff --git a/make/data/symbols/jdk.dynalink-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-A.sym.txt diff --git a/make/data/symbols/jdk.dynalink-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-B.sym.txt diff --git a/make/data/symbols/jdk.dynalink-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-G.sym.txt diff --git a/make/data/symbols/jdk.dynalink-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-H.sym.txt diff --git a/make/data/symbols/jdk.dynalink-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-I.sym.txt diff --git a/make/data/symbols/jdk.editpad-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.editpad-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.editpad-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.editpad-9.sym.txt diff --git a/make/data/symbols/jdk.editpad-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.editpad-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.editpad-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.editpad-A.sym.txt diff --git a/make/data/symbols/jdk.editpad-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.editpad-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.editpad-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.editpad-B.sym.txt diff --git a/make/data/symbols/jdk.hotspot.agent-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.hotspot.agent-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-9.sym.txt diff --git a/make/data/symbols/jdk.hotspot.agent-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.hotspot.agent-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-A.sym.txt diff --git a/make/data/symbols/jdk.hotspot.agent-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.hotspot.agent-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-B.sym.txt diff --git a/make/data/symbols/jdk.httpserver-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-7.sym.txt diff --git a/make/data/symbols/jdk.httpserver-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-8.sym.txt diff --git a/make/data/symbols/jdk.httpserver-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-9.sym.txt diff --git a/make/data/symbols/jdk.httpserver-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-A.sym.txt diff --git a/make/data/symbols/jdk.httpserver-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-B.sym.txt diff --git a/make/data/symbols/jdk.httpserver-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-D.sym.txt diff --git a/make/data/symbols/jdk.httpserver-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-E.sym.txt diff --git a/make/data/symbols/jdk.httpserver-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-G.sym.txt diff --git a/make/data/symbols/jdk.httpserver-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-H.sym.txt diff --git a/make/data/symbols/jdk.httpserver-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-I.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-E.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-F.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-G.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-H.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-I.sym.txt diff --git a/make/data/symbols/jdk.incubator.httpclient-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.httpclient-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-9.sym.txt diff --git a/make/data/symbols/jdk.incubator.httpclient-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.httpclient-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-A.sym.txt diff --git a/make/data/symbols/jdk.incubator.httpclient-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.httpclient-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-B.sym.txt diff --git a/make/data/symbols/jdk.incubator.jpackage-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.jpackage-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-E.sym.txt diff --git a/make/data/symbols/jdk.incubator.jpackage-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.jpackage-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-G.sym.txt diff --git a/make/data/symbols/jdk.incubator.vector-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.vector-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.vector-G.sym.txt diff --git a/make/data/symbols/jdk.incubator.vector-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.vector-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.vector-H.sym.txt diff --git a/make/data/symbols/jdk.incubator.vector-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.vector-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.vector-I.sym.txt diff --git a/make/data/symbols/jdk.jartool-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-9.sym.txt diff --git a/make/data/symbols/jdk.jartool-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-A.sym.txt diff --git a/make/data/symbols/jdk.jartool-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-B.sym.txt diff --git a/make/data/symbols/jdk.jartool-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-D.sym.txt diff --git a/make/data/symbols/jdk.jartool-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-F.sym.txt diff --git a/make/data/symbols/jdk.jartool-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-G.sym.txt diff --git a/make/data/symbols/jdk.jartool-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-H.sym.txt diff --git a/make/data/symbols/jdk.jartool-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-I.sym.txt diff --git a/make/data/symbols/jdk.javadoc-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-9.sym.txt diff --git a/make/data/symbols/jdk.javadoc-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-A.sym.txt diff --git a/make/data/symbols/jdk.javadoc-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-B.sym.txt diff --git a/make/data/symbols/jdk.javadoc-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-D.sym.txt diff --git a/make/data/symbols/jdk.javadoc-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-F.sym.txt diff --git a/make/data/symbols/jdk.javadoc-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-G.sym.txt diff --git a/make/data/symbols/jdk.javadoc-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-H.sym.txt diff --git a/make/data/symbols/jdk.javadoc-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-I.sym.txt diff --git a/make/data/symbols/jdk.jcmd-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jcmd-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jcmd-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jcmd-9.sym.txt diff --git a/make/data/symbols/jdk.jcmd-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jcmd-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jcmd-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jcmd-A.sym.txt diff --git a/make/data/symbols/jdk.jcmd-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jcmd-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jcmd-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jcmd-B.sym.txt diff --git a/make/data/symbols/jdk.jconsole-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-9.sym.txt diff --git a/make/data/symbols/jdk.jconsole-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-A.sym.txt diff --git a/make/data/symbols/jdk.jconsole-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-B.sym.txt diff --git a/make/data/symbols/jdk.jconsole-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-G.sym.txt diff --git a/make/data/symbols/jdk.jconsole-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-H.sym.txt diff --git a/make/data/symbols/jdk.jconsole-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-I.sym.txt diff --git a/make/data/symbols/jdk.jdeps-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdeps-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdeps-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdeps-9.sym.txt diff --git a/make/data/symbols/jdk.jdeps-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdeps-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdeps-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdeps-A.sym.txt diff --git a/make/data/symbols/jdk.jdeps-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdeps-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdeps-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdeps-B.sym.txt diff --git a/make/data/symbols/jdk.jdi-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-9.sym.txt diff --git a/make/data/symbols/jdk.jdi-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-A.sym.txt diff --git a/make/data/symbols/jdk.jdi-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-B.sym.txt diff --git a/make/data/symbols/jdk.jdi-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-F.sym.txt diff --git a/make/data/symbols/jdk.jdi-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-G.sym.txt diff --git a/make/data/symbols/jdk.jdi-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-H.sym.txt diff --git a/make/data/symbols/jdk.jdi-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-I.sym.txt diff --git a/make/data/symbols/jdk.jdwp.agent-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdwp.agent-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-9.sym.txt diff --git a/make/data/symbols/jdk.jdwp.agent-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdwp.agent-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-A.sym.txt diff --git a/make/data/symbols/jdk.jdwp.agent-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdwp.agent-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-B.sym.txt diff --git a/make/data/symbols/jdk.jfr-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-B.sym.txt diff --git a/make/data/symbols/jdk.jfr-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-C.sym.txt diff --git a/make/data/symbols/jdk.jfr-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-E.sym.txt diff --git a/make/data/symbols/jdk.jfr-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-G.sym.txt diff --git a/make/data/symbols/jdk.jfr-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-H.sym.txt diff --git a/make/data/symbols/jdk.jlink-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-9.sym.txt diff --git a/make/data/symbols/jdk.jlink-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-A.sym.txt diff --git a/make/data/symbols/jdk.jlink-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-B.sym.txt diff --git a/make/data/symbols/jdk.jlink-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-D.sym.txt diff --git a/make/data/symbols/jdk.jlink-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-E.sym.txt diff --git a/make/data/symbols/jdk.jlink-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-I.sym.txt diff --git a/make/data/symbols/jdk.jpackage-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jpackage-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jpackage-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jpackage-G.sym.txt diff --git a/make/data/symbols/jdk.jshell-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-9.sym.txt diff --git a/make/data/symbols/jdk.jshell-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-A.sym.txt diff --git a/make/data/symbols/jdk.jshell-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-B.sym.txt diff --git a/make/data/symbols/jdk.jshell-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-D.sym.txt diff --git a/make/data/symbols/jdk.jshell-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-E.sym.txt diff --git a/make/data/symbols/jdk.jshell-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-G.sym.txt diff --git a/make/data/symbols/jdk.jshell-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-H.sym.txt diff --git a/make/data/symbols/jdk.jshell-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-I.sym.txt diff --git a/make/data/symbols/jdk.jsobject-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-9.sym.txt diff --git a/make/data/symbols/jdk.jsobject-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-A.sym.txt diff --git a/make/data/symbols/jdk.jsobject-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-B.sym.txt diff --git a/make/data/symbols/jdk.jsobject-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-C.sym.txt diff --git a/make/data/symbols/jdk.jsobject-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-E.sym.txt diff --git a/make/data/symbols/jdk.jsobject-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-G.sym.txt diff --git a/make/data/symbols/jdk.jsobject-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-H.sym.txt diff --git a/make/data/symbols/jdk.jsobject-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-I.sym.txt diff --git a/make/data/symbols/jdk.jstatd-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jstatd-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jstatd-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jstatd-9.sym.txt diff --git a/make/data/symbols/jdk.jstatd-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jstatd-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jstatd-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jstatd-A.sym.txt diff --git a/make/data/symbols/jdk.jstatd-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jstatd-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jstatd-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jstatd-B.sym.txt diff --git a/make/data/symbols/jdk.localedata-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.localedata-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.localedata-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.localedata-9.sym.txt diff --git a/make/data/symbols/jdk.localedata-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.localedata-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.localedata-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.localedata-A.sym.txt diff --git a/make/data/symbols/jdk.localedata-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.localedata-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.localedata-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.localedata-B.sym.txt diff --git a/make/data/symbols/jdk.management-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-7.sym.txt diff --git a/make/data/symbols/jdk.management-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-8.sym.txt diff --git a/make/data/symbols/jdk.management-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-9.sym.txt diff --git a/make/data/symbols/jdk.management-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-A.sym.txt diff --git a/make/data/symbols/jdk.management-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-B.sym.txt diff --git a/make/data/symbols/jdk.management-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-E.sym.txt diff --git a/make/data/symbols/jdk.management-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-G.sym.txt diff --git a/make/data/symbols/jdk.management-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-H.sym.txt diff --git a/make/data/symbols/jdk.management-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-I.sym.txt diff --git a/make/data/symbols/jdk.management.agent-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.agent-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.agent-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.agent-9.sym.txt diff --git a/make/data/symbols/jdk.management.agent-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.agent-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.agent-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.agent-A.sym.txt diff --git a/make/data/symbols/jdk.management.agent-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.agent-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.agent-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.agent-B.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-B.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-G.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-H.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-I.sym.txt diff --git a/make/data/symbols/jdk.naming.dns-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.dns-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.dns-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.dns-9.sym.txt diff --git a/make/data/symbols/jdk.naming.dns-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.dns-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.dns-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.dns-A.sym.txt diff --git a/make/data/symbols/jdk.naming.dns-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.dns-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.dns-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.dns-B.sym.txt diff --git a/make/data/symbols/jdk.naming.rmi-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.rmi-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.rmi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.rmi-9.sym.txt diff --git a/make/data/symbols/jdk.naming.rmi-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.rmi-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.rmi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.rmi-A.sym.txt diff --git a/make/data/symbols/jdk.naming.rmi-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.rmi-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.rmi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.rmi-B.sym.txt diff --git a/make/data/symbols/jdk.net-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-9.sym.txt diff --git a/make/data/symbols/jdk.net-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-A.sym.txt diff --git a/make/data/symbols/jdk.net-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-B.sym.txt diff --git a/make/data/symbols/jdk.net-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-E.sym.txt diff --git a/make/data/symbols/jdk.net-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-F.sym.txt diff --git a/make/data/symbols/jdk.net-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-G.sym.txt diff --git a/make/data/symbols/jdk.net-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-H.sym.txt diff --git a/make/data/symbols/jdk.net-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-I.sym.txt diff --git a/make/data/symbols/jdk.nio.mapmode-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.nio.mapmode-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.nio.mapmode-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.nio.mapmode-F.sym.txt diff --git a/make/data/symbols/jdk.pack-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-9.sym.txt diff --git a/make/data/symbols/jdk.pack-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-A.sym.txt diff --git a/make/data/symbols/jdk.pack-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-B.sym.txt diff --git a/make/data/symbols/jdk.pack-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-E.sym.txt diff --git a/make/data/symbols/jdk.policytool-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.policytool-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.policytool-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.policytool-9.sym.txt diff --git a/make/data/symbols/jdk.policytool-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.policytool-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.policytool-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.policytool-A.sym.txt diff --git a/make/data/symbols/jdk.rmic-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-9.sym.txt diff --git a/make/data/symbols/jdk.rmic-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-A.sym.txt diff --git a/make/data/symbols/jdk.rmic-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-B.sym.txt diff --git a/make/data/symbols/jdk.rmic-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-F.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-7.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-8.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-9.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-A.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-B.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-F.sym.txt diff --git a/make/data/symbols/jdk.sctp-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-7.sym.txt diff --git a/make/data/symbols/jdk.sctp-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-8.sym.txt diff --git a/make/data/symbols/jdk.sctp-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-9.sym.txt diff --git a/make/data/symbols/jdk.sctp-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-A.sym.txt diff --git a/make/data/symbols/jdk.sctp-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-B.sym.txt diff --git a/make/data/symbols/jdk.sctp-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-G.sym.txt diff --git a/make/data/symbols/jdk.sctp-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-H.sym.txt diff --git a/make/data/symbols/jdk.sctp-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-I.sym.txt diff --git a/make/data/symbols/jdk.security.auth-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-7.sym.txt diff --git a/make/data/symbols/jdk.security.auth-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-8.sym.txt diff --git a/make/data/symbols/jdk.security.auth-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-9.sym.txt diff --git a/make/data/symbols/jdk.security.auth-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-A.sym.txt diff --git a/make/data/symbols/jdk.security.auth-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-B.sym.txt diff --git a/make/data/symbols/jdk.security.auth-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-G.sym.txt diff --git a/make/data/symbols/jdk.security.auth-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-H.sym.txt diff --git a/make/data/symbols/jdk.security.auth-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-I.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-7.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-8.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-9.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-A.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-B.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-G.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-H.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-I.sym.txt diff --git a/make/data/symbols/jdk.unsupported-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-9.sym.txt diff --git a/make/data/symbols/jdk.unsupported-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-A.sym.txt diff --git a/make/data/symbols/jdk.unsupported-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-B.sym.txt diff --git a/make/data/symbols/jdk.unsupported-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-C.sym.txt diff --git a/make/data/symbols/jdk.unsupported-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-F.sym.txt diff --git a/make/data/symbols/jdk.unsupported-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-G.sym.txt diff --git a/make/data/symbols/jdk.unsupported-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-H.sym.txt diff --git a/make/data/symbols/jdk.unsupported-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-I.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-9.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-A.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-B.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-G.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-H.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-I.sym.txt diff --git a/make/data/symbols/jdk.zipfs-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.zipfs-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.zipfs-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.zipfs-9.sym.txt diff --git a/make/data/symbols/jdk.zipfs-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.zipfs-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.zipfs-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.zipfs-A.sym.txt diff --git a/make/data/symbols/jdk.zipfs-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.zipfs-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.zipfs-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.zipfs-B.sym.txt diff --git a/make/data/symbols/symbols b/src/jdk.compiler/share/data/symbols/symbols similarity index 100% rename from make/data/symbols/symbols rename to src/jdk.compiler/share/data/symbols/symbols diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java index c7552402509313ad98521793f77c4656c47a3316..5bc199b55ad4b7b3fa3f0137fadfb3b0080e22dc 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import java.security.spec.AlgorithmParameterSpec; import javax.crypto.*; +import sun.security.util.SecurityProviderConstants; import static sun.security.pkcs11.TemplateManager.*; import sun.security.pkcs11.wrapper.*; import static sun.security.pkcs11.wrapper.PKCS11Constants.*; @@ -225,7 +226,8 @@ final class P11KeyGenerator extends KeyGeneratorSpi { significantKeySize = 168; break; case (int)CKM_AES_KEY_GEN: - keySize = adjustKeySize(128, range); + keySize = adjustKeySize + (SecurityProviderConstants.getDefAESKeySize(), range); keyType = CKK_AES; break; case (int)CKM_RC4_KEY_GEN: diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java index f13ae3cd67ddcad436de77bf6f808f3a1829dd41..ba99d0bcb5c13b67e88cc06093b5ba07e1e02d15 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -99,29 +99,35 @@ final class P11KeyPairGenerator extends KeyPairGeneratorSpi { // set default key sizes and apply our own algorithm-specific limits // override lower limit to disallow unsecure keys being generated // override upper limit to deter DOS attack - if (algorithm.equals("EC")) { - keySize = DEF_EC_KEY_SIZE; - if (minKeyLen < 112) { - minKeyLen = 112; - } - if (maxKeyLen > 2048) { - maxKeyLen = 2048; + int jdkMinKeyLen = 512; + int jdkMaxKeyLen = Integer.MAX_VALUE; + switch (algorithm) { + case "EC" -> { + keySize = DEF_EC_KEY_SIZE; + jdkMinKeyLen = 112; + jdkMaxKeyLen = 2048; } - } else { - if (algorithm.equals("DSA")) { + case "DSA" -> { keySize = DEF_DSA_KEY_SIZE; - } else if (algorithm.equals("RSA")) { + } + case "RSA" -> { keySize = DEF_RSA_KEY_SIZE; - if (maxKeyLen > 64 * 1024) { - maxKeyLen = 64 * 1024; - } - } else { + jdkMaxKeyLen = 64 * 1024; + } + case "DH" -> { keySize = DEF_DH_KEY_SIZE; } - if (minKeyLen < 512) { - minKeyLen = 512; + default -> { + throw new ProviderException + ("Unrecognized algorithm for checking key size"); } } + if (minKeyLen < jdkMinKeyLen) { + minKeyLen = jdkMinKeyLen; + } + if (maxKeyLen > jdkMaxKeyLen) { + maxKeyLen = jdkMaxKeyLen; + } // auto-adjust default keysize in case it's out-of-range if (keySize < minKeyLen) { diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp index b7a2c6dde8fe56c4184f747a5d62aa4956ff8599..9accba375a2553020d96a7e9c2f0f427683b919e 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2021, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -60,6 +60,10 @@ #include "sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext.h" #endif +#ifdef riscv64 +#include "sun_jvm_hotspot_debugger_riscv64_RISCV64ThreadContext.h" +#endif + class AutoJavaString { JNIEnv* m_env; jstring m_str; @@ -408,7 +412,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo return (err == PS_OK)? array : 0; } -#if defined(i586) || defined(amd64) || defined(ppc64) || defined(ppc64le) || defined(aarch64) +#if defined(i586) || defined(amd64) || defined(ppc64) || defined(ppc64le) || defined(aarch64) || defined(riscv64) extern "C" JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0 (JNIEnv *env, jobject this_obj, jint lwp_id) { @@ -440,6 +444,9 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo #ifdef aarch64 #define NPRGREG sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext_NPRGREG #endif +#ifdef riscv64 +#define NPRGREG sun_jvm_hotspot_debugger_riscv64_RISCV64ThreadContext_NPRGREG +#endif #if defined(ppc64) || defined(ppc64le) #define NPRGREG sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_NPRGREG #endif @@ -516,6 +523,44 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo } #endif /* aarch64 */ +#if defined(riscv64) +#define REG_INDEX(reg) sun_jvm_hotspot_debugger_riscv64_RISCV64ThreadContext_##reg + + regs[REG_INDEX(PC)] = gregs.pc; + regs[REG_INDEX(LR)] = gregs.ra; + regs[REG_INDEX(SP)] = gregs.sp; + regs[REG_INDEX(R3)] = gregs.gp; + regs[REG_INDEX(R4)] = gregs.tp; + regs[REG_INDEX(R5)] = gregs.t0; + regs[REG_INDEX(R6)] = gregs.t1; + regs[REG_INDEX(R7)] = gregs.t2; + regs[REG_INDEX(R8)] = gregs.s0; + regs[REG_INDEX(R9)] = gregs.s1; + regs[REG_INDEX(R10)] = gregs.a0; + regs[REG_INDEX(R11)] = gregs.a1; + regs[REG_INDEX(R12)] = gregs.a2; + regs[REG_INDEX(R13)] = gregs.a3; + regs[REG_INDEX(R14)] = gregs.a4; + regs[REG_INDEX(R15)] = gregs.a5; + regs[REG_INDEX(R16)] = gregs.a6; + regs[REG_INDEX(R17)] = gregs.a7; + regs[REG_INDEX(R18)] = gregs.s2; + regs[REG_INDEX(R19)] = gregs.s3; + regs[REG_INDEX(R20)] = gregs.s4; + regs[REG_INDEX(R21)] = gregs.s5; + regs[REG_INDEX(R22)] = gregs.s6; + regs[REG_INDEX(R23)] = gregs.s7; + regs[REG_INDEX(R24)] = gregs.s8; + regs[REG_INDEX(R25)] = gregs.s9; + regs[REG_INDEX(R26)] = gregs.s10; + regs[REG_INDEX(R27)] = gregs.s11; + regs[REG_INDEX(R28)] = gregs.t3; + regs[REG_INDEX(R29)] = gregs.t4; + regs[REG_INDEX(R30)] = gregs.t5; + regs[REG_INDEX(R31)] = gregs.t6; + +#endif /* riscv64 */ + #if defined(ppc64) || defined(ppc64le) #define REG_INDEX(reg) sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_##reg diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h index b0fcfb1e4d59b97aaad6d9199c98970f92530705..a69496e77a4d46ee4593ae6d4a996189ad2dad0e 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ #elif defined(arm) #include #define user_regs_struct pt_regs +#elif defined(riscv64) +#include #endif // This C bool type must be int for compatibility with Linux calls and diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java index 04db854c84d03f2e064e3ee8305a437e19856478..0890dcf88931f081088c88d179090e3920014b7e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java @@ -36,6 +36,7 @@ import sun.jvm.hotspot.debugger.MachineDescription; import sun.jvm.hotspot.debugger.MachineDescriptionAMD64; import sun.jvm.hotspot.debugger.MachineDescriptionPPC64; import sun.jvm.hotspot.debugger.MachineDescriptionAArch64; +import sun.jvm.hotspot.debugger.MachineDescriptionRISCV64; import sun.jvm.hotspot.debugger.MachineDescriptionIntelX86; import sun.jvm.hotspot.debugger.NoSuchSymbolException; import sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal; @@ -558,6 +559,8 @@ public class HotSpotAgent { machDesc = new MachineDescriptionPPC64(); } else if (cpu.equals("aarch64")) { machDesc = new MachineDescriptionAArch64(); + } else if (cpu.equals("riscv64")) { + machDesc = new MachineDescriptionRISCV64(); } else { try { machDesc = (MachineDescription) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionRISCV64.java similarity index 65% rename from src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java rename to src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionRISCV64.java index 3d96d33d81e8974677bbfb23676689472da2c895..a972516dee3b0e418da8a1e383c5571ed656ce9e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionRISCV64.java @@ -1,5 +1,6 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,19 +23,18 @@ * */ -package sun.jvm.hotspot.gc.shared; +package sun.jvm.hotspot.debugger; -import sun.jvm.hotspot.debugger.*; - -/** Class CardGeneration is a generation that is covered by a card - table, and uses a card-size block-offset array to implement - block_start. */ +public class MachineDescriptionRISCV64 extends MachineDescriptionTwosComplement implements MachineDescription { + public long getAddressSize() { + return 8; + } -public abstract class CardGeneration extends Generation { - public CardGeneration(Address addr) { - super(addr); + public boolean isLP64() { + return true; } - // FIXME: not sure what I need to expose from here in order to have - // verification similar to that of the old RememberedSet + public boolean isBigEndian() { + return false; + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java index 491e3d5dc2c007f50772df4b60ce76105778c8d2..469bb6e0665557f053985688d4a921b858aa0f49 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -33,11 +33,13 @@ import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.x86.*; import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.aarch64.*; +import sun.jvm.hotspot.debugger.riscv64.*; import sun.jvm.hotspot.debugger.ppc64.*; import sun.jvm.hotspot.debugger.linux.x86.*; import sun.jvm.hotspot.debugger.linux.amd64.*; import sun.jvm.hotspot.debugger.linux.ppc64.*; import sun.jvm.hotspot.debugger.linux.aarch64.*; +import sun.jvm.hotspot.debugger.linux.riscv64.*; import sun.jvm.hotspot.utilities.*; class LinuxCDebugger implements CDebugger { @@ -105,7 +107,14 @@ class LinuxCDebugger implements CDebugger { Address pc = context.getRegisterAsAddress(AARCH64ThreadContext.PC); if (pc == null) return null; return new LinuxAARCH64CFrame(dbg, fp, pc); - } else { + } else if (cpu.equals("riscv64")) { + RISCV64ThreadContext context = (RISCV64ThreadContext) thread.getContext(); + Address fp = context.getRegisterAsAddress(RISCV64ThreadContext.FP); + if (fp == null) return null; + Address pc = context.getRegisterAsAddress(RISCV64ThreadContext.PC); + if (pc == null) return null; + return new LinuxRISCV64CFrame(dbg, fp, pc); + } else { // Runtime exception thrown by LinuxThreadContextFactory if unknown cpu ThreadContext context = (ThreadContext) thread.getContext(); return context.getTopFrame(dbg); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64CFrame.java new file mode 100644 index 0000000000000000000000000000000000000000..f06da24bd0e30e8e442de1fffe824f5f5fef164b --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64CFrame.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.linux.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.debugger.linux.*; +import sun.jvm.hotspot.debugger.cdbg.*; +import sun.jvm.hotspot.debugger.cdbg.basic.*; + +public final class LinuxRISCV64CFrame extends BasicCFrame { + private static final int C_FRAME_LINK_OFFSET = -2; + private static final int C_FRAME_RETURN_ADDR_OFFSET = -1; + + public LinuxRISCV64CFrame(LinuxDebugger dbg, Address fp, Address pc) { + super(dbg.getCDebugger()); + this.fp = fp; + this.pc = pc; + this.dbg = dbg; + } + + // override base class impl to avoid ELF parsing + public ClosestSymbol closestSymbolToPC() { + // try native lookup in debugger. + return dbg.lookup(dbg.getAddressValue(pc())); + } + + public Address pc() { + return pc; + } + + public Address localVariableBase() { + return fp; + } + + public CFrame sender(ThreadProxy thread) { + RISCV64ThreadContext context = (RISCV64ThreadContext) thread.getContext(); + Address rsp = context.getRegisterAsAddress(RISCV64ThreadContext.SP); + + if ((fp == null) || fp.lessThan(rsp)) { + return null; + } + + // Check alignment of fp + if (dbg.getAddressValue(fp) % (2 * ADDRESS_SIZE) != 0) { + return null; + } + + Address nextFP = fp.getAddressAt(C_FRAME_LINK_OFFSET * ADDRESS_SIZE); + if (nextFP == null || nextFP.lessThanOrEqual(fp)) { + return null; + } + Address nextPC = fp.getAddressAt(C_FRAME_RETURN_ADDR_OFFSET * ADDRESS_SIZE); + if (nextPC == null) { + return null; + } + return new LinuxRISCV64CFrame(dbg, nextFP, nextPC); + } + + // package/class internals only + private static final int ADDRESS_SIZE = 8; + private Address pc; + private Address sp; + private Address fp; + private LinuxDebugger dbg; +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64ThreadContext.java new file mode 100644 index 0000000000000000000000000000000000000000..fdb841ccf3dbcb43bd686a2ab17aab9c89bb664e --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64ThreadContext.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.linux.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.debugger.linux.*; + +public class LinuxRISCV64ThreadContext extends RISCV64ThreadContext { + private LinuxDebugger debugger; + + public LinuxRISCV64ThreadContext(LinuxDebugger debugger) { + super(); + this.debugger = debugger; + } + + public void setRegisterAsAddress(int index, Address value) { + setRegister(index, debugger.getAddressValue(value)); + } + + public Address getRegisterAsAddress(int index) { + return debugger.newAddress(getRegister(index)); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64Thread.java new file mode 100644 index 0000000000000000000000000000000000000000..96d5dee47cee343d2b45f038534bd3e4c6b98bff --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64Thread.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.proc.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.debugger.proc.*; +import sun.jvm.hotspot.utilities.*; + +public class ProcRISCV64Thread implements ThreadProxy { + private ProcDebugger debugger; + private int id; + + public ProcRISCV64Thread(ProcDebugger debugger, Address addr) { + this.debugger = debugger; + + // FIXME: the size here should be configurable. However, making it + // so would produce a dependency on the "types" package from the + // debugger package, which is not desired. + this.id = (int) addr.getCIntegerAt(0, 4, true); + } + + public ProcRISCV64Thread(ProcDebugger debugger, long id) { + this.debugger = debugger; + this.id = (int) id; + } + + public ThreadContext getContext() throws IllegalThreadStateException { + ProcRISCV64ThreadContext context = new ProcRISCV64ThreadContext(debugger); + long[] regs = debugger.getThreadIntegerRegisterSet(id); + if (Assert.ASSERTS_ENABLED) { + Assert.that(regs.length == RISCV64ThreadContext.NPRGREG, "size mismatch"); + } + for (int i = 0; i < regs.length; i++) { + context.setRegister(i, regs[i]); + } + return context; + } + + public boolean canSetContext() throws DebuggerException { + return false; + } + + public void setContext(ThreadContext context) + throws IllegalThreadStateException, DebuggerException { + throw new DebuggerException("Unimplemented"); + } + + public String toString() { + return "t@" + id; + } + + public boolean equals(Object obj) { + if ((obj == null) || !(obj instanceof ProcRISCV64Thread)) { + return false; + } + + return (((ProcRISCV64Thread) obj).id == id); + } + + public int hashCode() { + return id; + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadContext.java new file mode 100644 index 0000000000000000000000000000000000000000..f2aa845e665c84a3e9f3cf05c78ba4e2579828db --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadContext.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.proc.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.debugger.proc.*; + +public class ProcRISCV64ThreadContext extends RISCV64ThreadContext { + private ProcDebugger debugger; + + public ProcRISCV64ThreadContext(ProcDebugger debugger) { + super(); + this.debugger = debugger; + } + + public void setRegisterAsAddress(int index, Address value) { + setRegister(index, debugger.getAddressValue(value)); + } + + public Address getRegisterAsAddress(int index) { + return debugger.newAddress(getRegister(index)); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..19f64b8ce2dc8bb70e69b77db93479f59fb1d419 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.proc.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.proc.*; + +public class ProcRISCV64ThreadFactory implements ProcThreadFactory { + private ProcDebugger debugger; + + public ProcRISCV64ThreadFactory(ProcDebugger debugger) { + this.debugger = debugger; + } + + public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) { + return new ProcRISCV64Thread(debugger, threadIdentifierAddr); + } + + public ThreadProxy createThreadWrapper(long id) { + return new ProcRISCV64Thread(debugger, id); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64Thread.java new file mode 100644 index 0000000000000000000000000000000000000000..aecbda590238ac40b3450f6c1ea88fcf132df9e3 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64Thread.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.remote.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.debugger.remote.*; +import sun.jvm.hotspot.utilities.*; + +public class RemoteRISCV64Thread extends RemoteThread { + public RemoteRISCV64Thread(RemoteDebuggerClient debugger, Address addr) { + super(debugger, addr); + } + + public RemoteRISCV64Thread(RemoteDebuggerClient debugger, long id) { + super(debugger, id); + } + + public ThreadContext getContext() throws IllegalThreadStateException { + RemoteRISCV64ThreadContext context = new RemoteRISCV64ThreadContext(debugger); + long[] regs = (addr != null)? debugger.getThreadIntegerRegisterSet(addr) : + debugger.getThreadIntegerRegisterSet(id); + if (Assert.ASSERTS_ENABLED) { + Assert.that(regs.length == RISCV64ThreadContext.NPRGREG, "size of register set must match"); + } + for (int i = 0; i < regs.length; i++) { + context.setRegister(i, regs[i]); + } + return context; + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64ThreadContext.java new file mode 100644 index 0000000000000000000000000000000000000000..1d3da6be5afe1dff774bb6edf0a67601bb2cb770 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64ThreadContext.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.remote.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.debugger.remote.*; + +public class RemoteRISCV64ThreadContext extends RISCV64ThreadContext { + private RemoteDebuggerClient debugger; + + public RemoteRISCV64ThreadContext(RemoteDebuggerClient debugger) { + super(); + this.debugger = debugger; + } + + public void setRegisterAsAddress(int index, Address value) { + setRegister(index, debugger.getAddressValue(value)); + } + + public Address getRegisterAsAddress(int index) { + return debugger.newAddress(getRegister(index)); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64ThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64ThreadFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..725b94e25a31e2527aae984aa7e92ffeac731dbc --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/riscv64/RemoteRISCV64ThreadFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.remote.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.remote.*; + +public class RemoteRISCV64ThreadFactory implements RemoteThreadFactory { + private RemoteDebuggerClient debugger; + + public RemoteRISCV64ThreadFactory(RemoteDebuggerClient debugger) { + this.debugger = debugger; + } + + public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) { + return new RemoteRISCV64Thread(debugger, threadIdentifierAddr); + } + + public ThreadProxy createThreadWrapper(long id) { + return new RemoteRISCV64Thread(debugger, id); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/riscv64/RISCV64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/riscv64/RISCV64ThreadContext.java new file mode 100644 index 0000000000000000000000000000000000000000..fb60a70427a5f455a3198c1f09a1d3ef4193c9a7 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/riscv64/RISCV64ThreadContext.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.debugger.riscv64; + +import java.lang.annotation.Native; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.cdbg.*; + +/** Specifies the thread context on riscv64 platforms; only a sub-portion + * of the context is guaranteed to be present on all operating + * systems. */ + +public abstract class RISCV64ThreadContext implements ThreadContext { + // Taken from /usr/include/asm/sigcontext.h on Linux/RISCV64. + + // /* + // * Signal context structure - contains all info to do with the state + // * before the signal handler was invoked. + // */ + // struct sigcontext { + // struct user_regs_struct sc_regs; + // union __riscv_fp_state sc_fpregs; + // }; + // + // struct user_regs_struct { + // unsigned long pc; + // unsigned long ra; + // unsigned long sp; + // unsigned long gp; + // unsigned long tp; + // unsigned long t0; + // unsigned long t1; + // unsigned long t2; + // unsigned long s0; + // unsigned long s1; + // unsigned long a0; + // unsigned long a1; + // unsigned long a2; + // unsigned long a3; + // unsigned long a4; + // unsigned long a5; + // unsigned long a6; + // unsigned long a7; + // unsigned long s2; + // unsigned long s3; + // unsigned long s4; + // unsigned long s5; + // unsigned long s6; + // unsigned long s7; + // unsigned long s8; + // unsigned long s9; + // unsigned long s10; + // unsigned long s11; + // unsigned long t3; + // unsigned long t4; + // unsigned long t5; + // unsigned long t6; + // }; + + // NOTE: the indices for the various registers must be maintained as + // listed across various operating systems. However, only a small + // subset of the registers' values are guaranteed to be present (and + // must be present for the SA's stack walking to work) + + // One instance of the Native annotation is enough to trigger header generation + // for this file. + @Native + public static final int R0 = 0; + public static final int R1 = 1; + public static final int R2 = 2; + public static final int R3 = 3; + public static final int R4 = 4; + public static final int R5 = 5; + public static final int R6 = 6; + public static final int R7 = 7; + public static final int R8 = 8; + public static final int R9 = 9; + public static final int R10 = 10; + public static final int R11 = 11; + public static final int R12 = 12; + public static final int R13 = 13; + public static final int R14 = 14; + public static final int R15 = 15; + public static final int R16 = 16; + public static final int R17 = 17; + public static final int R18 = 18; + public static final int R19 = 19; + public static final int R20 = 20; + public static final int R21 = 21; + public static final int R22 = 22; + public static final int R23 = 23; + public static final int R24 = 24; + public static final int R25 = 25; + public static final int R26 = 26; + public static final int R27 = 27; + public static final int R28 = 28; + public static final int R29 = 29; + public static final int R30 = 30; + public static final int R31 = 31; + + public static final int NPRGREG = 32; + + public static final int PC = R0; + public static final int LR = R1; + public static final int SP = R2; + public static final int FP = R8; + + private long[] data; + + public RISCV64ThreadContext() { + data = new long[NPRGREG]; + } + + public int getNumRegisters() { + return NPRGREG; + } + + public String getRegisterName(int index) { + switch (index) { + case LR: return "lr"; + case SP: return "sp"; + case PC: return "pc"; + default: + return "r" + index; + } + } + + public void setRegister(int index, long value) { + data[index] = value; + } + + public long getRegister(int index) { + return data[index]; + } + + public CFrame getTopFrame(Debugger dbg) { + return null; + } + + /** This can't be implemented in this class since we would have to + * tie the implementation to, for example, the debugging system */ + public abstract void setRegisterAsAddress(int index, Address value); + + /** This can't be implemented in this class since we would have to + * tie the implementation to, for example, the debugging system */ + public abstract Address getRegisterAsAddress(int index); +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java index 6f121f963af17f69ff31bd4acb94c14cff0ed8de..cc4f216efc2047b4266d44fdb0f17fd61987ba17 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java @@ -39,7 +39,7 @@ import sun.jvm.hotspot.utilities.Observer;

    Garbage collection is performed using mark-compact.

    */ -public class TenuredGeneration extends CardGeneration { +public class TenuredGeneration extends Generation { private static AddressField theSpaceField; static { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java index eeb099a11dca80539d544f4f8d442363d9ad6cf3..5323d9cee4e9d10979d11051dbfa6cf6b8f4adfa 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java @@ -38,10 +38,7 @@ import sun.jvm.hotspot.utilities.Observer;
    • Generation
        -
      • CardGeneration -
          -
        • TenuredGeneration -
        +
      • TenuredGeneration
      • DefNewGeneration
    diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java index 4a2fa691d3ff6180c61d45b728632ef6a132c7ba..d16ac8aae518633cdc78fc204893809ead67c54c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import sun.jvm.hotspot.runtime.win32_aarch64.Win32AARCH64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_aarch64.LinuxAARCH64JavaThreadPDAccess; +import sun.jvm.hotspot.runtime.linux_riscv64.LinuxRISCV64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_ppc64.LinuxPPC64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess; import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess; @@ -113,6 +114,8 @@ public class Threads { access = new LinuxPPC64JavaThreadPDAccess(); } else if (cpu.equals("aarch64")) { access = new LinuxAARCH64JavaThreadPDAccess(); + } else if (cpu.equals("riscv64")) { + access = new LinuxRISCV64JavaThreadPDAccess(); } else { try { access = (JavaThreadPDAccess) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/linux_riscv64/LinuxRISCV64JavaThreadPDAccess.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/linux_riscv64/LinuxRISCV64JavaThreadPDAccess.java new file mode 100644 index 0000000000000000000000000000000000000000..f2e224f28eeaa5be7f431bed226c5b300c0c8910 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/linux_riscv64/LinuxRISCV64JavaThreadPDAccess.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.runtime.linux_riscv64; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.runtime.riscv64.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; +import sun.jvm.hotspot.utilities.Observable; +import sun.jvm.hotspot.utilities.Observer; + +public class LinuxRISCV64JavaThreadPDAccess implements JavaThreadPDAccess { + private static AddressField lastJavaFPField; + private static AddressField osThreadField; + + // Field from OSThread + private static CIntegerField osThreadThreadIDField; + + // This is currently unneeded but is being kept in case we change + // the currentFrameGuess algorithm + private static final long GUESS_SCAN_RANGE = 128 * 1024; + + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static synchronized void initialize(TypeDataBase db) { + Type type = db.lookupType("JavaThread"); + osThreadField = type.getAddressField("_osthread"); + + Type anchorType = db.lookupType("JavaFrameAnchor"); + lastJavaFPField = anchorType.getAddressField("_last_Java_fp"); + + Type osThreadType = db.lookupType("OSThread"); + osThreadThreadIDField = osThreadType.getCIntegerField("_thread_id"); + } + + public Address getLastJavaFP(Address addr) { + return lastJavaFPField.getValue(addr.addOffsetTo(sun.jvm.hotspot.runtime.JavaThread.getAnchorField().getOffset())); + } + + public Address getLastJavaPC(Address addr) { + return null; + } + + public Address getBaseOfStackPointer(Address addr) { + return null; + } + + public Frame getLastFramePD(JavaThread thread, Address addr) { + Address fp = thread.getLastJavaFP(); + if (fp == null) { + return null; // no information + } + return new RISCV64Frame(thread.getLastJavaSP(), fp); + } + + public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) { + return new RISCV64RegisterMap(thread, updateMap); + } + + public Frame getCurrentFrameGuess(JavaThread thread, Address addr) { + ThreadProxy t = getThreadProxy(addr); + RISCV64ThreadContext context = (RISCV64ThreadContext) t.getContext(); + RISCV64CurrentFrameGuess guesser = new RISCV64CurrentFrameGuess(context, thread); + if (!guesser.run(GUESS_SCAN_RANGE)) { + return null; + } + if (guesser.getPC() == null) { + return new RISCV64Frame(guesser.getSP(), guesser.getFP()); + } else { + return new RISCV64Frame(guesser.getSP(), guesser.getFP(), guesser.getPC()); + } + } + + public void printThreadIDOn(Address addr, PrintStream tty) { + tty.print(getThreadProxy(addr)); + } + + public void printInfoOn(Address threadAddr, PrintStream tty) { + tty.print("Thread id: "); + printThreadIDOn(threadAddr, tty); + } + + public Address getLastSP(Address addr) { + ThreadProxy t = getThreadProxy(addr); + RISCV64ThreadContext context = (RISCV64ThreadContext) t.getContext(); + return context.getRegisterAsAddress(RISCV64ThreadContext.SP); + } + + public ThreadProxy getThreadProxy(Address addr) { + // Addr is the address of the JavaThread. + // Fetch the OSThread (for now and for simplicity, not making a + // separate "OSThread" class in this package) + Address osThreadAddr = osThreadField.getValue(addr); + // Get the address of the _thread_id from the OSThread + Address threadIdAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset()); + + JVMDebugger debugger = VM.getVM().getDebugger(); + return debugger.getThreadForIdentifierAddress(threadIdAddr); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64CurrentFrameGuess.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64CurrentFrameGuess.java new file mode 100644 index 0000000000000000000000000000000000000000..34701c6922f3deaad09c9cb8d08165a7a55af82d --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64CurrentFrameGuess.java @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.runtime.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.riscv64.*; +import sun.jvm.hotspot.code.*; +import sun.jvm.hotspot.interpreter.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.runtime.riscv64.*; + +/**

    Should be able to be used on all riscv64 platforms we support + (Linux/riscv64) to implement JavaThread's "currentFrameGuess()" + functionality. Input is an RISCV64ThreadContext; output is SP, FP, + and PC for an RISCV64Frame. Instantiation of the RISCV64Frame is + left to the caller, since we may need to subclass RISCV64Frame to + support signal handler frames on Unix platforms.

    + +

    Algorithm is to walk up the stack within a given range (say, + 512K at most) looking for a plausible PC and SP for a Java frame, + also considering those coming in from the context. If we find a PC + that belongs to the VM (i.e., in generated code like the + interpreter or CodeCache) then we try to find an associated FP. + We repeat this until we either find a complete frame or run out of + stack to look at.

    */ + +public class RISCV64CurrentFrameGuess { + private RISCV64ThreadContext context; + private JavaThread thread; + private Address spFound; + private Address fpFound; + private Address pcFound; + + private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.riscv64.RISCV64Frame.DEBUG") + != null; + + public RISCV64CurrentFrameGuess(RISCV64ThreadContext context, + JavaThread thread) { + this.context = context; + this.thread = thread; + } + + /** Returns false if not able to find a frame within a reasonable range. */ + public boolean run(long regionInBytesToSearch) { + Address sp = context.getRegisterAsAddress(RISCV64ThreadContext.SP); + Address pc = context.getRegisterAsAddress(RISCV64ThreadContext.PC); + Address fp = context.getRegisterAsAddress(RISCV64ThreadContext.FP); + if (sp == null) { + // Bail out if no last java frame either + if (thread.getLastJavaSP() != null) { + setValues(thread.getLastJavaSP(), thread.getLastJavaFP(), null); + return true; + } + return false; + } + Address end = sp.addOffsetTo(regionInBytesToSearch); + VM vm = VM.getVM(); + + setValues(null, null, null); // Assume we're not going to find anything + + if (vm.isJavaPCDbg(pc)) { + if (vm.isClientCompiler()) { + // If the topmost frame is a Java frame, we are (pretty much) + // guaranteed to have a viable FP. We should be more robust + // than this (we have the potential for losing entire threads' + // stack traces) but need to see how much work we really have + // to do here. Searching the stack for an (SP, FP) pair is + // hard since it's easy to misinterpret inter-frame stack + // pointers as base-of-frame pointers; we also don't know the + // sizes of C1 frames (not registered in the nmethod) so can't + // derive them from SP. + + setValues(sp, fp, pc); + return true; + } else { + if (vm.getInterpreter().contains(pc)) { + if (DEBUG) { + System.out.println("CurrentFrameGuess: choosing interpreter frame: sp = " + + sp + ", fp = " + fp + ", pc = " + pc); + } + setValues(sp, fp, pc); + return true; + } + + // For the server compiler, FP is not guaranteed to be valid + // for compiled code. In addition, an earlier attempt at a + // non-searching algorithm (see below) failed because the + // stack pointer from the thread context was pointing + // (considerably) beyond the ostensible end of the stack, into + // garbage; walking from the topmost frame back caused a crash. + // + // This algorithm takes the current PC as a given and tries to + // find the correct corresponding SP by walking up the stack + // and repeatedly performing stackwalks (very inefficient). + // + // FIXME: there is something wrong with stackwalking across + // adapter frames...this is likely to be the root cause of the + // failure with the simpler algorithm below. + + for (long offset = 0; + offset < regionInBytesToSearch; + offset += vm.getAddressSize()) { + try { + Address curSP = sp.addOffsetTo(offset); + Frame frame = new RISCV64Frame(curSP, null, pc); + RegisterMap map = thread.newRegisterMap(false); + while (frame != null) { + if (frame.isEntryFrame() && frame.entryFrameIsFirst()) { + // We were able to traverse all the way to the + // bottommost Java frame. + // This sp looks good. Keep it. + if (DEBUG) { + System.out.println("CurrentFrameGuess: Choosing sp = " + curSP + ", pc = " + pc); + } + setValues(curSP, null, pc); + return true; + } + frame = frame.sender(map); + } + } catch (Exception e) { + if (DEBUG) { + System.out.println("CurrentFrameGuess: Exception " + e + " at offset " + offset); + } + // Bad SP. Try another. + } + } + + // Were not able to find a plausible SP to go with this PC. + // Bail out. + return false; + } + } else { + // If the current program counter was not known to us as a Java + // PC, we currently assume that we are in the run-time system + // and attempt to look to thread-local storage for saved SP and + // FP. Note that if these are null (because we were, in fact, + // in Java code, i.e., vtable stubs or similar, and the SA + // didn't have enough insight into the target VM to understand + // that) then we are going to lose the entire stack trace for + // the thread, which is sub-optimal. FIXME. + + if (DEBUG) { + System.out.println("CurrentFrameGuess: choosing last Java frame: sp = " + + thread.getLastJavaSP() + ", fp = " + thread.getLastJavaFP()); + } + if (thread.getLastJavaSP() == null) { + return false; // No known Java frames on stack + } + + // The runtime has a nasty habit of not saving fp in the frame + // anchor, leaving us to grovel about in the stack to find a + // plausible address. Fortunately, this only happens in + // compiled code; there we always have a valid PC, and we always + // push LR and FP onto the stack as a pair, with FP at the lower + // address. + pc = thread.getLastJavaPC(); + fp = thread.getLastJavaFP(); + sp = thread.getLastJavaSP(); + + if (fp == null) { + CodeCache cc = vm.getCodeCache(); + if (cc.contains(pc)) { + CodeBlob cb = cc.findBlob(pc); + if (DEBUG) { + System.out.println("FP is null. Found blob frame size " + cb.getFrameSize()); + } + // See if we can derive a frame pointer from SP and PC + long link_offset = cb.getFrameSize() - 2 * VM.getVM().getAddressSize(); + if (link_offset >= 0) { + fp = sp.addOffsetTo(link_offset); + } + } + } + + // We found a PC in the frame anchor. Check that it's plausible, and + // if it is, use it. + if (vm.isJavaPCDbg(pc)) { + setValues(sp, fp, pc); + } else { + setValues(sp, fp, null); + } + + return true; + } + } + + public Address getSP() { return spFound; } + public Address getFP() { return fpFound; } + /** May be null if getting values from thread-local storage; take + care to call the correct RISCV64Frame constructor to recover this if + necessary */ + public Address getPC() { return pcFound; } + + private void setValues(Address sp, Address fp, Address pc) { + spFound = sp; + fpFound = fp; + pcFound = pc; + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java new file mode 100644 index 0000000000000000000000000000000000000000..df280005d7240bb181a451249c10b45ae78ea6e7 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java @@ -0,0 +1,556 @@ +/* + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Red Hat Inc. + * Copyright (c) 2021, 2022, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.runtime.riscv64; + +import java.util.*; +import sun.jvm.hotspot.code.*; +import sun.jvm.hotspot.compiler.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.oops.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; +import sun.jvm.hotspot.utilities.Observable; +import sun.jvm.hotspot.utilities.Observer; + +/** Specialization of and implementation of abstract methods of the + Frame class for the riscv64 family of CPUs. */ + +public class RISCV64Frame extends Frame { + private static final boolean DEBUG; + static { + DEBUG = System.getProperty("sun.jvm.hotspot.runtime.RISCV64.RISCV64Frame.DEBUG") != null; + } + + // Java frames + private static final int LINK_OFFSET = -2; + private static final int RETURN_ADDR_OFFSET = -1; + private static final int SENDER_SP_OFFSET = 0; + + // Interpreter frames + private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -3; + private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1; + private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_LAST_SP_OFFSET - 1; + private static int INTERPRETER_FRAME_MDX_OFFSET; // Non-core builds only + private static int INTERPRETER_FRAME_PADDING_OFFSET; + private static int INTERPRETER_FRAME_MIRROR_OFFSET; + private static int INTERPRETER_FRAME_CACHE_OFFSET; + private static int INTERPRETER_FRAME_LOCALS_OFFSET; + private static int INTERPRETER_FRAME_BCX_OFFSET; + private static int INTERPRETER_FRAME_INITIAL_SP_OFFSET; + private static int INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET; + private static int INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET; + + // Entry frames + private static int ENTRY_FRAME_CALL_WRAPPER_OFFSET = -10; + + // Native frames + private static final int NATIVE_FRAME_INITIAL_PARAM_OFFSET = 2; + + private static VMReg fp = new VMReg(8); + + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static synchronized void initialize(TypeDataBase db) { + INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1; + INTERPRETER_FRAME_PADDING_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1; + INTERPRETER_FRAME_MIRROR_OFFSET = INTERPRETER_FRAME_PADDING_OFFSET - 1; + INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MIRROR_OFFSET - 1; + INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1; + INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1; + INTERPRETER_FRAME_INITIAL_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1; + INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET; + INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET; + } + + + // an additional field beyond sp and pc: + Address raw_fp; // frame pointer + private Address raw_unextendedSP; + + private RISCV64Frame() { + } + + private void adjustForDeopt() { + if ( pc != null) { + // Look for a deopt pc and if it is deopted convert to original pc + CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc); + if (cb != null && cb.isJavaMethod()) { + NMethod nm = (NMethod) cb; + if (pc.equals(nm.deoptHandlerBegin())) { + if (Assert.ASSERTS_ENABLED) { + Assert.that(this.getUnextendedSP() != null, "null SP in Java frame"); + } + // adjust pc if frame is deoptimized. + pc = this.getUnextendedSP().getAddressAt(nm.origPCOffset()); + deoptimized = true; + } + } + } + } + + public RISCV64Frame(Address raw_sp, Address raw_fp, Address pc) { + this.raw_sp = raw_sp; + this.raw_unextendedSP = raw_sp; + this.raw_fp = raw_fp; + this.pc = pc; + adjustUnextendedSP(); + + // Frame must be fully constructed before this call + adjustForDeopt(); + + if (DEBUG) { + System.out.println("RISCV64Frame(sp, fp, pc): " + this); + dumpStack(); + } + } + + public RISCV64Frame(Address raw_sp, Address raw_fp) { + this.raw_sp = raw_sp; + this.raw_unextendedSP = raw_sp; + this.raw_fp = raw_fp; + + // We cannot assume SP[-1] always contains a valid return PC (e.g. if + // the callee is a C/C++ compiled frame). If the PC is not known to + // Java then this.pc is null. + Address savedPC = raw_sp.getAddressAt(-1 * VM.getVM().getAddressSize()); + if (VM.getVM().isJavaPCDbg(savedPC)) { + this.pc = savedPC; + } + + adjustUnextendedSP(); + + // Frame must be fully constructed before this call + adjustForDeopt(); + + if (DEBUG) { + System.out.println("RISCV64Frame(sp, fp): " + this); + dumpStack(); + } + } + + public RISCV64Frame(Address raw_sp, Address raw_unextendedSp, Address raw_fp, Address pc) { + this.raw_sp = raw_sp; + this.raw_unextendedSP = raw_unextendedSp; + this.raw_fp = raw_fp; + this.pc = pc; + adjustUnextendedSP(); + + // Frame must be fully constructed before this call + adjustForDeopt(); + + if (DEBUG) { + System.out.println("RISCV64Frame(sp, unextendedSP, fp, pc): " + this); + dumpStack(); + } + + } + + public Object clone() { + RISCV64Frame frame = new RISCV64Frame(); + frame.raw_sp = raw_sp; + frame.raw_unextendedSP = raw_unextendedSP; + frame.raw_fp = raw_fp; + frame.pc = pc; + frame.deoptimized = deoptimized; + return frame; + } + + public boolean equals(Object arg) { + if (arg == null) { + return false; + } + + if (!(arg instanceof RISCV64Frame)) { + return false; + } + + RISCV64Frame other = (RISCV64Frame) arg; + + return (AddressOps.equal(getSP(), other.getSP()) && + AddressOps.equal(getUnextendedSP(), other.getUnextendedSP()) && + AddressOps.equal(getFP(), other.getFP()) && + AddressOps.equal(getPC(), other.getPC())); + } + + public int hashCode() { + if (raw_sp == null) { + return 0; + } + + return raw_sp.hashCode(); + } + + public String toString() { + return "sp: " + (getSP() == null? "null" : getSP().toString()) + + ", unextendedSP: " + (getUnextendedSP() == null? "null" : getUnextendedSP().toString()) + + ", fp: " + (getFP() == null? "null" : getFP().toString()) + + ", pc: " + (pc == null? "null" : pc.toString()); + } + + // accessors for the instance variables + public Address getFP() { return raw_fp; } + public Address getSP() { return raw_sp; } + public Address getID() { return raw_sp; } + + // FIXME: not implemented yet + public boolean isSignalHandlerFrameDbg() { return false; } + public int getSignalNumberDbg() { return 0; } + public String getSignalNameDbg() { return null; } + + public boolean isInterpretedFrameValid() { + if (Assert.ASSERTS_ENABLED) { + Assert.that(isInterpretedFrame(), "Not an interpreted frame"); + } + + // These are reasonable sanity checks + if (getFP() == null || getFP().andWithMask(0x3) != null) { + return false; + } + + if (getSP() == null || getSP().andWithMask(0x3) != null) { + return false; + } + + if (getFP().addOffsetTo(INTERPRETER_FRAME_INITIAL_SP_OFFSET * VM.getVM().getAddressSize()).lessThan(getSP())) { + return false; + } + + // These are hacks to keep us out of trouble. + // The problem with these is that they mask other problems + if (getFP().lessThanOrEqual(getSP())) { + // this attempts to deal with unsigned comparison above + return false; + } + + if (getFP().minus(getSP()) > 4096 * VM.getVM().getAddressSize()) { + // stack frames shouldn't be large. + return false; + } + + return true; + } + + public Frame sender(RegisterMap regMap, CodeBlob cb) { + RISCV64RegisterMap map = (RISCV64RegisterMap) regMap; + + if (Assert.ASSERTS_ENABLED) { + Assert.that(map != null, "map must be set"); + } + + // Default is we done have to follow them. The sender_for_xxx will + // update it accordingly + map.setIncludeArgumentOops(false); + + if (isEntryFrame()) return senderForEntryFrame(map); + if (isInterpretedFrame()) return senderForInterpreterFrame(map); + + if(cb == null) { + cb = VM.getVM().getCodeCache().findBlob(getPC()); + } else { + if (Assert.ASSERTS_ENABLED) { + Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same"); + } + } + + if (cb != null) { + return senderForCompiledFrame(map, cb); + } + + // Must be native-compiled frame, i.e. the marshaling code for native + // methods that exists in the core system. + return new RISCV64Frame(getSenderSP(), getLink(), getSenderPC()); + } + + private Frame senderForEntryFrame(RISCV64RegisterMap map) { + if (DEBUG) { + System.out.println("senderForEntryFrame"); + } + if (Assert.ASSERTS_ENABLED) { + Assert.that(map != null, "map must be set"); + } + // Java frame called from C; skip all C frames and return top C + // frame of that chunk as the sender + RISCV64JavaCallWrapper jcw = (RISCV64JavaCallWrapper) getEntryFrameCallWrapper(); + if (Assert.ASSERTS_ENABLED) { + Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero"); + Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack"); + } + RISCV64Frame fr; + if (jcw.getLastJavaPC() != null) { + fr = new RISCV64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC()); + } else { + fr = new RISCV64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP()); + } + map.clear(); + if (Assert.ASSERTS_ENABLED) { + Assert.that(map.getIncludeArgumentOops(), "should be set by clear"); + } + return fr; + } + + //------------------------------------------------------------------------------ + // frame::adjust_unextended_sp + private void adjustUnextendedSP() { + // If we are returning to a compiled MethodHandle call site, the + // saved_fp will in fact be a saved value of the unextended SP. The + // simplest way to tell whether we are returning to such a call site + // is as follows: + + CodeBlob cb = cb(); + NMethod senderNm = (cb == null) ? null : cb.asNMethodOrNull(); + if (senderNm != null) { + // If the sender PC is a deoptimization point, get the original + // PC. For MethodHandle call site the unextended_sp is stored in + // saved_fp. + if (senderNm.isDeoptMhEntry(getPC())) { + raw_unextendedSP = getFP(); + } + else if (senderNm.isDeoptEntry(getPC())) { + } + else if (senderNm.isMethodHandleReturn(getPC())) { + raw_unextendedSP = getFP(); + } + } + } + + private Frame senderForInterpreterFrame(RISCV64RegisterMap map) { + if (DEBUG) { + System.out.println("senderForInterpreterFrame"); + } + Address unextendedSP = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0); + Address sp = addressOfStackSlot(SENDER_SP_OFFSET); + // We do not need to update the callee-save register mapping because above + // us is either another interpreter frame or a converter-frame, but never + // directly a compiled frame. + // 11/24/04 SFG. With the removal of adapter frames this is no longer true. + // However c2 no longer uses callee save register for java calls so there + // are no callee register to find. + + if (map.getUpdateMap()) + updateMapWithSavedLink(map, addressOfStackSlot(LINK_OFFSET)); + + return new RISCV64Frame(sp, unextendedSP, getLink(), getSenderPC()); + } + + private void updateMapWithSavedLink(RegisterMap map, Address savedFPAddr) { + map.setLocation(fp, savedFPAddr); + } + + private Frame senderForCompiledFrame(RISCV64RegisterMap map, CodeBlob cb) { + if (DEBUG) { + System.out.println("senderForCompiledFrame"); + } + + // + // NOTE: some of this code is (unfortunately) duplicated RISCV64CurrentFrameGuess + // + + if (Assert.ASSERTS_ENABLED) { + Assert.that(map != null, "map must be set"); + } + + // frame owned by optimizing compiler + if (Assert.ASSERTS_ENABLED) { + Assert.that(cb.getFrameSize() >= 0, "must have non-zero frame size"); + } + Address senderSP = getUnextendedSP().addOffsetTo(cb.getFrameSize()); + + // The return_address is always the word on the stack + Address senderPC = senderSP.getAddressAt(-1 * VM.getVM().getAddressSize()); + + // This is the saved value of FP which may or may not really be an FP. + // It is only an FP if the sender is an interpreter frame. + Address savedFPAddr = senderSP.addOffsetTo(-2 * VM.getVM().getAddressSize()); + + if (map.getUpdateMap()) { + // Tell GC to use argument oopmaps for some runtime stubs that need it. + // For C1, the runtime stub might not have oop maps, so set this flag + // outside of update_register_map. + map.setIncludeArgumentOops(cb.callerMustGCArguments()); + + if (cb.getOopMaps() != null) { + ImmutableOopMapSet.updateRegisterMap(this, cb, map, true); + } + + // Since the prolog does the save and restore of FP there is no oopmap + // for it so we must fill in its location as if there was an oopmap entry + // since if our caller was compiled code there could be live jvm state in it. + updateMapWithSavedLink(map, savedFPAddr); + } + + return new RISCV64Frame(senderSP, savedFPAddr.getAddressAt(0), senderPC); + } + + protected boolean hasSenderPD() { + return true; + } + + public long frameSize() { + return (getSenderSP().minus(getSP()) / VM.getVM().getAddressSize()); + } + + public Address getLink() { + try { + if (DEBUG) { + System.out.println("Reading link at " + addressOfStackSlot(LINK_OFFSET) + + " = " + addressOfStackSlot(LINK_OFFSET).getAddressAt(0)); + } + return addressOfStackSlot(LINK_OFFSET).getAddressAt(0); + } catch (Exception e) { + if (DEBUG) + System.out.println("Returning null"); + return null; + } + } + + public Address getUnextendedSP() { return raw_unextendedSP; } + + // Return address: + public Address getSenderPCAddr() { return addressOfStackSlot(RETURN_ADDR_OFFSET); } + public Address getSenderPC() { return getSenderPCAddr().getAddressAt(0); } + + // return address of param, zero origin index. + public Address getNativeParamAddr(int idx) { + return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx); + } + + public Address getSenderSP() { return addressOfStackSlot(SENDER_SP_OFFSET); } + + public Address addressOfInterpreterFrameLocals() { + return addressOfStackSlot(INTERPRETER_FRAME_LOCALS_OFFSET); + } + + private Address addressOfInterpreterFrameBCX() { + return addressOfStackSlot(INTERPRETER_FRAME_BCX_OFFSET); + } + + public int getInterpreterFrameBCI() { + // FIXME: this is not atomic with respect to GC and is unsuitable + // for use in a non-debugging, or reflective, system. Need to + // figure out how to express this. + Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0); + Address methodHandle = addressOfInterpreterFrameMethod().getAddressAt(0); + Method method = (Method)Metadata.instantiateWrapperFor(methodHandle); + return bcpToBci(bcp, method); + } + + public Address addressOfInterpreterFrameMDX() { + return addressOfStackSlot(INTERPRETER_FRAME_MDX_OFFSET); + } + + // expression stack + // (the max_stack arguments are used by the GC; see class FrameClosure) + + public Address addressOfInterpreterFrameExpressionStack() { + Address monitorEnd = interpreterFrameMonitorEnd().address(); + return monitorEnd.addOffsetTo(-1 * VM.getVM().getAddressSize()); + } + + public int getInterpreterFrameExpressionStackDirection() { return -1; } + + // top of expression stack + public Address addressOfInterpreterFrameTOS() { + return getSP(); + } + + /** Expression stack from top down */ + public Address addressOfInterpreterFrameTOSAt(int slot) { + return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize()); + } + + public Address getInterpreterFrameSenderSP() { + if (Assert.ASSERTS_ENABLED) { + Assert.that(isInterpretedFrame(), "interpreted frame expected"); + } + return addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0); + } + + // Monitors + public BasicObjectLock interpreterFrameMonitorBegin() { + return new BasicObjectLock(addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET)); + } + + public BasicObjectLock interpreterFrameMonitorEnd() { + Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0); + if (Assert.ASSERTS_ENABLED) { + // make sure the pointer points inside the frame + Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer"); + Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer"); + } + return new BasicObjectLock(result); + } + + public int interpreterFrameMonitorSize() { + return BasicObjectLock.size(); + } + + // Method + public Address addressOfInterpreterFrameMethod() { + return addressOfStackSlot(INTERPRETER_FRAME_METHOD_OFFSET); + } + + // Constant pool cache + public Address addressOfInterpreterFrameCPCache() { + return addressOfStackSlot(INTERPRETER_FRAME_CACHE_OFFSET); + } + + // Entry frames + public JavaCallWrapper getEntryFrameCallWrapper() { + return new RISCV64JavaCallWrapper(addressOfStackSlot(ENTRY_FRAME_CALL_WRAPPER_OFFSET).getAddressAt(0)); + } + + protected Address addressOfSavedOopResult() { + // offset is 2 for compiler2 and 3 for compiler1 + return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) * + VM.getVM().getAddressSize()); + } + + protected Address addressOfSavedReceiver() { + return getSP().addOffsetTo(-4 * VM.getVM().getAddressSize()); + } + + private void dumpStack() { + for (Address addr = getSP().addOffsetTo(-4 * VM.getVM().getAddressSize()); + AddressOps.lt(addr, getSP()); + addr = addr.addOffsetTo(VM.getVM().getAddressSize())) { + System.out.println(addr + ": " + addr.getAddressAt(0)); + } + System.out.println("-----------------------"); + for (Address addr = getSP(); + AddressOps.lte(addr, getSP().addOffsetTo(20 * VM.getVM().getAddressSize())); + addr = addr.addOffsetTo(VM.getVM().getAddressSize())) { + System.out.println(addr + ": " + addr.getAddressAt(0)); + } + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64JavaCallWrapper.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64JavaCallWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d0ad2b559a63c1711687d8de80002cb3b8c5d91f --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64JavaCallWrapper.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.runtime.riscv64; + +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.utilities.*; +import sun.jvm.hotspot.utilities.Observable; +import sun.jvm.hotspot.utilities.Observer; + +public class RISCV64JavaCallWrapper extends JavaCallWrapper { + private static AddressField lastJavaFPField; + + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static synchronized void initialize(TypeDataBase db) { + Type type = db.lookupType("JavaFrameAnchor"); + + lastJavaFPField = type.getAddressField("_last_Java_fp"); + } + + public RISCV64JavaCallWrapper(Address addr) { + super(addr); + } + + public Address getLastJavaFP() { + return lastJavaFPField.getValue(addr.addOffsetTo(anchorField.getOffset())); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64RegisterMap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64RegisterMap.java new file mode 100644 index 0000000000000000000000000000000000000000..4aeb1c6f557c48f017cb4e61bb4ee635ba14c168 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64RegisterMap.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. + * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 sun.jvm.hotspot.runtime.riscv64; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; + +public class RISCV64RegisterMap extends RegisterMap { + + /** This is the only public constructor */ + public RISCV64RegisterMap(JavaThread thread, boolean updateMap) { + super(thread, updateMap); + } + + protected RISCV64RegisterMap(RegisterMap map) { + super(map); + } + + public Object clone() { + RISCV64RegisterMap retval = new RISCV64RegisterMap(this); + return retval; + } + + // no PD state to clear or copy: + protected void clearPD() {} + protected void initializePD() {} + protected void initializeFromPD(RegisterMap map) {} + protected Address getLocationPD(VMReg reg) { return null; } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java index 3e66e24700b94e3a85cf8b2480e3d06c55cfe4a2..f4cd4873207a4bbbdf3aa01139fafe8fb6238fbe 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ public class PlatformInfo { public static boolean knownCPU(String cpu) { final String[] KNOWN = - new String[] {"i386", "x86", "x86_64", "amd64", "ppc64", "ppc64le", "aarch64"}; + new String[] {"i386", "x86", "x86_64", "amd64", "ppc64", "ppc64le", "aarch64", "riscv64"}; for(String s : KNOWN) { if(s.equals(cpu)) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java index cd9e8264f28b5c23994fa3a4a9ecaee01fe7355f..f0e7b0997e9f1088cbffe7d140b76f60624e729f 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java @@ -87,6 +87,7 @@ public class PointerFinder { if (heap instanceof GenCollectedHeap) { GenCollectedHeap genheap = (GenCollectedHeap) heap; if (genheap.isIn(a)) { + loc.heap = heap; for (int i = 0; i < genheap.nGens(); i++) { Generation g = genheap.getGen(i); if (g.isIn(a)) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java index a7cfa5de983cc74d5fe855a233f8a4de9fab41f6..d474469c56261c34bcc5398689c5c5b70bd26cca 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java @@ -107,22 +107,21 @@ public class PointerLocation { } public boolean isInHeap() { - return (heap != null || (gen != null)); + return (heap != null); } public boolean isInNewGen() { - return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(0))); + return ((gen != null) && (gen.equals(((GenCollectedHeap)heap).getGen(0)))); } public boolean isInOldGen() { - return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(1))); + return ((gen != null) && (gen.equals(((GenCollectedHeap)heap).getGen(1)))); } public boolean inOtherGen() { return (!isInNewGen() && !isInOldGen()); } - /** Only valid if isInHeap() */ public Generation getGeneration() { return gen; } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java index c21fde386b9e9d1a34607a6bfa8b076c40c94340..e878f938c392a02fe13f15c9f311da2c93855aab 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java @@ -573,9 +573,6 @@ public abstract class ByteVector extends AbstractVector { } if (op == NOT) { return broadcast(-1).lanewise(XOR, this); - } else if (op == NEG) { - // FIXME: Support this in the JIT. - return broadcast(0).lanewise(SUB, this); } } int opc = opCode(op); @@ -604,8 +601,6 @@ public abstract class ByteVector extends AbstractVector { } if (op == NOT) { return lanewise(XOR, broadcast(-1), m); - } else if (op == NEG) { - return lanewise(NOT, m).lanewise(ADD, broadcast(1), m); } } int opc = opCode(op); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java index e5033ac5366a4af671a38665784406a8de34530e..c1d2f41857448992faec1fd2b377241dcf2aa384 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java @@ -573,9 +573,6 @@ public abstract class IntVector extends AbstractVector { } if (op == NOT) { return broadcast(-1).lanewise(XOR, this); - } else if (op == NEG) { - // FIXME: Support this in the JIT. - return broadcast(0).lanewise(SUB, this); } } int opc = opCode(op); @@ -604,8 +601,6 @@ public abstract class IntVector extends AbstractVector { } if (op == NOT) { return lanewise(XOR, broadcast(-1), m); - } else if (op == NEG) { - return lanewise(NOT, m).lanewise(ADD, broadcast(1), m); } } int opc = opCode(op); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java index 37ba71896791229a1a3189ae2cdb902f649b20d4..60821caa6bd950ad682526abe289058756e8fa0d 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java @@ -531,9 +531,6 @@ public abstract class LongVector extends AbstractVector { } if (op == NOT) { return broadcast(-1).lanewise(XOR, this); - } else if (op == NEG) { - // FIXME: Support this in the JIT. - return broadcast(0).lanewise(SUB, this); } } int opc = opCode(op); @@ -562,8 +559,6 @@ public abstract class LongVector extends AbstractVector { } if (op == NOT) { return lanewise(XOR, broadcast(-1), m); - } else if (op == NEG) { - return lanewise(NOT, m).lanewise(ADD, broadcast(1), m); } } int opc = opCode(op); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java index 8c6dd4718f75a5d022d9d01c83f1a62bfd37b0f0..7558fc6c56a11defbe75a0de6d79f3803ab78e81 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java @@ -573,9 +573,6 @@ public abstract class ShortVector extends AbstractVector { } if (op == NOT) { return broadcast(-1).lanewise(XOR, this); - } else if (op == NEG) { - // FIXME: Support this in the JIT. - return broadcast(0).lanewise(SUB, this); } } int opc = opCode(op); @@ -604,8 +601,6 @@ public abstract class ShortVector extends AbstractVector { } if (op == NOT) { return lanewise(XOR, broadcast(-1), m); - } else if (op == NEG) { - return lanewise(NOT, m).lanewise(ADD, broadcast(1), m); } } int opc = opCode(op); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index 6c5ed6b9c13fd6b66c7001c10544e235a89dee43..464cb2853df754a56b72c7b2e8aeee0fe977e99e 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -596,9 +596,6 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { #if[BITWISE] if (op == NOT) { return broadcast(-1).lanewise(XOR, this); - } else if (op == NEG) { - // FIXME: Support this in the JIT. - return broadcast(0).lanewise(SUB, this); } #end[BITWISE] } @@ -629,8 +626,6 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { #if[BITWISE] if (op == NOT) { return lanewise(XOR, broadcast(-1), m); - } else if (op == NEG) { - return lanewise(NOT, m).lanewise(ADD, broadcast(1), m); } #end[BITWISE] } diff --git a/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java b/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java index 08fad553cc9b3defe22121ee957bbda9489c717c..74c687912fe17cc9a09e16017d0a987d10651c0a 100644 --- a/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java +++ b/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -417,29 +417,30 @@ public final class JarSigner { /** * Gets the default digest algorithm. * - * @implNote This implementation returns "SHA-256". The value may + * @implNote This implementation returns "SHA-384". The value may * change in the future. * * @return the default digest algorithm. */ public static String getDefaultDigestAlgorithm() { - return "SHA-256"; + return "SHA-384"; } /** * Gets the default signature algorithm for a private key. - * For example, SHA256withRSA for a 2048-bit RSA key, and + * For example, SHA384withRSA for a 2048-bit RSA key, and * SHA384withECDSA for a 384-bit EC key. * * @implNote This implementation makes use of comparable strengths - * as defined in Tables 2 and 3 of NIST SP 800-57 Part 1-Rev.4. - * Specifically, if a DSA or RSA key with a key size greater than 7680 + * as defined in Tables 2 and 3 of NIST SP 800-57 Part 1-Rev.5 as + * well as NIST recommendations as appropriate. + * Specifically, if an RSA key with a key size greater than 7680 * bits, or an EC key with a key size greater than or equal to 512 bits, * SHA-512 will be used as the hash function for the signature. - * If a DSA or RSA key has a key size greater than 3072 bits, or an - * EC key has a key size greater than or equal to 384 bits, SHA-384 will - * be used. Otherwise, SHA-256 will be used. The value may - * change in the future. + * Otherwise, SHA-384 will be used unless the key size is too small + * for resulting signature algorithm. As for DSA keys, the SHA256withDSA + * signature algorithm is returned regardless of key size. + * The value may change in the future. * * @param key the private key. * @return the default signature algorithm. Returns null if a default diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java index 750b125f10d8ba6101a09d03e6232d6bef36b2b2..1b9e23f0fde8eace75184933e53e9449e96ca82e 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java @@ -30,6 +30,7 @@ import java.net.UnknownHostException; import java.net.URLClassLoader; import java.security.cert.CertPathValidatorException; import java.security.cert.PKIXBuilderParameters; +import java.security.interfaces.ECKey; import java.util.*; import java.util.stream.Collectors; import java.util.zip.*; @@ -1244,13 +1245,13 @@ public class Main { if ((legacyAlg & 8) == 8) { warnings.add(String.format( rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."), - privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey))); + KeyUtil.fullDisplayAlgName(privateKey), KeyUtil.getKeySize(privateKey))); } if ((disabledAlg & 8) == 8) { errors.add(String.format( rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk.and.is.disabled."), - privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey))); + KeyUtil.fullDisplayAlgName(privateKey), KeyUtil.getKeySize(privateKey))); } } else { if ((legacyAlg & 1) != 0) { @@ -1274,7 +1275,7 @@ public class Main { if ((legacyAlg & 8) == 8) { warnings.add(String.format( rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."), - weakPublicKey.getAlgorithm(), KeyUtil.getKeySize(weakPublicKey))); + KeyUtil.fullDisplayAlgName(weakPublicKey), KeyUtil.getKeySize(weakPublicKey))); } } @@ -1451,7 +1452,12 @@ public class Main { JAR_DISABLED_CHECK.permits(key.getAlgorithm(), jcp, true); } catch (CertPathValidatorException e) { disabledAlgFound = true; - return String.format(rb.getString("key.bit.disabled"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.disabled"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.disabled"), kLen); + } } try { LEGACY_CHECK.permits(key.getAlgorithm(), jcp, true); @@ -1463,7 +1469,12 @@ public class Main { } catch (CertPathValidatorException e) { weakPublicKey = key; legacyAlg |= 8; - return String.format(rb.getString("key.bit.weak"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.weak"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.weak"), kLen); + } } } @@ -1516,7 +1527,12 @@ public class Main { try { CERTPATH_DISABLED_CHECK.permits(key.getAlgorithm(), cpcp, true); } catch (CertPathValidatorException e) { - return String.format(rb.getString("key.bit.disabled"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.disabled"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.disabled"), kLen); + } } try { LEGACY_CHECK.permits(key.getAlgorithm(), cpcp, true); @@ -1526,7 +1542,12 @@ public class Main { return rb.getString("unknown.size"); } } catch (CertPathValidatorException e) { - return String.format(rb.getString("key.bit.weak"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.weak"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.weak"), kLen); + } } } diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java index f5a1bb2e3cba6bad22b5f9156392e2170fa44a53..37a1f24f90d018b452ad5482ceee51e4ff389781 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java @@ -181,7 +181,9 @@ public class Resources extends java.util.ListResourceBundle { {"with.algparams.disabled", "%1$s using %2$s (disabled)"}, {"key.bit", "%d-bit key"}, {"key.bit.weak", "%d-bit key (weak)"}, + {"key.bit.eccurve.weak", "%1$d-bit %2$s key (weak)"}, {"key.bit.disabled", "%d-bit key (disabled)"}, + {"key.bit.eccurve.disabled", "%1$d-bit %2$s key (disabled)"}, {"unknown.size", "unknown size"}, {"extra.attributes.detected", "POSIX file permission and/or symlink attributes detected. These attributes are ignored when signing and are not protected by the signature."}, diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java index b33c39005447de519c637160a8e0dc87d7761039..e8fb77654d16521783e76c54e4b6368ab62aa26f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java @@ -313,7 +313,7 @@ public class HtmlDoclet extends AbstractDoclet { private void copyJqueryFiles() throws DocletException { List files = Arrays.asList( - "jquery-3.5.1.min.js", + "jquery-3.6.0.min.js", "jquery-ui.min.js", "jquery-ui.min.css", "jquery-ui.structure.min.css", diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.5.1.min.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.5.1.min.js deleted file mode 100644 index b0614034ad3a95e4ae9f53c2b015eeb3e8d68bde..0000000000000000000000000000000000000000 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.5.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
    ",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; + // Support: Chrome <=57, Firefox <=52 + // In some browsers, typeof returns "function" for HTML elements + // (i.e., `typeof document.createElement( "object" ) === "function"`). + // We don't want to classify *any* DOM node as a function. + // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 + // Plus for old WebKit, typeof returns "function" for HTML collections + // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) + return typeof obj === "function" && typeof obj.nodeType !== "number" && + typeof obj.item !== "function"; + }; var isWindow = function isWindow( obj ) { @@ -147,7 +151,7 @@ function toType( obj ) { var - version = "3.5.1", + version = "3.6.0", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -401,7 +405,7 @@ jQuery.extend( { if ( isArrayLike( Object( arr ) ) ) { jQuery.merge( ret, typeof arr === "string" ? - [ arr ] : arr + [ arr ] : arr ); } else { push.call( ret, arr ); @@ -496,9 +500,9 @@ if ( typeof Symbol === "function" ) { // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); function isArrayLike( obj ) { @@ -518,14 +522,14 @@ function isArrayLike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v2.3.5 + * Sizzle CSS Selector Engine v2.3.6 * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://js.foundation/ * - * Date: 2020-03-14 + * Date: 2021-02-16 */ ( function( window ) { var i, @@ -1108,8 +1112,8 @@ support = Sizzle.support = {}; * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { - var namespace = elem.namespaceURI, - docElem = ( elem.ownerDocument || elem ).documentElement; + var namespace = elem && elem.namespaceURI, + docElem = elem && ( elem.ownerDocument || elem ).documentElement; // Support: IE <=8 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes @@ -3024,9 +3028,9 @@ var rneedsContext = jQuery.expr.match.needsContext; function nodeName( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); -}; +} var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); @@ -3997,8 +4001,8 @@ jQuery.extend( { resolveContexts = Array( i ), resolveValues = slice.call( arguments ), - // the master Deferred - master = jQuery.Deferred(), + // the primary Deferred + primary = jQuery.Deferred(), // subordinate callback factory updateFunc = function( i ) { @@ -4006,30 +4010,30 @@ jQuery.extend( { resolveContexts[ i ] = this; resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); + primary.resolveWith( resolveContexts, resolveValues ); } }; }; // Single- and empty arguments are adopted like Promise.resolve if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, + adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, !remaining ); // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || + if ( primary.state() === "pending" || isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - return master.then(); + return primary.then(); } } // Multiple arguments are aggregated like Promise.all array elements while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); } - return master.promise(); + return primary.promise(); } } ); @@ -4180,8 +4184,8 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { for ( ; i < len; i++ ) { fn( elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) ); } } @@ -5089,10 +5093,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { } -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; +var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; @@ -5387,8 +5388,8 @@ jQuery.event = { event = jQuery.event.fix( nativeEvent ), handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], + dataPriv.get( this, "events" ) || Object.create( null ) + )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event @@ -5512,12 +5513,12 @@ jQuery.event = { get: isFunction( hook ) ? function() { if ( this.originalEvent ) { - return hook( this.originalEvent ); + return hook( this.originalEvent ); } } : function() { if ( this.originalEvent ) { - return this.originalEvent[ name ]; + return this.originalEvent[ name ]; } }, @@ -5656,7 +5657,13 @@ function leverageNative( el, type, expectSync ) { // Cancel the outer synthetic event event.stopImmediatePropagation(); event.preventDefault(); - return result.value; + + // Support: Chrome 86+ + // In Chrome, if an element having a focusout handler is blurred by + // clicking outside of it, it invokes the handler synchronously. If + // that handler calls `.remove()` on the element, the data is cleared, + // leaving `result` undefined. We need to guard against this. + return result && result.value; } // If this is an inner synthetic event for an event with a bubbling surrogate @@ -5821,34 +5828,7 @@ jQuery.each( { targetTouches: true, toElement: true, touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } + which: true }, jQuery.event.addProp ); jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { @@ -5874,6 +5854,12 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp return true; }, + // Suppress native focus or blur as it's already being fired + // in leverageNative. + _default: function() { + return true; + }, + delegateType: delegateType }; } ); @@ -6541,6 +6527,10 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); // set in CSS while `offset*` properties report correct values. // Behavior in IE 9 is more subtle than in newer versions & it passes // some versions of this test; make sure not to make it pass there! + // + // Support: Firefox 70+ + // Only Firefox includes border widths + // in computed dimensions. (gh-4529) reliableTrDimensions: function() { var table, tr, trChild, trStyle; if ( reliableTrDimensionsVal == null ) { @@ -6548,17 +6538,32 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); tr = document.createElement( "tr" ); trChild = document.createElement( "div" ); - table.style.cssText = "position:absolute;left:-11111px"; + table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; + tr.style.cssText = "border:1px solid"; + + // Support: Chrome 86+ + // Height set through cssText does not get applied. + // Computed height then comes back as 0. tr.style.height = "1px"; trChild.style.height = "9px"; + // Support: Android 8 Chrome 86+ + // In our bodyBackground.html iframe, + // display for all div elements is set to "inline", + // which causes a problem only in Android 8 Chrome 86. + // Ensuring the div is display: block + // gets around this issue. + trChild.style.display = "block"; + documentElement .appendChild( table ) .appendChild( tr ) .appendChild( trChild ); trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; + reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + + parseInt( trStyle.borderTopWidth, 10 ) + + parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; documentElement.removeChild( table ); } @@ -7022,10 +7027,10 @@ jQuery.each( [ "height", "width" ], function( _i, dimension ) { // Running getBoundingClientRect on a disconnected node // in IE throws an error. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, dimension, extra ); + } ) : + getWidthOrHeight( elem, dimension, extra ); } }, @@ -7084,7 +7089,7 @@ jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, swap( elem, { marginLeft: 0 }, function() { return elem.getBoundingClientRect().left; } ) - ) + "px"; + ) + "px"; } } ); @@ -7223,7 +7228,7 @@ Tween.propHooks = { if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || + jQuery.cssHooks[ tween.prop ] || tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { @@ -7468,7 +7473,7 @@ function defaultPrefilter( elem, props, opts ) { anim.done( function() { - /* eslint-enable no-loop-func */ + /* eslint-enable no-loop-func */ // The final step of a "hide" animation is actually hiding the element if ( !hidden ) { @@ -7588,7 +7593,7 @@ function Animation( elem, properties, options ) { tweens: [], createTween: function( prop, end ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, @@ -7761,7 +7766,8 @@ jQuery.fn.extend( { anim.stop( true ); } }; - doAnimation.finish = doAnimation; + + doAnimation.finish = doAnimation; return empty || optall.queue === false ? this.each( doAnimation ) : @@ -8401,8 +8407,8 @@ jQuery.fn.extend( { if ( this.setAttribute ) { this.setAttribute( "class", className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" + "" : + dataPriv.get( this, "__className__" ) || "" ); } } @@ -8417,7 +8423,7 @@ jQuery.fn.extend( { while ( ( elem = this[ i++ ] ) ) { if ( elem.nodeType === 1 && ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; + return true; } } @@ -8707,9 +8713,7 @@ jQuery.extend( jQuery.event, { special.bindType || type; // jQuery handler - handle = ( - dataPriv.get( cur, "events" ) || Object.create( null ) - )[ event.type ] && + handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && dataPriv.get( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); @@ -8856,7 +8860,7 @@ var rquery = ( /\?/ ); // Cross-browser xml parsing jQuery.parseXML = function( data ) { - var xml; + var xml, parserErrorElem; if ( !data || typeof data !== "string" ) { return null; } @@ -8865,12 +8869,17 @@ jQuery.parseXML = function( data ) { // IE throws on parseFromString with invalid input. try { xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } + } catch ( e ) {} - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); + parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; + if ( !xml || parserErrorElem ) { + jQuery.error( "Invalid XML: " + ( + parserErrorElem ? + jQuery.map( parserErrorElem.childNodes, function( el ) { + return el.textContent; + } ).join( "\n" ) : + data + ) ); } return xml; }; @@ -8971,16 +8980,14 @@ jQuery.fn.extend( { // Can add propHook for "elements" to filter or add form elements var elements = jQuery.prop( this, "elements" ); return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { + } ).filter( function() { var type = this.type; // Use .is( ":disabled" ) so that fieldset[disabled] works return this.name && !jQuery( this ).is( ":disabled" ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( _i, elem ) { + } ).map( function( _i, elem ) { var val = jQuery( this ).val(); if ( val == null ) { @@ -9033,7 +9040,8 @@ var // Anchor tag for parsing the document origin originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; + +originAnchor.href = location.href; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { @@ -9414,8 +9422,8 @@ jQuery.extend( { // Context for global events is callbackContext if it is a DOM node or jQuery collection globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, + jQuery( callbackContext ) : + jQuery.event, // Deferreds deferred = jQuery.Deferred(), @@ -9727,8 +9735,10 @@ jQuery.extend( { response = ajaxHandleResponses( s, jqXHR, responses ); } - // Use a noop converter for missing script - if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { + // Use a noop converter for missing script but not if jsonp + if ( !isSuccess && + jQuery.inArray( "script", s.dataTypes ) > -1 && + jQuery.inArray( "json", s.dataTypes ) < 0 ) { s.converters[ "text script" ] = function() {}; } @@ -10466,12 +10476,6 @@ jQuery.offset = { options.using.call( elem, props ); } else { - if ( typeof props.top === "number" ) { - props.top += "px"; - } - if ( typeof props.left === "number" ) { - props.left += "px"; - } curElem.css( props ); } } @@ -10640,8 +10644,11 @@ jQuery.each( [ "top", "left" ], function( _i, prop ) { // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { - jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, - function( defaultExtra, funcName ) { + jQuery.each( { + padding: "inner" + name, + content: type, + "": "outer" + name + }, function( defaultExtra, funcName ) { // Margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { @@ -10726,7 +10733,8 @@ jQuery.fn.extend( { } } ); -jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + +jQuery.each( + ( "blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu" ).split( " " ), function( _i, name ) { @@ -10737,7 +10745,8 @@ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + this.on( name, null, data, fn ) : this.trigger( name ); }; - } ); + } +); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.0.min.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.0.min.js new file mode 100644 index 0000000000000000000000000000000000000000..c4c6022f2982e8dae64cebd6b9a2b59f2547faad --- /dev/null +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.0.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
    ",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 * All positional values are relative to file start, not the chunk. */ -public final class CheckPointEvent { +public final class CheckpointEvent { private final ChunkWriter chunkWriter; - private final LinkedHashMap pools = new LinkedHashMap<>(); + private final LinkedHashMap pools = new LinkedHashMap<>(); private final long startPosition; - public CheckPointEvent(ChunkWriter chunkWriter, long startPosition) { + public CheckpointEvent(ChunkWriter chunkWriter, long startPosition) { this.chunkWriter = chunkWriter; this.startPosition = startPosition; } @@ -48,7 +48,7 @@ public final class CheckPointEvent { public PoolEntry addEntry(Type type, long id, long startPosition, long endPosition, Object references) { long typeId = type.getId(); PoolEntry pe = new PoolEntry(startPosition, endPosition, type, id, references); - var cpp = pools.computeIfAbsent(typeId, k -> new CheckPointPool(typeId)); + var cpp = pools.computeIfAbsent(typeId, k -> new CheckpointPool(typeId)); cpp.add(pe); chunkWriter.getPool(type).add(id, pe); return pe; @@ -56,7 +56,7 @@ public final class CheckPointEvent { public long touchedPools() { int count = 0; - for (CheckPointPool cpp : pools.values()) { + for (CheckpointPool cpp : pools.values()) { if (cpp.isTouched()) { count++; } @@ -64,7 +64,7 @@ public final class CheckPointEvent { return count; } - public Collection getPools() { + public Collection getPools() { return pools.values(); } @@ -74,7 +74,7 @@ public final class CheckPointEvent { public String toString() { StringBuilder sb = new StringBuilder(); - for (CheckPointPool p : pools.values()) { + for (CheckpointPool p : pools.values()) { for (var e : p.getEntries()) { if (e.isTouched()) { sb.append(e.getType().getName() + " " + e.getId() + "\n"); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckpointPool.java similarity index 96% rename from src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java rename to src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckpointPool.java index 3b0ca0f58eb47377dbee3b296d030db4d99b28ee..d4b1ce926be94d6f5636009488a242a33279b91a 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckpointPool.java @@ -29,11 +29,11 @@ import java.util.List; /** * Represents a constant pool in a checkpoint, both entries and type id */ -final class CheckPointPool { +final class CheckpointPool { private final List entries = new ArrayList<>(); private final long typeId; - public CheckPointPool(long typeId) { + public CheckpointPool(long typeId) { this.typeId = typeId; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java index 1a1cc2363590c9c94c936ce657c1e4f1aa09c52d..8c22432512a1ad5a9c4daffce01e9fbec077e331 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java @@ -51,7 +51,7 @@ import jdk.jfr.internal.consumer.Reference; */ public final class ChunkWriter implements Closeable { private LongMap pools = new LongMap<>(); - private final Deque checkPoints = new ArrayDeque<>(); + private final Deque checkpoints = new ArrayDeque<>(); private final Path destination; private final RecordingInput input; private final RecordingOutput output; @@ -59,7 +59,7 @@ public final class ChunkWriter implements Closeable { private long chunkStartPosition; private boolean chunkComplete; - private long lastCheckPoint; + private long lastCheckpoint; public ChunkWriter(Path source, Path destination, Predicate filter) throws IOException { this.destination = destination; @@ -78,9 +78,9 @@ public final class ChunkWriter implements Closeable { return pool; } - public CheckPointEvent newCheckPointEvent(long startPosition) { - CheckPointEvent event = new CheckPointEvent(this, startPosition); - checkPoints.add(event); + public CheckpointEvent newCheckpointEvent(long startPosition) { + CheckpointEvent event = new CheckpointEvent(this, startPosition); + checkpoints.add(event); return event; } @@ -120,16 +120,16 @@ public final class ChunkWriter implements Closeable { // Write check point events before a position private void writeCheckpointEvents(long before) throws IOException { - CheckPointEvent cp = checkPoints.peek(); + CheckpointEvent cp = checkpoints.peek(); while (cp != null && cp.getStartPosition() < before) { - checkPoints.poll(); + checkpoints.poll(); long delta = 0; - if (lastCheckPoint != 0) { - delta = lastCheckPoint - output.position(); + if (lastCheckpoint != 0) { + delta = lastCheckpoint - output.position(); } - lastCheckPoint = output.position(); + lastCheckpoint = output.position(); write(cp, delta); - cp = checkPoints.peek(); + cp = checkpoints.peek(); } } @@ -174,10 +174,10 @@ public final class ChunkWriter implements Closeable { writeCheckpointEvents(Long.MAX_VALUE); long metadata = output.position(); writeMetadataEvent(header); - updateHeader(output.position(), lastCheckPoint, metadata); + updateHeader(output.position(), lastCheckpoint, metadata); pools = new LongMap<>(); chunkComplete = true; - lastCheckPoint = 0; + lastCheckpoint = 0; } private void writeMetadataEvent(ChunkHeader header) throws IOException { @@ -190,7 +190,7 @@ public final class ChunkWriter implements Closeable { } } - private void write(CheckPointEvent event, long delta) throws IOException { + private void write(CheckpointEvent event, long delta) throws IOException { input.position(event.getStartPosition()); long startPosition = output.position(); @@ -205,7 +205,7 @@ public final class ChunkWriter implements Closeable { // Write even if touched pools are zero, checkpoint works as sync point output.writeLong(event.touchedPools()); // Pool count - for (CheckPointPool pool : event.getPools()) { + for (CheckpointPool pool : event.getPools()) { if (pool.isTouched()) { output.writeLong(pool.getTypeId()); output.writeLong(pool.getTouchedCount()); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java index 767ccf63507857404f7407418589ff6fa00a8dd6..850e995acf37a608eaf5d58150259bd5a4928773 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java @@ -100,7 +100,7 @@ final class Summary extends Command { } HashMap stats = new HashMap<>(); stats.put(0L, new Statistics(eventPrefix + "Metadata")); - stats.put(1L, new Statistics(eventPrefix + "CheckPoint")); + stats.put(1L, new Statistics(eventPrefix + "Checkpoint")); int minWidth = 0; while (true) { long chunkEnd = ch.getEnd(); diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties index 23a4f9d0437cb7b658ec48a98d851e99c20a1dd0..25a9facea5f2d1e2916e622efb80968c4c9a1a6f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. # 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,7 +80,7 @@ message.building-dmg=Building DMG package for {0}. message.running-script=Running shell script on application image [{0}]. message.preparing-dmg-setup=Preparing dmg setup: {0}. message.creating-dmg-file=Creating DMG file: {0}. -message.dmg-cannot-be-overwritten=Dmg file exists ({0} and can not be removed. +message.dmg-cannot-be-overwritten=Dmg file exists [{0}] and can not be removed. message.output-to-location=Result DMG installer for {0}: {1}. message.building-pkg=Building PKG package for {0}. message.preparing-scripts=Preparing package scripts. diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties index d9da226ec9229c948e3d46bbd15115e159ac4bf5..291130fb23737ee9ac9db6c0d260f41fe617da54 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ message.building-dmg={0}\u306EDMG\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u4F5C\u621 message.running-script=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30A4\u30E1\u30FC\u30B8[{0}]\u3067\u30B7\u30A7\u30EB\u30FB\u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u5B9F\u884C\u3057\u3066\u3044\u307E\u3059\u3002 message.preparing-dmg-setup=dmg\u306E\u8A2D\u5B9A\u3092\u6E96\u5099\u3057\u3066\u3044\u307E\u3059: {0} message.creating-dmg-file=DMG\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059: {0} -message.dmg-cannot-be-overwritten=Dmg\u30D5\u30A1\u30A4\u30EB\u306F\u5B58\u5728\u3057({0}\u3001\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002 +message.dmg-cannot-be-overwritten=Dmg\u30D5\u30A1\u30A4\u30EB\u306F\u5B58\u5728\u3057[{0}]\u3001\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002 message.output-to-location={0}\u306E\u7D50\u679C\u306EDMG\u30A4\u30F3\u30B9\u30C8\u30FC\u30E9: {1} message.building-pkg={0}\u306EPKG\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059 message.preparing-scripts=\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u6E96\u5099\u3057\u3066\u3044\u307E\u3059 diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties index d6f47a7bc85e7641da6253ba695ba2b5ab2a37fc..ecf9e8796d52114881bad9faf4f5baa64d7871d7 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ message.building-dmg=\u6B63\u5728\u4E3A {0} \u6784\u5EFA DMG \u7A0B\u5E8F\u5305\ message.running-script=\u6B63\u5728\u5E94\u7528\u7A0B\u5E8F\u6620\u50CF [{0}] \u4E0A\u8FD0\u884C shell \u811A\u672C\u3002 message.preparing-dmg-setup=\u6B63\u5728\u51C6\u5907 dmg \u8BBE\u7F6E: {0}\u3002 message.creating-dmg-file=\u6B63\u5728\u521B\u5EFA DMG \u6587\u4EF6: {0}\u3002 -message.dmg-cannot-be-overwritten=Dmg \u6587\u4EF6\u5DF2\u5B58\u5728 ({0}) \u4E14\u65E0\u6CD5\u5220\u9664\u3002 +message.dmg-cannot-be-overwritten=Dmg \u6587\u4EF6\u5DF2\u5B58\u5728 [{0}] \u4E14\u65E0\u6CD5\u5220\u9664\u3002 message.output-to-location=\u4E3A {0} \u751F\u6210\u7684 DMG \u5B89\u88C5\u7A0B\u5E8F: {1}\u3002 message.building-pkg=\u6B63\u5728\u4E3A {0} \u6784\u5EFA PKG \u7A0B\u5E8F\u5305\u3002 message.preparing-scripts=\u6B63\u5728\u51C6\u5907\u7A0B\u5E8F\u5305\u811A\u672C\u3002 diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java b/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java index 2d261bfb3a74b0433995752faf27639720ae3444..175c736e420c795daa088766ff74fc2a68864aec 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java @@ -51,7 +51,6 @@ import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXServiceURL; import static jdk.internal.agent.AgentConfigurationError.*; -import jdk.internal.agent.spi.AgentProvider; import jdk.internal.vm.VMSupport; import sun.management.jdp.JdpController; import sun.management.jdp.JdpException; diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java b/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java deleted file mode 100644 index ea42d5974862d487509a0a7d6e2fda1f4b688cab..0000000000000000000000000000000000000000 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. - * 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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 jdk.internal.agent.spi; - -import java.util.Properties; - -/** - * Service interface for management agent - */ -public abstract class AgentProvider { - - /** - * Instantiates a new AgentProvider. - * - * @throws SecurityException if the subclass (and calling code) does not - * have - * {@code RuntimePermission("sun.management.spi.AgentProvider.subclass")} - */ - protected AgentProvider() { - this(checkSubclassPermission()); - } - - private AgentProvider(Void unused) { - } - - private static Void checkSubclassPermission() { - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission(AgentProvider.class.getName() + ".subclass")); - } - return null; - } - - /** - * Gets the name of the agent provider. - * - * @return name of agent provider - */ - public abstract String getName(); - - /** - * Initializes and starts the agent. - * - * @throws IllegalStateException if this agent has already been started. - */ - public abstract void startAgent(); - - /** - * Initializes and starts the agent at given port and with given properties - * - * @param props environment variables for agent - * - * @throws IllegalStateException if this agent has already been started. - */ - public abstract void startAgent(Properties props); - - /** - * Checks if agent is started and not terminated. - * - * @return true if agent is running, false otherwise. - */ - public abstract boolean isActive(); - - /** - * Stops this agent. - * - * @throws IllegalStateException if this agent is not started. - */ - public abstract void stopAgent(); -} diff --git a/src/jdk.management.agent/share/classes/module-info.java b/src/jdk.management.agent/share/classes/module-info.java index 921744822b61197d23c6f0438df741d7f0fccaac..9688e22b9f9740eb4b3df2e38381a03edfc156cb 100644 --- a/src/jdk.management.agent/share/classes/module-info.java +++ b/src/jdk.management.agent/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. * 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,4 @@ module jdk.management.agent { requires java.management.rmi; exports jdk.internal.agent to jdk.jconsole; - - uses jdk.internal.agent.spi.AgentProvider; } diff --git a/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java b/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java index 7ce5f9c93602e0b7e3a637018c847c42a33371be..d8ff2debe9ef92b550edebb9d3d046fbeadd8d66 100644 --- a/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java +++ b/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java @@ -179,7 +179,7 @@ final class DiskRepository implements Closeable { bufferIndex = 0; break; case CHECKPOINT_EVENT_HEADER_BYTE_ARRAY_CONTENT: - processCheckPointHeader(); + processCheckpointHeader(); break; case CHECKPOINT_EVENT_FLUSH_TYPE: processFlush(); @@ -286,10 +286,10 @@ final class DiskRepository implements Closeable { } } - private void processCheckPointHeader() throws IOException { + private void processCheckpointHeader() throws IOException { buffer.put(bufferIndex, nextByte(true)); if (bufferIndex == HEADER_SIZE) { - writeCheckPointHeader(); + writeCheckpointHeader(); state = State.EVENT_PAYLOAD; bufferIndex = 0; } @@ -321,7 +321,7 @@ final class DiskRepository implements Closeable { } } - private void writeCheckPointHeader() throws IOException { + private void writeCheckpointHeader() throws IOException { Objects.requireNonNull(raf); byte state = buffer.get(HEADER_FILE_STATE_POSITION); boolean complete = state == COMPLETE_STATE; diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java index 8b2b90e707964dfd8d7a9428da36eac1858f9d56..77ea2808eb4f35d28d5fa1a9019a54ba5fb5959e 100644 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java +++ b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.controlflow; import com.sun.hotspot.igv.data.InputBlockEdge; import com.sun.hotspot.igv.layout.Link; import com.sun.hotspot.igv.layout.Port; +import com.sun.hotspot.igv.layout.Cluster; import java.awt.BasicStroke; import java.awt.Point; import java.awt.Stroke; @@ -76,6 +77,14 @@ public class BlockConnectionWidget extends ConnectionWidget implements Link { return outputSlot; } + public Cluster getFromCluster() { + return null; + } + + public Cluster getToCluster() { + return null; + } + public void setBold(boolean bold) { this.isBold = bold; updateStroke(); diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java index 087f3398e956218b82890c02cc57c364d20a6be1..bf16e7f427eaa632fdf0b8991cdf0af9f84ea762 100644 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java +++ b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,6 +69,14 @@ public class HierarchicalGraphLayout extends GraphLayout { return to.getSlot(); } + public Cluster getFromCluster() { + return null; + } + + public Cluster getToCluster() { + return null; + } + public List getControlPoints() { return new ArrayList(); } diff --git a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlock.java b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlock.java index 242623d7ada6fbad92404b490bdf789ec10e9064..28cfc11d7cda5e2471ec11fbb5a94b951ec6d1a1 100644 --- a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlock.java +++ b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,6 +35,7 @@ public class InputBlock { private String name; private InputGraph graph; private Set successors; + private boolean artificial; @Override public int hashCode() { @@ -77,6 +78,7 @@ public class InputBlock { this.name = name; nodes = new ArrayList<>(); successors = new LinkedHashSet<>(2); + artificial = false; } public String getName() { @@ -101,6 +103,10 @@ public class InputBlock { return Collections.unmodifiableSet(successors); } + public void setNodes(List nodes) { + this.nodes = nodes; + } + @Override public String toString() { return "Block " + this.getName(); @@ -111,4 +117,12 @@ public class InputBlock { successors.add(b); } } + + void setArtificial(boolean artificial) { + this.artificial = artificial; + } + + public boolean isArtificial() { + return artificial; + } } diff --git a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlockEdge.java b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlockEdge.java index c93a1549ed29caed43da6767faebf626c3365827..2a1586dc9dac8f6a07c276ad00f90a7b1feac191 100644 --- a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlockEdge.java +++ b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputBlockEdge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,12 +38,14 @@ public class InputBlockEdge { private InputBlock from; private InputBlock to; private State state = State.SAME; + private String label; - public InputBlockEdge(InputBlock from, InputBlock to) { + public InputBlockEdge(InputBlock from, InputBlock to, String label) { assert from != null; assert to != null; this.from = from; this.to = to; + this.label = label; } public InputBlock getFrom() { @@ -62,6 +64,10 @@ public class InputBlockEdge { this.state = state; } + public String getLabel() { + return label; + } + @Override public boolean equals(Object obj) { if (obj != null && obj instanceof InputBlockEdge) { diff --git a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputGraph.java b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputGraph.java index b00ed789d390e724793572973389ab8622cb8206..c218b10002d1a5d82600669b39e8607c27edb016 100644 --- a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputGraph.java +++ b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputGraph.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +58,11 @@ public class InputGraph extends Properties.Entity implements FolderElement { } public InputBlockEdge addBlockEdge(InputBlock left, InputBlock right) { - InputBlockEdge edge = new InputBlockEdge(left, right); + return addBlockEdge(left, right, null); + } + + public InputBlockEdge addBlockEdge(InputBlock left, InputBlock right, String label) { + InputBlockEdge edge = new InputBlockEdge(left, right, label); blockEdges.add(edge); left.addSuccessor(right); return edge; @@ -140,6 +144,7 @@ public class InputGraph extends Properties.Entity implements FolderElement { public void clearBlocks() { blocks.clear(); + blockEdges.clear(); nodeToBlock.clear(); } @@ -168,7 +173,7 @@ public class InputGraph extends Properties.Entity implements FolderElement { assert nodes.get(n.getId()) == n; if (!scheduledNodes.contains(n)) { if (noBlock == null) { - noBlock = this.addBlock("(no block)"); + noBlock = addArtificialBlock(); } noBlock.addNode(n.getId()); } @@ -270,6 +275,12 @@ public class InputGraph extends Properties.Entity implements FolderElement { return sb.toString(); } + public InputBlock addArtificialBlock() { + InputBlock b = addBlock("(no block)"); + b.setArtificial(true); + return b; + } + public InputBlock addBlock(String name) { final InputBlock b = new InputBlock(this, name); blocks.put(b.getName(), b); diff --git a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/serialization/Parser.java b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/serialization/Parser.java index 2c8d669d08a04d3d0c2b8bf290c2b1defcc7077a..31a373991c1ffef35a66100ea580d5796bebd914 100644 --- a/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/serialization/Parser.java +++ b/src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/serialization/Parser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -261,7 +261,7 @@ public class Parser implements GraphParser { for (InputNode n : graph.getNodes()) { if (graph.getBlock(n) == null) { if (noBlock == null) { - noBlock = graph.addBlock("(no block)"); + noBlock = graph.addArtificialBlock(); } noBlock.addNode(n.getId()); diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ColorFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ColorFilter.java index 8a6bf7b5134e4983ff096ecf7d1f22e9a555eee5..9e51f1ba865a9f1971be21604dd964e385c2df31 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ColorFilter.java +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ColorFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ public class ColorFilter extends AbstractFilter { ConnectionStyle style = rule.getLineStyle(); for (OutputSlot s : f.getOutputSlots()) { - for (Connection c : s.getConnections()) { + for (FigureConnection c : s.getConnections()) { if (color != null) { c.setColor(color); } diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/CombineFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/CombineFilter.java index 4f86f1d60283627d1dc45c8da617a7b0ffd3e3b7..5ee30b4d4d884083b796fcea570e2a286318617f 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/CombineFilter.java +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/CombineFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,7 +67,7 @@ public class CombineFilter extends AbstractFilter { InputSlot slot = null; for (InputSlot s : succ.getInputSlots()) { - for (Connection c : s.getConnections()) { + for (FigureConnection c : s.getConnections()) { if (c.getOutputSlot().getFigure() == f) { slot = s; } @@ -97,8 +97,8 @@ public class CombineFilter extends AbstractFilter { } for (InputSlot s : f.getInputSlots()) { - for (Connection c : s.getConnections()) { - Connection newConn = diagram.createConnection(slot, c.getOutputSlot(), c.getLabel(), c.getType()); + for (FigureConnection c : s.getConnections()) { + FigureConnection newConn = diagram.createConnection(slot, c.getOutputSlot(), c.getLabel()); newConn.setColor(c.getColor()); newConn.setStyle(c.getStyle()); } @@ -115,7 +115,7 @@ public class CombineFilter extends AbstractFilter { OutputSlot oldSlot = null; for (OutputSlot s : f.getOutputSlots()) { - for (Connection c : s.getConnections()) { + for (FigureConnection c : s.getConnections()) { if (c.getInputSlot().getFigure() == succ) { oldSlot = s; } @@ -155,8 +155,8 @@ public class CombineFilter extends AbstractFilter { } } } - for (Connection c : nextSlot.getConnections()) { - Connection newConn = diagram.createConnection(c.getInputSlot(), slot, c.getLabel(), c.getType()); + for (FigureConnection c : nextSlot.getConnections()) { + FigureConnection newConn = diagram.createConnection(c.getInputSlot(), slot, c.getLabel()); newConn.setColor(c.getColor()); newConn.setStyle(c.getStyle()); } diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ConnectionFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ConnectionFilter.java index d1c9bd69258e0fc2e631adff64dc873f8d56b0d9..2234fc5f67e97631ec0ea5ad3061bc69d80c7ced 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ConnectionFilter.java +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/ConnectionFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ public class ConnectionFilter extends AbstractFilter { for (Figure f : figures) { for (OutputSlot os : f.getOutputSlots()) { - for (Connection c : os.getConnections()) { + for (FigureConnection c : os.getConnections()) { c.setStyle(rule.getLineStyle()); c.setColor(rule.getLineColor()); } diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java index 4a1919101bede6118befc71700e7acb995b0ed55..9901427c9bf1626013627f4dfece4fead43e942e 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,7 +64,7 @@ public class EdgeColorIndexFilter extends AbstractFilter { for (Slot slot : slots) { if (index < colors.length && colors[index] != null) { slot.setColor(colors[index]); - for (Connection c : slot.getConnections()) { + for (FigureConnection c : slot.getConnections()) { c.setColor(colors[index]); } diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveBlockFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveBlockFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..787542eda2ba4011e7d373bf1af44d51111807a2 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveBlockFilter.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.filter; + +import com.sun.hotspot.igv.graph.Diagram; +import com.sun.hotspot.igv.graph.Block; +import com.sun.hotspot.igv.graph.BlockSelector; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class RemoveBlockFilter extends AbstractFilter { + + private final List rules; + private final String name; + + public RemoveBlockFilter(String name) { + this.name = name; + rules = new ArrayList<>(); + } + + @Override + public String getName() { + return name; + } + + @Override + public void apply(Diagram diagram) { + for (RemoveBlockRule r : rules) { + List selected = r.getBlockSelector().selected(diagram); + Set toRemove = new HashSet<>(selected); + diagram.removeAllBlocks(toRemove); + } + } + + public void addRule(RemoveBlockRule rule) { + rules.add(rule); + } + + public static class RemoveBlockRule { + + private final BlockSelector selector; + + public RemoveBlockRule(BlockSelector selector) { + this.selector = selector; + } + + public BlockSelector getBlockSelector() { + return selector; + } + } +} diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveInputsFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveInputsFilter.java index 073abf23d5b7ec61cae726d79dc35c9f9c9146b2..eacc4c9aae735fb2a97230a1de088d804bdadcb0 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveInputsFilter.java +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveInputsFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,9 +58,9 @@ public class RemoveInputsFilter extends AbstractFilter { for (InputSlot is : f.getInputSlots()) { if (z >= r.getStartingIndex() && z <= r.getEndIndex() && is.getConnections().size() > 0) { StringBuilder sb = new StringBuilder(); - List conns = is.getConnections(); + List conns = is.getConnections(); for (int i = 0; i < conns.size(); i++) { - Connection c = conns.get(i); + FigureConnection c = conns.get(i); OutputSlot os = c.getOutputSlot(); Figure pred = os.getFigure(); if (i != 0) { diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java index edbb88f9de482116fd0613dbf9b0d9b251969de4..8fb479d62b76875eea4e748bcac729a1ee358ee4 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,15 +52,15 @@ public class RemoveSelfLoopsFilter extends AbstractFilter { for (InputSlot is : f.getInputSlots()) { - List toRemove = new ArrayList<>(); - for (Connection c : is.getConnections()) { + List toRemove = new ArrayList<>(); + for (FigureConnection c : is.getConnections()) { if (c.getOutputSlot().getFigure() == f) { toRemove.add(c); } } - for (Connection c : toRemove) { + for (FigureConnection c : toRemove) { c.remove(); diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/SplitFilter.java b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/SplitFilter.java index d2bace49193b45a609893d707bd60441659f52e7..825e4d6560b79f8a0444757b9f98a5d744fb5281 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/SplitFilter.java +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/java/com/sun/hotspot/igv/filter/SplitFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ public class SplitFilter extends AbstractFilter { for (Figure f : list) { for (InputSlot is : f.getInputSlots()) { - for (Connection c : is.getConnections()) { + for (FigureConnection c : is.getConnections()) { OutputSlot os = c.getOutputSlot(); if (f.getSource().getSourceNodes().size() > 0) { os.getSource().addSourceNodes(f.getSource()); @@ -71,7 +71,7 @@ public class SplitFilter extends AbstractFilter { } } for (OutputSlot os : f.getOutputSlots()) { - for (Connection c : os.getConnections()) { + for (FigureConnection c : os.getConnections()) { InputSlot is = c.getInputSlot(); if (f.getSource().getSourceNodes().size() > 0) { is.getSource().addSourceNodes(f.getSource()); diff --git a/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java b/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java index b691e31c3df8c5767caf4e06ca8fbadabd694f36..29ab4f636de9b8c8f4314f7526bdef5c1646bcbb 100644 --- a/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java +++ b/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ package com.sun.hotspot.igv.graal.filters; import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.filter.AbstractFilter; -import com.sun.hotspot.igv.graph.Connection; +import com.sun.hotspot.igv.graph.FigureConnection; import com.sun.hotspot.igv.graph.Diagram; import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.graph.InputSlot; @@ -42,7 +42,7 @@ public class GraalCFGFilter extends AbstractFilter { @Override public void apply(Diagram d) { - Set connectionsToRemove = new HashSet<>(); + Set connectionsToRemove = new HashSet<>(); for (Figure f : d.getFigures()) { Properties p = f.getProperties(); @@ -57,7 +57,7 @@ public class GraalCFGFilter extends AbstractFilter { } for (InputSlot is : f.getInputSlots()) { if (is.getPosition() >= predCount && !"EndNode".equals(is.getProperties().get("class"))) { - for (Connection c : is.getConnections()) { + for (FigureConnection c : is.getConnections()) { if (!"EndNode".equals(c.getOutputSlot().getFigure().getProperties().get("class"))) { connectionsToRemove.add(c); } @@ -66,7 +66,7 @@ public class GraalCFGFilter extends AbstractFilter { } } - for (Connection c : connectionsToRemove) { + for (FigureConnection c : connectionsToRemove) { c.remove(); } diff --git a/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalEdgeColorFilter.java b/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalEdgeColorFilter.java index 1693a3ec57e695ab28b64d5039d98bc0e6339f3a..b280d15072b4a0e4065065a7bbe929dd4b03033d 100644 --- a/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalEdgeColorFilter.java +++ b/src/utils/IdealGraphVisualizer/Graal/src/main/java/com/sun/hotspot/igv/graal/filters/GraalEdgeColorFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * 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,16 +23,10 @@ */ package com.sun.hotspot.igv.graal.filters; -import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.filter.AbstractFilter; -import com.sun.hotspot.igv.graph.Connection; -import com.sun.hotspot.igv.graph.Connection.ConnectionStyle; import com.sun.hotspot.igv.graph.Diagram; -import com.sun.hotspot.igv.graph.Figure; -import com.sun.hotspot.igv.graph.InputSlot; import java.awt.Color; import java.util.HashMap; -import java.util.List; /** * Filter that colors usage and successor edges differently. @@ -54,29 +48,6 @@ public class GraalEdgeColorFilter extends AbstractFilter { @Override public void apply(Diagram d) { - List
    figures = d.getFigures(); - for (Figure f : figures) { - for (InputSlot is : f.getInputSlots()) { - for (Connection c : is.getConnections()) { - String type = c.getType(); - if (type == "Association" && "EndNode".equals(c.getOutputSlot().getFigure().getProperties().get("class"))) { - type = "Successor"; - } - - if (type != null) { - Color typeColor = usageColor.get(type); - if (typeColor == null) { - c.setColor(otherUsageColor); - } else { - c.setColor(typeColor); - } - if (c.getStyle() != ConnectionStyle.DASHED && type == "Successor") { - c.setStyle(ConnectionStyle.BOLD); - } - } - } - } - } } public Color getUsageColor(String type) { diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/AnySelector.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/AnySelector.java new file mode 100644 index 0000000000000000000000000000000000000000..3def4463aa0584696e7eaf0674893423de07b704 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/AnySelector.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.graph; + +import java.util.List; +import java.util.ArrayList; + +// Selects blocks where any node is selected. +public class AnySelector implements BlockSelector { + + private final Selector selector; + + public AnySelector(Selector s) { + this.selector = s; + } + + @Override + public List selected(Diagram d) { + List l = new ArrayList<>(); + for (Figure f : selector.selected(d)) { + l.add(d.getBlock(f.getBlock())); + } + return l; + } +} diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Block.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Block.java index a853f5854fdddba607881a8593ec2290fdc0c29b..18a08b8992a09bdce8ab8b6e9c51743aa48bc5ba 100644 --- a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Block.java +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Block.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ */ package com.sun.hotspot.igv.graph; +import java.awt.Dimension; import com.sun.hotspot.igv.data.InputBlock; import com.sun.hotspot.igv.layout.Cluster; import java.awt.Rectangle; @@ -55,11 +56,17 @@ public class Block implements Cluster { public Set getSuccessors() { Set succs = new HashSet(); for (InputBlock b : inputBlock.getSuccessors()) { - succs.add(diagram.getBlock(b)); + if (diagram.hasBlock(b)) { + succs.add(diagram.getBlock(b)); + } } return succs; } + public Dimension getNodeOffset() { + return new Dimension(0, -Figure.getVerticalOffset()); + } + public void setBounds(Rectangle r) { this.bounds = r; } diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/BlockConnection.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/BlockConnection.java new file mode 100644 index 0000000000000000000000000000000000000000..f846446ffb18fe5a860cb8df0d50722acdbbb022 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/BlockConnection.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.graph; + +import com.sun.hotspot.igv.layout.Port; +import java.awt.Color; +import java.awt.Point; +import java.util.List; + +public class BlockConnection implements Connection { + + private final Block sourceBlock; + private final Block destinationBlock; + private final String label; + private List controlPoints; + + public BlockConnection(Block src, Block dst, String label) { + this.sourceBlock = src; + this.destinationBlock = dst; + this.label = label; + } + + public Color getColor() { + return Color.BLUE; + } + + public ConnectionStyle getStyle() { + return ConnectionStyle.BOLD; + } + + @Override + public String getToolTipText() { + StringBuilder builder = new StringBuilder(); + builder.append("B").append(sourceBlock.getInputBlock().getName()) + .append(" → B").append(destinationBlock.getInputBlock().getName()); + if (label != null) { + builder.append(": ").append(label); + } + return builder.toString(); + } + + @Override + public String toString() { + return "BlockConnection('" + label + "', " + getFromCluster() + " to " + getToCluster() + ")"; + } + + @Override + public Port getFrom() { + return null; + } + + @Override + public Block getFromCluster() { + return sourceBlock; + } + + @Override + public Port getTo() { + return null; + } + + @Override + public Block getToCluster() { + return destinationBlock; + } + + @Override + public boolean isVIP() { + return true; + } + + @Override + public List getControlPoints() { + return controlPoints; + } + + @Override + public void setControlPoints(List list) { + controlPoints = list; + } + + @Override + public boolean isAlwaysVisible() { + return true; + } + + @Override + public boolean hasSlots() { + return false; + } +} diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/BlockSelector.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/BlockSelector.java new file mode 100644 index 0000000000000000000000000000000000000000..f27afac616a7b8c619d5a8cd746f186dbfd14e3b --- /dev/null +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/BlockSelector.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.graph; + +import java.util.List; + +public interface BlockSelector { + List selected(Diagram d); +} diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Connection.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Connection.java index 4355a5e0cc53c201ccdfc0150ee22e01410d7394..faa8f7369886760ce448fa3a34caba434b4c1878 100644 --- a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Connection.java +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Connection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. * 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,143 +23,26 @@ */ package com.sun.hotspot.igv.graph; -import com.sun.hotspot.igv.data.Source; import com.sun.hotspot.igv.layout.Link; -import com.sun.hotspot.igv.layout.Port; import java.awt.Color; -import java.awt.Point; -import java.util.ArrayList; -import java.util.List; -/** - * - * @author Thomas Wuerthinger - */ -public class Connection implements Source.Provider, Link { - - @Override - public boolean isVIP() { - return style == ConnectionStyle.BOLD; - } +public interface Connection extends Link { public enum ConnectionStyle { - NORMAL, DASHED, BOLD, INVISIBLE } - private InputSlot inputSlot; - private OutputSlot outputSlot; - private Source source; - private Color color; - private ConnectionStyle style; - private List controlPoints; - private String label; - private String type; - - protected Connection(InputSlot inputSlot, OutputSlot outputSlot, String label, String type) { - this.inputSlot = inputSlot; - this.outputSlot = outputSlot; - this.label = label; - this.type = type; - this.inputSlot.connections.add(this); - this.outputSlot.connections.add(this); - controlPoints = new ArrayList<>(); - Figure sourceFigure = this.outputSlot.getFigure(); - Figure destFigure = this.inputSlot.getFigure(); - sourceFigure.addSuccessor(destFigure); - destFigure.addPredecessor(sourceFigure); - source = new Source(); - - this.color = Color.BLACK; - this.style = ConnectionStyle.NORMAL; - } - - public InputSlot getInputSlot() { - return inputSlot; - } - public OutputSlot getOutputSlot() { - return outputSlot; - } + public ConnectionStyle getStyle(); - public Color getColor() { - return color; - } + public Color getColor(); - public ConnectionStyle getStyle() { - return style; - } + public String getToolTipText(); - public void setColor(Color c) { - color = c; - } + public boolean isAlwaysVisible(); - public void setStyle(ConnectionStyle s) { - style = s; - } - - @Override - public Source getSource() { - return source; - } + public boolean hasSlots(); - public String getLabel() { - return label; - } - - public String getType() { - return type; - } - - public void remove() { - inputSlot.getFigure().removePredecessor(outputSlot.getFigure()); - inputSlot.connections.remove(this); - outputSlot.getFigure().removeSuccessor(inputSlot.getFigure()); - outputSlot.connections.remove(this); - } - - public String getToolTipText() { - StringBuilder builder = new StringBuilder(); - if (label != null) { - builder.append(label).append(": "); - } - if (type != null) { - builder.append(type).append(" "); - } - // Resolve strings lazily every time the tooltip is shown, instead of - // eagerly as for node labels, for efficiency. - String shortNodeText = getInputSlot().getFigure().getDiagram().getShortNodeText(); - builder.append(getOutputSlot().getFigure().getProperties().resolveString(shortNodeText)); - builder.append(" → "); - builder.append(getInputSlot().getFigure().getProperties().resolveString(shortNodeText)); - return builder.toString(); - } - - @Override - public String toString() { - return "Connection('" + label + "', " + getFrom().getVertex() + " to " + getTo().getVertex() + ")"; - } - - @Override - public Port getFrom() { - return outputSlot; - } - - @Override - public Port getTo() { - return inputSlot; - } - - @Override - public List getControlPoints() { - return controlPoints; - } - - @Override - public void setControlPoints(List list) { - controlPoints = list; - } } - diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Diagram.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Diagram.java index a770aba07e0c9b1d8b9e7f8623dd8ecb8b9e6e5e..445eeae8a9fc6b249bb3742eeaad33800ec114f3 100644 --- a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Diagram.java +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Diagram.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,12 +24,14 @@ package com.sun.hotspot.igv.graph; import com.sun.hotspot.igv.data.InputBlock; +import com.sun.hotspot.igv.data.InputBlockEdge; import com.sun.hotspot.igv.data.InputEdge; import com.sun.hotspot.igv.data.InputGraph; import com.sun.hotspot.igv.data.InputNode; import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.data.Properties.StringPropertyMatcher; import java.awt.Font; +import java.awt.Color; import java.util.*; /** @@ -44,9 +46,14 @@ public class Diagram { private int curId; private String nodeText; private String shortNodeText; + private String tinyNodeText; private final Font font; private final Font slotFont; private final Font boldFont; + // Whether widgets derived from this diagram should be adapted for the + // control-flow graph view. + private boolean cfg; + private final Set blockConnections; public Font getFont() { return font; @@ -60,7 +67,16 @@ public class Diagram { return boldFont; } - private Diagram() { + public boolean isCFG() { + return cfg; + } + + public void setCFG(boolean cfg) { + this.cfg = cfg; + } + + private Diagram(InputGraph graph, String nodeText, String shortNodeText, + String tinyNodeText) { figures = new ArrayList<>(); blocks = new LinkedHashMap<>(8); this.nodeText = ""; @@ -68,6 +84,12 @@ public class Diagram { this.font = new Font("Arial", Font.PLAIN, 12); this.slotFont = new Font("Arial", Font.PLAIN, 10); this.boldFont = this.font.deriveFont(Font.BOLD); + this.cfg = false; + this.blockConnections = new HashSet<>(); + this.graph = graph; + this.nodeText = nodeText; + this.shortNodeText = shortNodeText; + this.tinyNodeText = tinyNodeText; } public Block getBlock(InputBlock b) { @@ -75,6 +97,10 @@ public class Diagram { return blocks.get(b); } + public boolean hasBlock(InputBlock b) { + return blocks.containsKey(b); + } + public String getNodeText() { return nodeText; } @@ -83,6 +109,10 @@ public class Diagram { return shortNodeText; } + public String getTinyNodeText() { + return tinyNodeText; + } + public void updateBlocks() { blocks.clear(); for (InputBlock b : graph.getBlocks()) { @@ -91,18 +121,10 @@ public class Diagram { } } - public Diagram getNext() { - return Diagram.createDiagram(graph.getNext(), nodeText, shortNodeText); - } - public Collection getBlocks() { return Collections.unmodifiableCollection(blocks.values()); } - public Diagram getPrev() { - return Diagram.createDiagram(graph.getPrev(), nodeText, shortNodeText); - } - public List
    getFigures() { return Collections.unmodifiableList(figures); } @@ -114,10 +136,10 @@ public class Diagram { return f; } - public Connection createConnection(InputSlot inputSlot, OutputSlot outputSlot, String label, String type) { + public FigureConnection createConnection(InputSlot inputSlot, OutputSlot outputSlot, String label) { assert inputSlot.getFigure().getDiagram() == this; assert outputSlot.getFigure().getDiagram() == this; - return new Connection(inputSlot, outputSlot, label, type); + return new FigureConnection(inputSlot, outputSlot, label); } public Map> calcSourceToFigureRelation() { @@ -137,16 +159,13 @@ public class Diagram { } public static Diagram createDiagram(InputGraph graph, String nodeText, - String shortNodeText) { + String shortNodeText, + String tinyNodeText) { if (graph == null) { return null; } - Diagram d = new Diagram(); - d.graph = graph; - d.nodeText = nodeText; - d.shortNodeText = shortNodeText; - + Diagram d = new Diagram(graph, nodeText, shortNodeText, tinyNodeText); d.updateBlocks(); Collection nodes = graph.getNodes(); @@ -156,6 +175,7 @@ public class Diagram { f.getSource().addSourceNode(n); f.getProperties().add(n.getProperties()); f.setSubgraphs(n.getSubgraphs()); + f.setBlock(graph.getBlock(n)); figureHash.put(n.getId(), f); } @@ -181,7 +201,7 @@ public class Diagram { } InputSlot inputSlot = toFigure.getInputSlots().get(toIndex); - Connection c = d.createConnection(inputSlot, outputSlot, e.getLabel(), e.getType()); + FigureConnection c = d.createConnection(inputSlot, outputSlot, e.getLabel()); if (e.getState() == InputEdge.State.NEW) { c.setStyle(Connection.ConnectionStyle.BOLD); @@ -190,10 +210,30 @@ public class Diagram { } } + for (InputBlockEdge e : graph.getBlockEdges()) { + Block p = d.getBlock(e.getFrom()); + Block s = d.getBlock(e.getTo()); + d.blockConnections.add(new BlockConnection(p, s, e.getLabel())); + } return d; } + public void removeAllBlocks(Set blocksToRemove) { + Set
    figuresToRemove = new HashSet<>(); + for (Block b : blocksToRemove) { + for (Figure f : getFigures()) { + if (f.getBlock() == b.getInputBlock()) { + figuresToRemove.add(f); + } + } + } + removeAllFigures(figuresToRemove); + for (Block b : blocksToRemove) { + blocks.remove(b.getInputBlock()); + } + } + public void removeAllFigures(Set
    figuresToRemove) { for (Figure f : figuresToRemove) { freeFigure(f); @@ -228,7 +268,6 @@ public class Diagram { } public void removeFigure(Figure succ) { - assert this.figures.contains(succ); freeFigure(succ); this.figures.remove(succ); @@ -242,16 +281,24 @@ public class Diagram { return graph; } - public Set getConnections() { - - Set connections = new HashSet<>(); + public Set getConnections() { + Set connections = new HashSet<>(); for (Figure f : figures) { - for (InputSlot s : f.getInputSlots()) { connections.addAll(s.getConnections()); } } + return connections; + } + public Set getBlockConnections() { + Set connections = new HashSet<>(); + for (BlockConnection bc : blockConnections) { + if (blocks.containsKey(bc.getFromCluster().getInputBlock()) && + blocks.containsKey(bc.getToCluster().getInputBlock())) { + connections.add(bc); + } + } return connections; } @@ -278,7 +325,7 @@ public class Diagram { System.out.println("Diagram statistics"); List
    tmpFigures = getFigures(); - Set connections = getConnections(); + Set connections = getConnections(); System.out.println("Number of figures: " + tmpFigures.size()); System.out.println("Number of connections: " + connections.size()); diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Figure.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Figure.java index 11ae90c2b150482a5d285889a63487010b8767b0..cd7f2f48e7a99144dc24f086e58c583b812f0d68 100644 --- a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Figure.java +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Figure.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,18 +31,18 @@ import com.sun.hotspot.igv.data.Source; import com.sun.hotspot.igv.layout.Cluster; import com.sun.hotspot.igv.layout.Vertex; import java.awt.*; -import java.awt.image.BufferedImage; import java.util.List; import java.util.*; public class Figure extends Properties.Entity implements Source.Provider, Vertex { public static final int INSET = 8; - public static int SLOT_WIDTH = 10; + public static final int SLOT_WIDTH = 10; public static final int OVERLAPPING = 6; public static final int SLOT_START = 4; public static final int SLOT_OFFSET = 8; - public static final boolean VERTICAL_LAYOUT = true; + public static final int TOP_CFG_HEIGHT = 7; + public static final int BOTTOM_CFG_HEIGHT = 6; protected List inputSlots; protected List outputSlots; private Source source; @@ -57,19 +57,33 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex private String[] lines; private int heightCash = -1; private int widthCash = -1; + private InputBlock block; + private final FontMetrics metrics; public int getHeight() { if (heightCash == -1) { - BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); - Graphics g = image.getGraphics(); - g.setFont(diagram.getFont().deriveFont(Font.BOLD)); - FontMetrics metrics = g.getFontMetrics(); - String nodeText = diagram.getNodeText(); - heightCash = nodeText.split("\n").length * metrics.getHeight() + INSET; + updateHeight(); } return heightCash; } + private void updateHeight() { + String nodeText = diagram.getNodeText(); + int lines = nodeText.split("\n").length; + if (hasInputList() && lines > 1) { + lines++; + } + heightCash = lines * metrics.getHeight() + INSET; + if (diagram.isCFG()) { + if (hasNamedInputSlot()) { + heightCash += TOP_CFG_HEIGHT; + } + if (hasNamedOutputSlot()) { + heightCash += BOTTOM_CFG_HEIGHT; + } + } + } + public static List getAllBefore(List inputList, T tIn) { List result = new ArrayList<>(); for(T t : inputList) { @@ -91,11 +105,17 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex public int getWidth() { if (widthCash == -1) { + updateWidth(); + } + return widthCash; + } + + public void setWidth(int width) { + widthCash = width; + } + + private void updateWidth() { int max = 0; - BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); - Graphics g = image.getGraphics(); - g.setFont(diagram.getFont().deriveFont(Font.BOLD)); - FontMetrics metrics = g.getFontMetrics(); for (String s : getLines()) { int cur = metrics.stringWidth(s); if (cur > max) { @@ -105,8 +125,6 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex widthCash = max + INSET; widthCash = Math.max(widthCash, Figure.getSlotsWidth(inputSlots)); widthCash = Math.max(widthCash, Figure.getSlotsWidth(outputSlots)); - } - return widthCash; } protected Figure(Diagram diagram, int id) { @@ -121,6 +139,8 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex this.position = new Point(0, 0); this.color = Color.WHITE; + Canvas canvas = new Canvas(); + metrics = canvas.getFontMetrics(diagram.getFont().deriveFont(Font.BOLD)); } public int getId() { @@ -135,6 +155,18 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex return color; } + public boolean hasInputList() { + return diagram.isCFG() && !getPredecessors().isEmpty(); + } + + public void setBlock(InputBlock block) { + this.block = block; + } + + public InputBlock getBlock() { + return block; + } + public List
    getPredecessors() { return Collections.unmodifiableList(predecessors); } @@ -221,8 +253,8 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex assert inputSlots.contains(s) || outputSlots.contains(s); - List connections = new ArrayList<>(s.getConnections()); - for (Connection c : connections) { + List connections = new ArrayList<>(s.getConnections()); + for (FigureConnection c : connections) { c.remove(); } @@ -261,6 +293,24 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex return Collections.unmodifiableList(outputSlots); } + public boolean hasNamedInputSlot() { + for (InputSlot is : getInputSlots()) { + if (is.hasSourceNodes() && is.shouldShowName()) { + return true; + } + } + return false; + } + + public boolean hasNamedOutputSlot() { + for (OutputSlot os : getOutputSlots()) { + if (os.hasSourceNodes() && os.shouldShowName()) { + return true; + } + } + return false; + } + void removeInputSlot(InputSlot s) { s.removeAllConnections(); inputSlots.remove(s); @@ -274,41 +324,52 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex public String[] getLines() { if (lines == null) { updateLines(); - // Set the "label" property of each input node, so that by default - // search is done on the node label (without line breaks). See also - // class NodeQuickSearch in the View module. - for (InputNode n : getSource().getSourceNodes()) { - String label = n.getProperties().resolveString(diagram.getNodeText()); - n.getProperties().setProperty("label", label.replaceAll("\\R", " ")); - } } return lines; } public void updateLines() { String[] strings = diagram.getNodeText().split("\n"); - String[] result = new String[strings.length]; + List result = new ArrayList<>(strings.length + 1); for (int i = 0; i < strings.length; i++) { - result[i] = getProperties().resolveString(strings[i]); + result.add(getProperties().resolveString(strings[i])); } - lines = result; + if (hasInputList()) { + String inputList = " ← "; + List inputs = new ArrayList(getPredecessors().size()); + for (Figure p : getPredecessors()) { + inputs.add(p.getProperties().resolveString(diagram.getTinyNodeText())); + } + inputList += String.join(" ", inputs); + if (result.size() == 1) { + // Single-line node, append input list to line. + result.set(0, result.get(0) + inputList); + } else { + // Multi-line node, add yet another line for input list. + result.add(inputList); + } + } + + lines = result.toArray(new String[0]); + // Set the "label" property of each input node, so that by default + // search is done on the node label (without line breaks). See also + // class NodeQuickSearch in the View module. + for (InputNode n : getSource().getSourceNodes()) { + String label = n.getProperties().resolveString(diagram.getNodeText()); + n.getProperties().setProperty("label", label.replaceAll("\\R", " ")); + } + // Update figure dimensions, as these are affected by the node text. + updateWidth(); + updateHeight(); } @Override public Dimension getSize() { - if (VERTICAL_LAYOUT) { - int width = Math.max(getWidth(), Figure.SLOT_WIDTH * (Math.max(inputSlots.size(), outputSlots.size()) + 1)); - int height = getHeight() + 2 * Figure.SLOT_WIDTH - 2 * Figure.OVERLAPPING; - - - return new Dimension(width, height); - } else { - int width = getWidth() + 2 * Figure.SLOT_WIDTH - 2*Figure.OVERLAPPING; - int height = Figure.SLOT_WIDTH * (Math.max(inputSlots.size(), outputSlots.size()) + 1); - return new Dimension(width, height); - } + int width = Math.max(getWidth(), Figure.SLOT_WIDTH * (Math.max(inputSlots.size(), outputSlots.size()) + 1)); + int height = getHeight() + (diagram.isCFG() ? 0 : 2 * Figure.SLOT_WIDTH - 2 * Figure.OVERLAPPING); + return new Dimension(width, height); } @Override @@ -316,12 +377,20 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex return idString; } + public InputNode getFirstSourceNode() { + return getSource().getSourceNodes().get(0); + } + + public static int getVerticalOffset() { + return Figure.SLOT_WIDTH - Figure.OVERLAPPING; + } + public Cluster getCluster() { if (getSource().getSourceNodes().size() == 0) { assert false : "Should never reach here, every figure must have at least one source node!"; return null; } else { - final InputBlock inputBlock = diagram.getGraph().getBlock(getSource().getSourceNodes().get(0)); + final InputBlock inputBlock = diagram.getGraph().getBlock(getFirstSourceNode()); assert inputBlock != null; Cluster result = diagram.getBlock(inputBlock); assert result != null; @@ -333,8 +402,8 @@ public class Figure extends Properties.Entity implements Source.Provider, Vertex public boolean isRoot() { List sourceNodes = source.getSourceNodes(); - if (sourceNodes.size() > 0 && sourceNodes.get(0).getProperties().get("name") != null) { - return source.getSourceNodes().get(0).getProperties().get("name").equals("Root"); + if (sourceNodes.size() > 0 && getFirstSourceNode().getProperties().get("name") != null) { + return getFirstSourceNode().getProperties().get("name").equals("Root"); } else { return false; } diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/FigureConnection.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/FigureConnection.java new file mode 100644 index 0000000000000000000000000000000000000000..0b64668816c11b88b26f66a2e87aa40096aaadfb --- /dev/null +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/FigureConnection.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.graph; + +import com.sun.hotspot.igv.layout.Port; +import com.sun.hotspot.igv.layout.Cluster; +import java.awt.Color; +import java.awt.Point; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Thomas Wuerthinger + */ +public class FigureConnection implements Connection { + + private final InputSlot inputSlot; + private final OutputSlot outputSlot; + private Color color; + private ConnectionStyle style; + private List controlPoints; + private String label; + + protected FigureConnection(InputSlot inputSlot, OutputSlot outputSlot, String label) { + this.inputSlot = inputSlot; + this.outputSlot = outputSlot; + this.label = label; + this.inputSlot.connections.add(this); + this.outputSlot.connections.add(this); + controlPoints = new ArrayList<>(); + Figure sourceFigure = this.outputSlot.getFigure(); + Figure destFigure = this.inputSlot.getFigure(); + sourceFigure.addSuccessor(destFigure); + destFigure.addPredecessor(sourceFigure); + + this.color = Color.BLACK; + this.style = ConnectionStyle.NORMAL; + } + + public InputSlot getInputSlot() { + return inputSlot; + } + + public OutputSlot getOutputSlot() { + return outputSlot; + } + + public Color getColor() { + return color; + } + + public ConnectionStyle getStyle() { + return style; + } + + public void setColor(Color c) { + color = c; + } + + public void setStyle(ConnectionStyle s) { + style = s; + } + + public String getLabel() { + return label; + } + + public void remove() { + inputSlot.getFigure().removePredecessor(outputSlot.getFigure()); + inputSlot.connections.remove(this); + outputSlot.getFigure().removeSuccessor(inputSlot.getFigure()); + outputSlot.connections.remove(this); + } + + public String getToolTipText() { + StringBuilder builder = new StringBuilder(); + if (label != null) { + builder.append(label).append(": "); + } + // Resolve strings lazily every time the tooltip is shown, instead of + // eagerly as for node labels, for efficiency. + String shortNodeText = getInputSlot().getFigure().getDiagram().getShortNodeText(); + builder.append(getOutputSlot().getFigure().getProperties().resolveString(shortNodeText)); + builder.append(" → "); + builder.append(getInputSlot().getFigure().getProperties().resolveString(shortNodeText)); + return builder.toString(); + } + + @Override + public String toString() { + return "FigureConnection('" + label + "', " + getFrom().getVertex() + " to " + getTo().getVertex() + ")"; + } + + @Override + public Port getFrom() { + return outputSlot; + } + + @Override + public Cluster getFromCluster() { + return getFrom().getVertex().getCluster(); + } + + @Override + public Port getTo() { + return inputSlot; + } + + @Override + public Cluster getToCluster() { + return getTo().getVertex().getCluster(); + } + + @Override + public boolean isVIP() { + return style == ConnectionStyle.BOLD; + } + + @Override + public List getControlPoints() { + return controlPoints; + } + + @Override + public void setControlPoints(List list) { + controlPoints = list; + } + + @Override + public boolean isAlwaysVisible() { + return false; + } + + @Override + public boolean hasSlots() { + return true; + } + +} + diff --git a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Slot.java b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Slot.java index 396db33859211a39645455d8f2cd264ddb63a853..bce5266e83d9ff722450e495c7fc5c8d23712494 100644 --- a/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Slot.java +++ b/src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Slot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +47,7 @@ public abstract class Slot implements Port, Source.Provider, Properties.Provider private int wantedIndex; private Source source; - protected List connections; + protected List connections; private InputNode associatedNode; private Color color; private String text; @@ -67,7 +67,7 @@ public abstract class Slot implements Port, Source.Provider, Properties.Provider @Override public Properties getProperties() { Properties p = new Properties(); - if (source.getSourceNodes().size() > 0) { + if (hasSourceNodes()) { for (InputNode n : source.getSourceNodes()) { p.add(n.getProperties()); } @@ -158,6 +158,10 @@ public abstract class Slot implements Port, Source.Provider, Properties.Provider return getShortName() != null && getShortName().length() > 0; } + public boolean hasSourceNodes() { + return !getSource().getSourceNodes().isEmpty(); + } + public void setText(String s) { if (s == null) { s = ""; @@ -178,13 +182,13 @@ public abstract class Slot implements Port, Source.Provider, Properties.Provider color = c; } - public List getConnections() { + public List getConnections() { return Collections.unmodifiableList(connections); } public void removeAllConnections() { - List connectionsCopy = new ArrayList<>(this.connections); - for (Connection c : connectionsCopy) { + List connectionsCopy = new ArrayList<>(this.connections); + for (FigureConnection c : connectionsCopy) { c.remove(); } } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterEdge.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterEdge.java index 474cef1ddcac2e1c582eabaf1f9cee56a05fba34..b243b88d194e25f7ce80394de7fdf8ffc38171dd 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterEdge.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterEdge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.hierarchicallayout; import com.sun.hotspot.igv.layout.Link; import com.sun.hotspot.igv.layout.Port; +import com.sun.hotspot.igv.layout.Cluster; import java.awt.Point; import java.util.List; @@ -53,6 +54,14 @@ public class ClusterEdge implements Link { return from.getInputSlot(); } + public Cluster getFromCluster() { + return from.getCluster(); + } + + public Cluster getToCluster() { + return to.getCluster(); + } + public void setControlPoints(List p) { this.points = p; } @@ -64,4 +73,9 @@ public class ClusterEdge implements Link { public boolean isVIP() { return false; } + + @Override + public String toString() { + return from + "->" + to; + } } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java index e181c669118ded1d6765a78a3a21f1d2f1c3c3bc..db8b4c7257cd7df8a06908cd6f26518aa70778fd 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.hierarchicallayout; import com.sun.hotspot.igv.layout.Link; import com.sun.hotspot.igv.layout.Port; +import com.sun.hotspot.igv.layout.Cluster; import java.awt.Point; import java.util.ArrayList; import java.util.List; @@ -66,6 +67,14 @@ public class ClusterIngoingConnection implements Link { return outputSlot; } + public Cluster getFromCluster() { + return null; + } + + public Cluster getToCluster() { + return null; + } + public void setControlPoints(List p) { this.controlPoints = p; } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterInputSlotNode.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterInputSlotNode.java index aae46cb629e4751927128c2fe7577e42cc9b771b..c398a6e3d74ffe1a0da4934965696feb0e708f24 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterInputSlotNode.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterInputSlotNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ public class ClusterInputSlotNode implements Vertex { public Point getRelativePosition() { Point p = new Point(thisNode.getPosition()); - p.x += ClusterNode.BORDER; + p.x += blockNode.getBorder(); p.y = 0; return p; } @@ -142,4 +142,5 @@ public class ClusterInputSlotNode implements Vertex { public int compareTo(Vertex o) { return toString().compareTo(o.toString()); } + } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java index 36937e0622bb7853a057d0fabb3f3a9ff621f9e0..0a6631c72f3dfdd5360cc2092d4103508873207d 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,14 +51,34 @@ public class ClusterNode implements Vertex { private boolean dirty; private boolean root; private String name; - public static final int BORDER = 20; - - public ClusterNode(Cluster cluster, String name) { + private final int border; + private final Dimension nodeOffset; + private final int headerVerticalSpace; + private final Dimension emptySize; + + public ClusterNode(Cluster cluster, String name, int border, + Dimension nodeOffset, int headerVerticalSpace, + Dimension emptySize) { this.subNodes = new HashSet(); this.subEdges = new HashSet(); this.cluster = cluster; position = new Point(0, 0); this.name = name; + this.border = border; + this.nodeOffset = nodeOffset; + this.headerVerticalSpace = headerVerticalSpace; + this.emptySize = emptySize; + if (emptySize.width > 0 || emptySize.height > 0) { + updateSize(); + } + } + + public ClusterNode(Cluster cluster, String name) { + this(cluster, name, 20, new Dimension(0, 0), 0, new Dimension(0, 0)); + } + + public String getName() { + return name; } public void addSubNode(Vertex v) { @@ -88,6 +108,11 @@ public class ClusterNode implements Vertex { public Vertex getVertex() { return widget; } + + @Override + public String toString() { + return "ClusterInput(" + name + ")"; + } }; outputSlot = new Port() { @@ -99,13 +124,19 @@ public class ClusterNode implements Vertex { public Vertex getVertex() { return widget; } + + @Override + public String toString() { + return "ClusterOutput(" + name + ")"; + } }; } private void calculateSize() { - if (subNodes.size() == 0) { - size = new Dimension(0, 0); + if (subNodes.isEmpty()) { + size = emptySize; + return; } int minX = Integer.MAX_VALUE; @@ -134,11 +165,12 @@ public class ClusterNode implements Vertex { } } - size = new Dimension(maxX - minX, maxY - minY); + size = new Dimension(maxX - minX, maxY - minY + headerVerticalSpace); // Normalize coordinates for (Vertex n : subNodes) { - n.setPosition(new Point(n.getPosition().x - minX, n.getPosition().y - minY)); + n.setPosition(new Point(n.getPosition().x - minX + nodeOffset.width, + n.getPosition().y - minY + nodeOffset.height + headerVerticalSpace)); } for (Link l : subEdges) { @@ -151,8 +183,8 @@ public class ClusterNode implements Vertex { } - size.width += 2 * BORDER; - size.height += 2 * BORDER; + size.width += 2 * border; + size.height += 2 * border; } public Port getInputSlot() { @@ -177,7 +209,7 @@ public class ClusterNode implements Vertex { this.position = pos; for (Vertex n : subNodes) { Point cur = new Point(n.getPosition()); - cur.translate(pos.x + BORDER, pos.y + BORDER); + cur.translate(pos.x + border, pos.y + border); n.setPosition(cur); } @@ -187,7 +219,7 @@ public class ClusterNode implements Vertex { for (Point p : arr) { if (p != null) { Point p2 = new Point(p); - p2.translate(pos.x + BORDER, pos.y + BORDER); + p2.translate(pos.x + border, pos.y + border); newArr.add(p2); } else { newArr.add(null); @@ -218,6 +250,10 @@ public class ClusterNode implements Vertex { return root; } + public int getBorder() { + return border; + } + public int compareTo(Vertex o) { return toString().compareTo(o.toString()); } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java index 2f5bce16883839061dfe1af658825b448c533f14..9848bb5861853a1eff8e6a658e7a3b5e2f8b98f5 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.hierarchicallayout; import com.sun.hotspot.igv.layout.Link; import com.sun.hotspot.igv.layout.Port; +import com.sun.hotspot.igv.layout.Cluster; import java.awt.Point; import java.util.ArrayList; import java.util.List; @@ -58,6 +59,14 @@ public class ClusterOutgoingConnection implements Link { return outputSlot; } + public Cluster getFromCluster() { + return null; + } + + public Cluster getToCluster() { + return null; + } + public void setControlPoints(List p) { this.intermediatePoints = p; } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java index d0240ce5cd503bb46231629e18857007b08b80d9..52a334ec4f3230736f04fa865fc14f0500140128 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ public class ClusterOutputSlotNode implements Vertex { public Point getRelativePosition() { Point p = new Point(thisNode.getPosition()); - p.x += ClusterNode.BORDER; + p.x += blockNode.getBorder(); p.y = 0;//thisBlockNode.getSize().height; return p; } @@ -142,4 +142,5 @@ public class ClusterOutputSlotNode implements Vertex { public int compareTo(Vertex o) { return toString().compareTo(o.toString()); } + } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalCFGLayoutManager.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalCFGLayoutManager.java new file mode 100644 index 0000000000000000000000000000000000000000..58322aa171f80b408e307e179d7aa53efe65ac72 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalCFGLayoutManager.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.hierarchicallayout; + +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.Canvas; +import java.awt.Font; +import java.awt.FontMetrics; +import java.util.*; +import com.sun.hotspot.igv.layout.Cluster; +import com.sun.hotspot.igv.layout.LayoutGraph; +import com.sun.hotspot.igv.layout.LayoutManager; +import com.sun.hotspot.igv.layout.Link; +import com.sun.hotspot.igv.layout.Vertex; + +public class HierarchicalCFGLayoutManager implements LayoutManager { + + private static final int BLOCK_BORDER = 5; + private FontMetrics fontMetrics; + // Lays out nodes within a single cluster (basic block). + private LayoutManager subManager; + // Lays out clusters in the CFG. + private LayoutManager manager; + private Set clusters; + + public HierarchicalCFGLayoutManager() { + // Anticipate block label sizes to dimension blocks appropriately. + Canvas canvas = new Canvas(); + Font font = new Font("Arial", Font.BOLD, 14); + fontMetrics = canvas.getFontMetrics(font); + } + + public void setSubManager(LayoutManager manager) { + this.subManager = manager; + } + + public void setManager(LayoutManager manager) { + this.manager = manager; + } + + public void setClusters(Set clusters) { + this.clusters = clusters; + } + + public void doLayout(LayoutGraph graph, Set importantLinks) { + doLayout(graph); + } + + public void doLayout(LayoutGraph graph) { + + // Create cluster-level nodes and edges. + Map clusterNode = createClusterNodes(graph); + Set clusterEdges = createClusterEdges(clusterNode); + markRootClusters(clusterEdges); + + // Compute layout for each cluster. + for (Cluster c : clusters) { + ClusterNode n = clusterNode.get(c); + subManager.doLayout(new LayoutGraph(n.getSubEdges(), n.getSubNodes()), new HashSet()); + n.updateSize(); + } + + // Compute inter-cluster layout. + manager.doLayout(new LayoutGraph(clusterEdges, new HashSet<>(clusterNode.values())), + new HashSet()); + + // Write back results. + writeBackClusterBounds(clusterNode); + writeBackClusterEdgePoints(graph, clusterEdges); + } + + private Map createClusterNodes(LayoutGraph graph) { + Map clusterNode = new HashMap<>(); + for (Cluster c : clusters) { + String blockLabel = "B" + c; + Dimension emptySize = new Dimension(fontMetrics.stringWidth(blockLabel) + BLOCK_BORDER * 2, + fontMetrics.getHeight() + BLOCK_BORDER); + ClusterNode cn = new ClusterNode(c, c.toString(), BLOCK_BORDER, c.getNodeOffset(), + fontMetrics.getHeight(), emptySize); + clusterNode.put(c, cn); + } + + for (Vertex v : graph.getVertices()) { + Cluster c = v.getCluster(); + assert c != null : "Cluster of vertex " + v + " is null!"; + clusterNode.get(c).addSubNode(v); + } + return clusterNode; + } + + private Set createClusterEdges(Map clusterNode) { + Set clusterEdges = new HashSet<>(); + for (Cluster c : clusters) { + ClusterNode start = clusterNode.get(c); + for (Cluster succ : c.getSuccessors()) { + ClusterNode end = clusterNode.get(succ); + if (end != null) { + ClusterEdge e = new ClusterEdge(start, end); + clusterEdges.add(e); + } + } + } + return clusterEdges; + } + + private void markRootClusters(Set clusterEdges) { + Set roots = new LayoutGraph(clusterEdges).findRootVertices(); + for (Vertex v : roots) { + assert v instanceof ClusterNode; + ((ClusterNode) v).setRoot(true); + } + } + + private void writeBackClusterBounds(Map clusterNode) { + for (Cluster c : clusters) { + ClusterNode n = clusterNode.get(c); + c.setBounds(new Rectangle(n.getPosition(), n.getSize())); + } + } + + private void writeBackClusterEdgePoints(LayoutGraph graph, Set clusterEdges) { + // Map from "primitive" cluster edges to their input links. + Map, Link> inputLink = new HashMap<>(); + for (Link l : graph.getLinks()) { + inputLink.put(new AbstractMap.SimpleEntry(l.getFromCluster(), l.getToCluster()), l); + } + for (ClusterEdge ce : clusterEdges) { + assert (ce.getControlPoints() != null); + Link l = inputLink.get(new AbstractMap.SimpleEntry(ce.getFromCluster(), ce.getToCluster())); + l.setControlPoints(ce.getControlPoints()); + } + } +} diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java index fac6b94e010c2e0d440b8460b248e20286ac9a9b..5adb982659ddb18f3b319c4cc39d49324f2eb15c 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java @@ -245,7 +245,4 @@ public class HierarchicalClusterLayoutManager implements LayoutManager { } } } - - public void doRouting(LayoutGraph graph) { - } } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java index 3cd7fc9d7e11a39227ec534183e681410e7c89da..d76b681eed5427b509f632aca28222ae69e9cc0c 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,8 +63,10 @@ public class HierarchicalLayoutManager implements LayoutManager { private int layerOffset; private int maxLayerLength; private int minLayerDifference; + private boolean layoutSelfEdges; // Algorithm global datastructures private Set reversedLinks; + private Set selfEdges; private List nodes; private HashMap vertexToLayoutNode; private HashMap> reversedLinkStartPoints; @@ -108,10 +110,17 @@ public class HierarchicalLayoutManager implements LayoutManager { public LayoutNode from; public LayoutNode to; + // Horizontal distance relative to start of 'from'. public int relativeFrom; + // Horizontal distance relative to start of 'to'. public int relativeTo; public Link link; public boolean vip; + + @Override + public String toString() { + return "Edge " + from + ", " + to; + } } private abstract class AlgorithmPart { @@ -162,9 +171,18 @@ public class HierarchicalLayoutManager implements LayoutManager { this.layerOffset = LAYER_OFFSET; this.maxLayerLength = MAX_LAYER_LENGTH; this.minLayerDifference = MIN_LAYER_DIFFERENCE; + this.layoutSelfEdges = false; this.linksToFollow = new HashSet<>(); } + public void setXOffset(int xOffset) { + this.xOffset = xOffset; + } + + public void setLayerOffset(int layerOffset) { + this.layerOffset = layerOffset; + } + public int getMaxLayerLength() { return maxLayerLength; } @@ -177,6 +195,25 @@ public class HierarchicalLayoutManager implements LayoutManager { minLayerDifference = v; } + public void setLayoutSelfEdges(boolean layoutSelfEdges) { + this.layoutSelfEdges = layoutSelfEdges; + } + + // Remove self-edges, possibly saving them into the selfEdges set. + private void removeSelfEdges(boolean save) { + for (LayoutNode node : nodes) { + for (LayoutEdge e : new ArrayList<>(node.succs)) { + if (e.to == node) { + if (save) { + selfEdges.add(e); + } + node.succs.remove(e); + node.preds.remove(e); + } + } + } + } + @Override public void doLayout(LayoutGraph graph) { doLayout(graph, new HashSet()); @@ -191,6 +228,7 @@ public class HierarchicalLayoutManager implements LayoutManager { vertexToLayoutNode = new HashMap<>(); reversedLinks = new HashSet<>(); + selfEdges = new HashSet<>(); reversedLinkStartPoints = new HashMap<>(); reversedLinkEndPoints = new HashMap<>(); bottomEdgeHash = new HashMap<>(); @@ -202,6 +240,11 @@ public class HierarchicalLayoutManager implements LayoutManager { // Step 1: Build up data structure new BuildDatastructure().start(); + if (!layoutSelfEdges) { + // Remove self-edges from the beginning. + removeSelfEdges(false); + } + // ############################################################# // STEP 2: Reverse edges, handle backedges new ReverseEdges().start(); @@ -220,6 +263,9 @@ public class HierarchicalLayoutManager implements LayoutManager { } } + // Hide self-edges from the layout algorithm and save them for later. + removeSelfEdges(true); + // ############################################################# // STEP 3: Assign layers new AssignLayers().start(); @@ -240,6 +286,12 @@ public class HierarchicalLayoutManager implements LayoutManager { // STEP 6: Assign Y coordinates new AssignYCoordinates().start(); + // Put saved self-edges back so that they are assigned points. + for (LayoutEdge e : selfEdges) { + e.from.succs.add(e); + e.to.preds.add(e); + } + // ############################################################# // STEP 8: Write back to interface new WriteResult().start(); @@ -322,6 +374,11 @@ public class HierarchicalLayoutManager implements LayoutManager { } else { if (reversedLinks.contains(e.link)) { Collections.reverse(points); + if (selfEdges.contains(e)) { + // For self edges, it is enough with the + // start and end points computed by ReverseEdges. + points.clear(); + } } if (reversedLinkStartPoints.containsKey(e.link)) { for (Point p1 : reversedLinkStartPoints.get(e.link)) { @@ -351,7 +408,11 @@ public class HierarchicalLayoutManager implements LayoutManager { Point p = new Point(e.from.x + e.relativeFrom, e.from.y + e.from.height - e.from.bottomYOffset + e.link.getFrom().getRelativePosition().y); points.add(p); if (e.from.outOffsets.containsKey(e.relativeFrom)) { - points.add(new Point(p.x, p.y + e.from.outOffsets.get(e.relativeFrom) + e.link.getFrom().getRelativePosition().y)); + Point pOffset = new Point(p.x, p.y + e.from.outOffsets.get(e.relativeFrom) + + e.link.getFrom().getRelativePosition().y + e.from.yOffset); + if (!pOffset.equals(p)) { + points.add(pOffset); + } } LayoutNode cur = e.to; @@ -404,12 +465,12 @@ public class HierarchicalLayoutManager implements LayoutManager { if (reversedLinkStartPoints.containsKey(e.link)) { for (Point p1 : reversedLinkStartPoints.get(e.link)) { - points.add(0, new Point(p1.x + other.x, p1.y + other.y)); + points.add(0, new Point(p1.x + other.x + other.xOffset, p1.y + other.y)); } } if (reversedLinkEndPoints.containsKey(e.link)) { for (Point p1 : reversedLinkEndPoints.get(e.link)) { - points.add(new Point(p1.x + cur.x, p1.y + cur.y)); + points.add(new Point(p1.x + cur.x + cur.xOffset, p1.y + cur.y)); } } if (reversedLinks.contains(e.link)) { @@ -879,7 +940,7 @@ public class HierarchicalLayoutManager implements LayoutManager { for (LayoutNode n : layers[index]) { n.x = x; - x += n.width + X_OFFSET; + x += n.width + xOffset; } } @@ -1446,18 +1507,6 @@ public class HierarchicalLayoutManager implements LayoutManager { @Override protected void run() { - // Remove self-edges - for (LayoutNode node : nodes) { - ArrayList succs = new ArrayList<>(node.succs); - for (LayoutEdge e : succs) { - assert e.from == node; - if (e.to == node) { - node.succs.remove(e); - node.preds.remove(e); - } - } - } - // Reverse inputs of roots for (LayoutNode node : nodes) { if (node.vertex.isRoot()) { @@ -1485,17 +1534,27 @@ public class HierarchicalLayoutManager implements LayoutManager { SortedSet reversedDown = new TreeSet<>(); + boolean hasSelfEdge = false; for (LayoutEdge e : node.succs) { if (reversedLinks.contains(e.link)) { reversedDown.add(e.relativeFrom); + if (e.from == e.to) { + hasSelfEdge = true; + } } } + // Whether the node has non-self reversed edges going downwards. + // If so, reversed edges going upwards are drawn to the left. + boolean hasReversedDown = + reversedDown.size() > 0 && + !(reversedDown.size() == 1 && hasSelfEdge); + SortedSet reversedUp = null; - if (reversedDown.size() == 0) { - reversedUp = new TreeSet<>(Collections.reverseOrder()); - } else { + if (hasReversedDown) { reversedUp = new TreeSet<>(); + } else { + reversedUp = new TreeSet<>(Collections.reverseOrder()); } for (LayoutEdge e : node.preds) { @@ -1504,7 +1563,7 @@ public class HierarchicalLayoutManager implements LayoutManager { } } - final int offset = X_OFFSET + DUMMY_WIDTH; + final int offset = xOffset + DUMMY_WIDTH; int curX = 0; int curWidth = node.width + reversedDown.size() * offset; @@ -1531,17 +1590,22 @@ public class HierarchicalLayoutManager implements LayoutManager { node.yOffset += offset; curWidth -= offset; } - node.width += reversedDown.size() * offset; - if (reversedDown.size() == 0) { - curX = offset; - } else { + int widthFactor = reversedDown.size(); + if (hasSelfEdge) { + widthFactor--; + } + node.width += widthFactor * offset; + + if (hasReversedDown) { curX = -offset; + } else { + curX = offset; } curX = 0; int minX = 0; - if (reversedDown.size() != 0) { + if (hasReversedDown) { minX = -offset * reversedUp.size(); } @@ -1550,10 +1614,10 @@ public class HierarchicalLayoutManager implements LayoutManager { ArrayList reversedPreds = new ArrayList<>(); for (LayoutEdge e : node.preds) { if (e.relativeTo == pos && reversedLinks.contains(e.link)) { - if (reversedDown.size() == 0) { - e.relativeTo = node.width + offset; - } else { + if (hasReversedDown) { e.relativeTo = curX - offset; + } else { + e.relativeTo = node.width + offset; } reversedPreds.add(e); @@ -1562,16 +1626,13 @@ public class HierarchicalLayoutManager implements LayoutManager { node.height += offset; ArrayList endPoints = new ArrayList<>(); - if (reversedDown.size() == 0) { - - curX += offset; - node.width += offset; - endPoints.add(new Point(node.width, node.height)); - - } else { + node.width += offset; + if (hasReversedDown) { curX -= offset; - node.width += offset; endPoints.add(new Point(curX, node.height)); + } else { + curX += offset; + endPoints.add(new Point(node.width, node.height)); } node.outOffsets.put(pos - minX, curX); @@ -1735,7 +1796,12 @@ public class HierarchicalLayoutManager implements LayoutManager { protected void run() { // Set up nodes List vertices = new ArrayList<>(graph.getVertices()); - Collections.sort(vertices); + // Order roots first to create more natural layer assignments. + Collections.sort(vertices, + (Vertex a, Vertex b) -> + a.isRoot() == b.isRoot() ? + a.compareTo(b) : + Boolean.compare(b.isRoot(), a.isRoot())); for (Vertex v : vertices) { LayoutNode node = new LayoutNode(); @@ -1762,7 +1828,6 @@ public class HierarchicalLayoutManager implements LayoutManager { edge.vip = l.isVIP(); edge.from.succs.add(edge); edge.to.preds.add(edge); - //assert edge.from != edge.to; // No self-loops allowed } for (Link l : importantLinks) { @@ -1802,9 +1867,4 @@ public class HierarchicalLayoutManager implements LayoutManager { } } } - - @Override - public void doRouting(LayoutGraph graph) { - // Do nothing for now - } } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java index 3599434217a459d53950eab210fb7b1da380ba2e..2019263b6ecce4459b15f2dc23a587c625a94b07 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.hierarchicallayout; import com.sun.hotspot.igv.layout.Link; import com.sun.hotspot.igv.layout.Port; +import com.sun.hotspot.igv.layout.Cluster; import java.awt.Point; import java.util.ArrayList; import java.util.List; @@ -61,6 +62,14 @@ public class InterClusterConnection implements Link { return outputSlot; } + public Cluster getFromCluster() { + return null; + } + + public Cluster getToCluster() { + return null; + } + public void setControlPoints(List p) { this.intermediatePoints = p; } diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LinearLayoutManager.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LinearLayoutManager.java new file mode 100644 index 0000000000000000000000000000000000000000..b52631f2861c66970a7461e506d170095711041f --- /dev/null +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LinearLayoutManager.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.hierarchicallayout; + +import com.sun.hotspot.igv.layout.LayoutGraph; +import com.sun.hotspot.igv.layout.LayoutManager; +import com.sun.hotspot.igv.layout.Link; +import com.sun.hotspot.igv.layout.Vertex; +import java.awt.Point; +import java.util.*; + +public class LinearLayoutManager implements LayoutManager { + + // Ranking determining the vertical node ordering. + private final Map vertexRank; + + public LinearLayoutManager(Map vertexRank) { + this.vertexRank = vertexRank; + } + + @Override + public void doLayout(LayoutGraph graph) { + doLayout(graph, new HashSet()); + } + + @Override + public void doLayout(LayoutGraph graph, Set importantLinks) { + + assert (graph.getLinks().isEmpty()); + + // Sort vertices according to given rank. + List vertices = new ArrayList<>(graph.getVertices()); + vertices.sort(Comparator.comparingInt((Vertex v) -> vertexRank.getOrDefault(v, Integer.MAX_VALUE))); + + // Assign vertical coordinates in rank order. + assignVerticalCoordinates(vertices); + } + + private void assignVerticalCoordinates(List vertices) { + int curY = 0; + for (Vertex v : vertices) { + v.setPosition(new Point(0, curY)); + curY += v.getSize().getHeight(); + } + } +} diff --git a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Cluster.java b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Cluster.java index 31ac1a6a1c237fd91bcf46729198fde6a9ed204f..2cf31b60d8ee08e5994fa1d331d0a6d3b7da297f 100644 --- a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Cluster.java +++ b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Cluster.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ */ package com.sun.hotspot.igv.layout; +import java.awt.Dimension; import java.awt.Rectangle; import java.util.Set; @@ -37,4 +38,6 @@ public interface Cluster extends Comparable { public void setBounds(Rectangle r); public Set getSuccessors(); + + public Dimension getNodeOffset(); } diff --git a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutGraph.java b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutGraph.java index 3a8da0d649c28138246336c6449a6cfef631b1ca..0409aa82d10fff8ce19159f968a916f548516b78 100644 --- a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutGraph.java +++ b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutGraph.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,9 @@ public class LayoutGraph { outputPorts = new HashMap<>(links.size()); for (Link l : links) { + if (l.getFrom() == null || l.getTo() == null) { + continue; + } Port p = l.getFrom(); Port p2 = l.getTo(); Vertex v1 = p.getVertex(); @@ -195,4 +198,9 @@ public class LayoutGraph { return clusters; } + + @Override + public String toString() { + return "LayoutGraph(" + vertices + ", " + links + ", " + getClusters() + ")"; + } } diff --git a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutManager.java b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutManager.java index cca19fa28b62d77ecf2f1a7d83f2acbd8961663e..8ae848b4d04a8d4d7e032f8a06547ffc518f299b 100644 --- a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutManager.java +++ b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/LayoutManager.java @@ -34,6 +34,4 @@ public interface LayoutManager { public void doLayout(LayoutGraph graph); public void doLayout(LayoutGraph graph, Set importantLinks); - - public void doRouting(LayoutGraph graph); } diff --git a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Link.java b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Link.java index 7f58b607f4321992eed04a58bc40387add08319d..f6fa2a868c2b818de0f1cc87515df3da29dfc3d1 100644 --- a/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Link.java +++ b/src/utils/IdealGraphVisualizer/Layout/src/main/java/com/sun/hotspot/igv/layout/Link.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 +34,12 @@ public interface Link { public Port getFrom(); + public Cluster getFromCluster(); + public Port getTo(); + public Cluster getToCluster(); + public boolean isVIP(); public List getControlPoints(); diff --git a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java index 5e4f6d0fc489aa28afa952b13c7c06a75ef44dba..09ef77818e919184a1e9d88df9351da8a6c67cda 100644 --- a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java +++ b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java @@ -30,6 +30,7 @@ import com.sun.hotspot.igv.data.InputGraph; import com.sun.hotspot.igv.data.InputNode; import com.sun.hotspot.igv.data.services.Scheduler; import java.util.*; +import java.util.function.Predicate; import org.openide.ErrorManager; import org.openide.util.lookup.ServiceProvider; import com.ibm.wala.util.graph.Graph; @@ -52,6 +53,38 @@ public class ServerCompilerScheduler implements Scheduler { public boolean isBlockProjection; public boolean isBlockStart; public boolean isCFG; + public int rank; // Rank for local scheduling priority. + + public Node(InputNode n) { + inputNode = n; + String p = n.getProperties().get("is_block_proj"); + isBlockProjection = (p != null && p.equals("true")); + p = n.getProperties().get("is_block_start"); + isBlockStart = (p != null && p.equals("true")); + computeRank(); + } + + // Rank by local scheduling priority. + private void computeRank() { + if (isBlockStart || isOtherBlockStart(this)) { + rank = 1; + } else if (isPhi(this)) { + rank = 2; + } else if (isParm(this)) { + rank = 3; + } else if (isProj(this)) { + rank = 4; + } else if (!isControl(this)) { // Every other node except terminators. + rank = 5; + } else { + rank = 6; + } + } + + @Override + public String toString() { + return inputNode.getProperties().get("idx") + " " + inputNode.getProperties().get("name"); + } } private InputGraph graph; private Collection nodes; @@ -80,15 +113,17 @@ public class ServerCompilerScheduler implements Scheduler { Set visited = new HashSet<>(); Map> terminators = new HashMap<>(); // Pre-compute control successors of each node, excluding self edges. - Map> controlSuccs = new HashMap<>(); + Map> controlSuccs = new HashMap<>(); for (Node n : nodes) { if (n.isCFG) { - Set nControlSuccs = new HashSet<>(); + List nControlSuccs = new ArrayList<>(); for (Node s : n.succs) { if (s.isCFG && s != n) { nControlSuccs.add(s); } } + // Ensure that the block ordering is deterministic. + nControlSuccs.sort(Comparator.comparingInt((Node a) -> a.inputNode.getId())); controlSuccs.put(n, nControlSuccs); } } @@ -173,7 +208,18 @@ public class ServerCompilerScheduler implements Scheduler { } } for (Node s : uniqueSuccs) { - graph.addBlockEdge(terms.getKey(), s.block); + // Label the block edge with the short name of the corresponding + // control projection, if any. + String label = null; + if (terms.getValue().size() > 1) { + for (Node t : terms.getValue()) { + if (s.preds.contains(t)) { + label = t.inputNode.getProperties().get("short_name"); + break; + } + } + } + graph.addBlockEdge(terms.getKey(), s.block, label); } } @@ -237,7 +283,7 @@ public class ServerCompilerScheduler implements Scheduler { for (InputNode n : graph.getNodes()) { if (graph.getBlock(n) == null) { if (noBlock == null) { - noBlock = graph.addBlock("(no block)"); + noBlock = graph.addArtificialBlock(); blocks.add(noBlock); } @@ -246,10 +292,104 @@ public class ServerCompilerScheduler implements Scheduler { assert graph.getBlock(n) != null; } + scheduleLocal(); + return blocks; } } + private void scheduleLocal() { + // Leave only local predecessors and successors. + for (InputBlock b : blocks) { + for (InputNode in : b.getNodes()) { + Node n = inputNodeToNode.get(in); + Predicate excludePredecessors = + node -> isPhi(node) || node.isBlockStart; + List localPreds = new ArrayList<>(n.preds.size()); + for (Node p : n.preds) { + if (p.block == b && p != n && !excludePredecessors.test(n)) { + localPreds.add(p); + } + } + n.preds = localPreds; + Set localSuccs = new HashSet<>(n.succs.size()); + for (Node s : n.succs) { + if (s.block == b && s != n && !excludePredecessors.test(s)) { + localSuccs.add(s); + } + } + n.succs = localSuccs; + } + } + // Schedule each block independently. + for (InputBlock b : blocks) { + List nodes = new ArrayList<>(b.getNodes().size()); + for (InputNode n : b.getNodes()) { + nodes.add(inputNodeToNode.get(n)); + } + List schedule = scheduleBlock(nodes); + b.setNodes(schedule); + } + } + + private static final Comparator schedulePriority = new Comparator(){ + @Override + public int compare(Node n1, Node n2) { + // Order by rank, then idx. + int r1 = n1.rank, r2 = n2.rank; + int o1, o2; + if (r1 != r2) { // Different rank. + o1 = r1; + o2 = r2; + } else { // Same rank, order by idx. + o1 = Integer.parseInt(n1.inputNode.getProperties().get("idx")); + o2 = Integer.parseInt(n2.inputNode.getProperties().get("idx")); + } + return Integer.compare(o1, o2); + }; + }; + + private List scheduleBlock(Collection nodes) { + List schedule = new ArrayList(); + + // Initialize ready priority queue with nodes without predecessors. + Queue ready = new PriorityQueue(schedulePriority); + // Set of nodes that have been enqueued. + Set visited = new HashSet(nodes.size()); + for (Node n : nodes) { + if (n.preds.isEmpty()) { + ready.add(n); + visited.add(n); + } + } + + // Classic list scheduling algorithm. + while (!ready.isEmpty()) { + Node n = ready.remove(); + schedule.add(n.inputNode); + + // Add nodes that are now ready after scheduling n. + for (Node s : n.succs) { + if (visited.contains(s)) { + continue; + } + boolean allPredsScheduled = true; + for (Node p : s.preds) { + if (!visited.contains(p)) { + allPredsScheduled = false; + break; + } + } + if (allPredsScheduled) { + ready.add(s); + visited.add(s); + } + } + } + assert(schedule.size() == nodes.size()); + return schedule; + } + private void scheduleLatest() { Node root = findRoot(); if(root == null) { @@ -426,12 +566,32 @@ public class ServerCompilerScheduler implements Scheduler { } } - private boolean isRegion(Node n) { - return n.inputNode.getProperties().get("name").equals("Region"); + private static boolean isOtherBlockStart(Node n) { + return hasName(n, "CountedLoopEnd"); + } + + private static boolean isPhi(Node n) { + return hasName(n, "Phi"); } - private boolean isPhi(Node n) { - return n.inputNode.getProperties().get("name").equals("Phi"); + private static boolean isProj(Node n) { + return hasName(n, "Proj") || hasName(n, "MachProj"); + } + + private static boolean isParm(Node n) { + return hasName(n, "Parm"); + } + + private static boolean hasName(Node n, String name) { + String nodeName = n.inputNode.getProperties().get("name"); + if (nodeName == null) { + return false; + } + return nodeName.equals(name); + } + + private static boolean isControl(Node n) { + return n.inputNode.getProperties().get("category").equals("control"); } private Node findRoot() { @@ -439,9 +599,7 @@ public class ServerCompilerScheduler implements Scheduler { Node alternativeRoot = null; for (Node node : nodes) { - InputNode inputNode = node.inputNode; - String s = inputNode.getProperties().get("name"); - if (s != null && s.equals("Root")) { + if (hasName(node, "Root")) { return node; } @@ -473,13 +631,8 @@ public class ServerCompilerScheduler implements Scheduler { public void buildUpGraph() { for (InputNode n : graph.getNodes()) { - Node node = new Node(); - node.inputNode = n; + Node node = new Node(n); nodes.add(node); - String p = n.getProperties().get("is_block_proj"); - node.isBlockProjection = (p != null && p.equals("true")); - p = n.getProperties().get("is_block_start"); - node.isBlockStart = (p != null && p.equals("true")); inputNodeToNode.put(n, node); } diff --git a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideExceptionBlocks.filter b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideExceptionBlocks.filter new file mode 100644 index 0000000000000000000000000000000000000000..f9e0ae0ee21d33953a68e9221e39cea17ff88887 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideExceptionBlocks.filter @@ -0,0 +1,18 @@ +// Hide exception blocks. + +var f = new RemoveBlockFilter("Hide exception blocks"); +f.addRule( + new RemoveBlockFilter.RemoveBlockRule( + new AnySelector( + new OrSelector( + new MatcherSelector( + new Properties.StringPropertyMatcher("name", "Rethrow") + ), + new MatcherSelector( + new Properties.StringPropertyMatcher("name", "RethrowException") + ) + ) + ) + ) +); +f.apply(graph); diff --git a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideRootBlock.filter b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideRootBlock.filter new file mode 100644 index 0000000000000000000000000000000000000000..5c78ed09403936a63a01028f09fdd717f426b017 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideRootBlock.filter @@ -0,0 +1,13 @@ +// Remove root block and all nodes in it (hopefully just the Root node). + +var f = new RemoveBlockFilter("Hide root block"); +f.addRule( + new RemoveBlockFilter.RemoveBlockRule( + new AnySelector( + new MatcherSelector( + new Properties.RegexpPropertyMatcher("name", "Root") + ) + ) + ) +); +f.apply(graph); diff --git a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideUncommonTrapBlocks.filter b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideUncommonTrapBlocks.filter new file mode 100644 index 0000000000000000000000000000000000000000..10f91038ed75abf0ed895ece78ef033dcaaf2aa4 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/hideUncommonTrapBlocks.filter @@ -0,0 +1,13 @@ +// Hide uncommon trap blocks. + +var f = new RemoveBlockFilter("Hide uncommon trap blocks"); +f.addRule( + new RemoveBlockFilter.RemoveBlockRule( + new AnySelector( + new MatcherSelector( + new Properties.RegexpPropertyMatcher("dump_spec", ".*uncommon_trap.*") + ) + ) + ) +); +f.apply(graph); diff --git a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/layer.xml b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/layer.xml index 6ad622863e3d5bbd71989969bf354939ab59f598..a4c54d91520ca713aef74231251f671997445dd0 100644 --- a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/layer.xml +++ b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/layer.xml @@ -57,5 +57,17 @@ + + + + + + + + + + + + diff --git a/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/Settings.java b/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/Settings.java index 4dc7f247f5f5391c0fb590a119296924c80b2b40..6373d5131204a5fa5bad06dbb17f112e98296e1f 100644 --- a/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/Settings.java +++ b/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/Settings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. * 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,12 +32,20 @@ import java.util.prefs.Preferences; */ public class Settings { + public static class DefaultView { + public static final int SEA_OF_NODES = 0; + public static final int CLUSTERED_SEA_OF_NODES = 1; + public static final int CONTROL_FLOW_GRAPH = 2; + } + public static final String NODE_TEXT = "nodeText"; public static final String NODE_TEXT_DEFAULT = "[idx] [name]"; public static final String NODE_SHORT_TEXT = "nodeShortText"; public static final String NODE_SHORT_TEXT_DEFAULT = "[idx] [name]"; - public static final String NODE_WIDTH = "nodeWidth"; - public static final String NODE_WIDTH_DEFAULT = "100"; + public static final String NODE_TINY_TEXT = "nodeTinyText"; + public static final String NODE_TINY_TEXT_DEFAULT = "[idx]"; + public static final String DEFAULT_VIEW = "defaultView"; + public static final int DEFAULT_VIEW_DEFAULT = DefaultView.SEA_OF_NODES; public static final String PORT = "port"; public static final String PORT_BINARY = "portBinary"; public static final String PORT_DEFAULT = "4444"; diff --git a/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.form b/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.form index 4af5c664d29146584fe6b5ca2fc24b0f1a91b4e7..75240c9a150daa802db0c712dfc1d4a3e4b1b5d5 100644 --- a/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.form +++ b/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.form @@ -28,7 +28,7 @@ - + @@ -46,19 +46,17 @@ + - - - - - - - - - + + + + + + - + @@ -77,8 +75,13 @@ - + + + + + + @@ -97,7 +100,7 @@ - + @@ -118,8 +121,6 @@ - - @@ -141,6 +142,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.java b/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.java index 2aff72d0440d2e8c8ca40748addf16d7349529d5..c2293820c31bab4f9b2f95662abcf1a9012f0963 100644 --- a/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.java +++ b/src/utils/IdealGraphVisualizer/Settings/src/main/java/com/sun/hotspot/igv/settings/ViewPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,14 +50,16 @@ final class ViewPanel extends javax.swing.JPanel { portSpinner = new javax.swing.JSpinner(); jScrollPane1 = new javax.swing.JScrollPane(); nodeTextArea = new javax.swing.JTextArea(); - nodeWidthSpinner = new javax.swing.JSpinner(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); nodeShortTextField = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + nodeTinyTextField = new javax.swing.JTextField(); + defaultViewComboBox = new javax.swing.JComboBox<>(); org.openide.awt.Mnemonics.setLocalizedText(jLabel1, "Node Text"); - org.openide.awt.Mnemonics.setLocalizedText(jLabel2, "Node Width"); + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, "Default View"); nodeTextArea.setColumns(20); nodeTextArea.setRows(5); @@ -71,6 +73,14 @@ final class ViewPanel extends javax.swing.JPanel { nodeShortTextField.setBackground(new java.awt.Color(255, 255, 255)); nodeShortTextField.setToolTipText("Single-line format string for nodes in edge tooltips, slot tooltips, and node search bar. Properties are specified with brackets (example: \"[idx]\")."); + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, "Tiny Node Text"); + + nodeTinyTextField.setBackground(new java.awt.Color(255, 255, 255)); + nodeTinyTextField.setToolTipText("Single-line format string for node input lists. Properties are specified with brackets (example: \"[idx]\")."); + + defaultViewComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Sea of nodes", "Clustered sea of nodes", "Control-flow graph" })); + defaultViewComboBox.setToolTipText("View shown by default when a graph is opened."); + org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( @@ -81,16 +91,16 @@ final class ViewPanel extends javax.swing.JPanel { .add(jLabel1) .add(jLabel3) .add(jLabel2) - .add(jLabel4)) + .add(jLabel4) + .add(jLabel5)) .add(39, 39, 39) - .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(nodeShortTextField) - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)) - .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) - .add(org.jdesktop.layout.GroupLayout.LEADING, nodeWidthSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, portSpinner))) - .addContainerGap(439, Short.MAX_VALUE)) + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(nodeShortTextField) + .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE) + .add(portSpinner) + .add(nodeTinyTextField) + .add(defaultViewComboBox, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -105,8 +115,12 @@ final class ViewPanel extends javax.swing.JPanel { .add(nodeShortTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(nodeWidthSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel2)) + .add(jLabel5) + .add(nodeTinyTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(27, 27, 27) + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel2) + .add(defaultViewComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(portSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) @@ -127,20 +141,22 @@ final class ViewPanel extends javax.swing.JPanel { .add(layout.createSequentialGroup() .addContainerGap() .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap(153, Short.MAX_VALUE)) + .addContainerGap(29, Short.MAX_VALUE)) ); }// //GEN-END:initComponents void load() { nodeTextArea.setText(Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT)); nodeShortTextField.setText(Settings.get().get(Settings.NODE_SHORT_TEXT, Settings.NODE_SHORT_TEXT_DEFAULT)); - nodeWidthSpinner.setValue(Integer.parseInt(Settings.get().get(Settings.NODE_WIDTH, Settings.NODE_WIDTH_DEFAULT))); + nodeTinyTextField.setText(Settings.get().get(Settings.NODE_TINY_TEXT, Settings.NODE_TINY_TEXT_DEFAULT)); + defaultViewComboBox.setSelectedIndex(Settings.get().getInt(Settings.DEFAULT_VIEW, Settings.DefaultView.SEA_OF_NODES)); portSpinner.setValue(Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT))); } void store() { Settings.get().put(Settings.NODE_TEXT, nodeTextArea.getText()); Settings.get().put(Settings.NODE_SHORT_TEXT, nodeShortTextField.getText()); - Settings.get().put(Settings.NODE_WIDTH, nodeWidthSpinner.getValue().toString()); + Settings.get().put(Settings.NODE_TINY_TEXT, nodeTinyTextField.getText()); + Settings.get().putInt(Settings.DEFAULT_VIEW, defaultViewComboBox.getSelectedIndex()); Settings.get().put(Settings.PORT, portSpinner.getValue().toString()); } @@ -148,15 +164,17 @@ final class ViewPanel extends javax.swing.JPanel { return true; } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox defaultViewComboBox; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField nodeShortTextField; private javax.swing.JTextArea nodeTextArea; - private javax.swing.JSpinner nodeWidthSpinner; + private javax.swing.JTextField nodeTinyTextField; private javax.swing.JSpinner portSpinner; // End of variables declaration//GEN-END:variables } diff --git a/src/utils/IdealGraphVisualizer/Util/src/main/java/com/sun/hotspot/igv/util/StringUtils.java b/src/utils/IdealGraphVisualizer/Util/src/main/java/com/sun/hotspot/igv/util/StringUtils.java index 2fcc12af03a75b5c1583f4ab4701b37c9cbb5813..d831e0a359028e7f74fc0e959f0312969a537a1a 100644 --- a/src/utils/IdealGraphVisualizer/Util/src/main/java/com/sun/hotspot/igv/util/StringUtils.java +++ b/src/utils/IdealGraphVisualizer/Util/src/main/java/com/sun/hotspot/igv/util/StringUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -113,4 +113,25 @@ public class StringUtils { } } + /** + * Rank a match of a query in a word. Full matches of a word rank highest, + * followed by partial matches at the word start, followed by the rest of + * matches in increasing size of the partially matched word, for example: + * + * rank("5", "5") = 1 (full match) + * rank("5", "554") = 2 (start match) + * rank("5", "25") = 3 (middle match with excess 1) + * rank("5", "253") = 4 (middle match with excess 2) + */ + public static int rankMatch(String query, String word) { + if (word.equals(query)) { + return 1; + } else if (word.startsWith(query)) { + return 2; + } else if (word.contains(query)) { + return word.length() - query.length() + 2; + } + return Integer.MAX_VALUE; + } + } diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/BlockQuickSearch.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/BlockQuickSearch.java new file mode 100644 index 0000000000000000000000000000000000000000..9d8b6c52305f066c03d5a8fef574f20a2dd4b33c --- /dev/null +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/BlockQuickSearch.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.view; + +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.data.InputBlock; +import com.sun.hotspot.igv.data.Properties.RegexpPropertyMatcher; +import com.sun.hotspot.igv.data.services.InputGraphProvider; +import com.sun.hotspot.igv.util.LookupHistory; +import com.sun.hotspot.igv.util.StringUtils; +import java.util.List; +import java.util.ArrayList; +import java.util.regex.Pattern; +import org.netbeans.spi.quicksearch.SearchProvider; +import org.netbeans.spi.quicksearch.SearchRequest; +import org.netbeans.spi.quicksearch.SearchResponse; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; +import org.openide.NotifyDescriptor.Message; + +public class BlockQuickSearch implements SearchProvider { + + @Override + public void evaluate(SearchRequest request, SearchResponse response) { + String rawValue = request.getText(); + if (rawValue.trim().isEmpty()) { + return; + } + String value = ".*" + Pattern.quote(rawValue) + ".*"; + + final InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class); + if (p == null || p.getGraph() == null) { + return; + } + + InputGraph matchGraph = p.getGraph(); + // Search the current graph + List matches = findMatches(value, p.getGraph(), response); + if (matches == null) { + // See if the it hits in a later graph + for (InputGraph graph : p.searchForward()) { + matches = findMatches(value, graph, response); + if (matches != null) { + matchGraph = graph; + break; + } + } + } + if (matches == null) { + // See if it hits in a earlier graph + for (InputGraph graph : p.searchBackward()) { + matches = findMatches(value, graph, response); + if (matches != null) { + matchGraph = graph; + break; + } + } + } + if (matches != null) { + // Rank the matches. + matches.sort((InputBlock a, InputBlock b) -> + compareByRankThenNumVal(rawValue, + "B" + a.getName(), + "B" + b.getName())); + + final InputGraph theGraph = p.getGraph() != matchGraph ? matchGraph : null; + for (final InputBlock b : matches) { + if (!response.addResult(() -> { + final EditorTopComponent comp = EditorTopComponent.getActive(); + assert(comp != null); + if (theGraph != null) { + comp.getDiagramModel().selectGraph(theGraph); + } + comp.setSelectedNodes(b); + comp.requestActive(); + }, + "B" + b.getName() + (theGraph != null ? " in " + theGraph.getName() : ""))) { + return; + } + } + } + } + + private List findMatches(String blockName, InputGraph inputGraph, SearchResponse response) { + try { + RegexpPropertyMatcher matcher = new RegexpPropertyMatcher("", blockName, Pattern.CASE_INSENSITIVE); + List matches = new ArrayList<>(); + for (InputBlock b : inputGraph.getBlocks()) { + if (matcher.match("B" + b.getName())) { + matches.add(b); + } + } + return matches.size() == 0 ? null : matches; + } catch (Exception e) { + final String msg = e.getMessage(); + response.addResult(() -> { + Message desc = new NotifyDescriptor.Message("An exception occurred during the search, " + + "perhaps due to a malformed query string:\n" + msg, + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(desc); + }, + "(Error during search)" + ); + } + return null; + } + + private int compareByRankThenNumVal(String qry, String b1, String b2) { + int key1 = StringUtils.rankMatch(qry, b1); + int key2 = StringUtils.rankMatch(qry, b2); + if (key1 == key2) { + // If the matches have the same rank, compare the numeric values of + // their first words, if applicable. + try { + key1 = Integer.parseInt(b1.replace("B", "")); + key2 = Integer.parseInt(b2.replace("B", "")); + } catch (Exception e) { + // Not applicable, return equality value. + return 0; + } + } + return Integer.compare(key1, key2); + } + +} diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramScene.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramScene.java index 1aa622e8ffb9e0ecb9b6525ff24599b1ad79b379..703cbe6e6180b61f68b0c4e598585159119fdc19 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramScene.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramScene.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 +32,11 @@ import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.data.services.Scheduler; import com.sun.hotspot.igv.graph.*; import com.sun.hotspot.igv.hierarchicallayout.HierarchicalClusterLayoutManager; +import com.sun.hotspot.igv.hierarchicallayout.HierarchicalCFGLayoutManager; +import com.sun.hotspot.igv.hierarchicallayout.LinearLayoutManager; import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager; import com.sun.hotspot.igv.layout.LayoutGraph; +import com.sun.hotspot.igv.layout.Link; import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator; import com.sun.hotspot.igv.util.ColorIcon; import com.sun.hotspot.igv.util.DoubleClickAction; @@ -493,6 +496,19 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { return a; } + public Action createGotoAction(final Block b) { + final DiagramScene diagramScene = this; + String name = "B" + b.getInputBlock().getName(); + Action a = new AbstractAction(name) { + @Override + public void actionPerformed(ActionEvent e) { + diagramScene.gotoBlock(b); + } + }; + a.setEnabled(true); + return a; + } + public void setNewModel(DiagramViewModel model) { assert this.model == null : "can set model only once!"; this.model = model; @@ -518,15 +534,26 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { Diagram d = getModel().getDiagramToView(); - if (d.getGraph().getBlocks().isEmpty()) { - Scheduler s = Lookup.getDefault().lookup(Scheduler.class); - d.getGraph().clearBlocks(); - s.schedule(d.getGraph()); - d.getGraph().ensureNodesInBlocks(); - d.updateBlocks(); + Map maxWidth = new HashMap<>(); + for (InputBlock b : d.getGraph().getBlocks()) { + maxWidth.put(b, 10); + } + for (Figure f : d.getFigures()) { + // Update node text, since it might differ across views. + f.updateLines(); + // Compute max node width in each block. + if (f.getWidth() > maxWidth.get(f.getBlock())) { + maxWidth.put(f.getBlock(), f.getWidth()); + } } for (Figure f : d.getFigures()) { + + // Set all nodes' width to the maximum width in the blocks? + if (getModel().getShowCFG()) { + f.setWidth(maxWidth.get(f.getBlock())); + } + FigureWidget w = new FigureWidget(f, hoverAction, selectAction, this, mainLayer); w.getActions().addAction(ActionFactory.createPopupMenuAction(w)); w.getActions().addAction(selectAction); @@ -552,7 +579,7 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } - if (getModel().getShowBlocks()) { + if (getModel().getShowBlocks() || getModel().getShowCFG()) { for (InputBlock bn : d.getGraph().getBlocks()) { BlockWidget w = new BlockWidget(this, d, bn); w.setVisible(false); @@ -578,8 +605,11 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } private boolean isVisible(Connection c) { - FigureWidget w1 = getWidget(c.getInputSlot().getFigure()); - FigureWidget w2 = getWidget(c.getOutputSlot().getFigure()); + if (getModel().getShowCFG()) { + return c.isAlwaysVisible(); + } + FigureWidget w1 = getWidget(c.getFrom().getVertex()); + FigureWidget w2 = getWidget(c.getTo().getVertex()); if (w1.isVisible() && w2.isVisible()) { return true; @@ -608,22 +638,72 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } - if (getModel().getShowBlocks()) { - HierarchicalClusterLayoutManager m = new HierarchicalClusterLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); - HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); - manager.setMaxLayerLength(9); - manager.setMinLayerDifference(3); - m.setManager(manager); - m.setSubManager(new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS)); - m.doLayout(new LayoutGraph(edges, figures)); - } else { - HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); - manager.setMaxLayerLength(10); - manager.doLayout(new LayoutGraph(edges, figures)); + if (getModel().getShowSea()) { + doSeaLayout(figures, edges); + } else if (getModel().getShowBlocks()) { + doClusteredLayout(figures, edges); + } else if (getModel().getShowCFG()) { + doCFGLayout(figures, edges); } relayoutWithoutLayout(oldVisibleWidgets); } + + private void doSeaLayout(HashSet
    figures, HashSet edges) { + HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); + manager.setMaxLayerLength(10); + manager.doLayout(new LayoutGraph(edges, figures)); + } + + private void doClusteredLayout(HashSet
    figures, HashSet edges) { + HierarchicalClusterLayoutManager m = new HierarchicalClusterLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); + HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); + manager.setMaxLayerLength(9); + manager.setMinLayerDifference(3); + m.setManager(manager); + m.setSubManager(new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS)); + m.doLayout(new LayoutGraph(edges, figures)); + } + + private void doCFGLayout(HashSet
    figures, HashSet edges) { + Diagram diagram = getModel().getDiagramToView(); + HierarchicalCFGLayoutManager m = new HierarchicalCFGLayoutManager(); + HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); + manager.setMaxLayerLength(9); + manager.setMinLayerDifference(1); + manager.setLayoutSelfEdges(true); + manager.setXOffset(25); + manager.setLayerOffset(25); + m.setManager(manager); + Map nodeFig = new HashMap(); + for (Figure f : figures) { + InputNode n = f.getFirstSourceNode(); + if (n != null) { + nodeFig.put(n, f); + } + } + // Compute global ranking among figures given by in-block order. If + // needed, this could be cached as long as it is computed for all the + // figures in the model, not just the visible ones. + Map figureRank = + new HashMap(figures.size()); + int r = 0; + for (InputBlock b : getModel().getGraphToView().getBlocks()) { + for (InputNode n : b.getNodes()) { + Figure f = nodeFig.get(n); + if (f != null) { + figureRank.put(f, r); + r++; + } + } + } + // Add connections for CFG edges. + edges.addAll(diagram.getBlockConnections()); + m.setSubManager(new LinearLayoutManager(figureRank)); + m.setClusters(new HashSet<>(diagram.getBlocks())); + m.doLayout(new LayoutGraph(edges, figures)); + } + private Set> lineCache = new HashSet<>(); private void relayoutWithoutLayout(Set oldVisibleWidgets) { @@ -642,7 +722,7 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } - for (Connection c : diagram.getConnections()) { + for (FigureConnection c : diagram.getConnections()) { List points = c.getControlPoints(); FigureWidget w1 = getWidget((Figure) c.getTo().getVertex()); FigureWidget w2 = getWidget((Figure) c.getFrom().getVertex()); @@ -656,7 +736,7 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } - if (getModel().getShowBlocks()) { + if (getModel().getShowBlocks() || getModel().getShowCFG()) { for (Block b : diagram.getBlocks()) { BlockWidget w = getWidget(b.getInputBlock()); if (w != null && w.isVisible()) { @@ -705,7 +785,18 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { if (visibleFigureCount > ANIMATION_LIMIT || oldVisibleWidgets == null) { anim = null; } - processOutputSlot(lastLineCache, s, s.getConnections(), 0, null, null, offx2, offy2, anim); + List cl = new ArrayList<>(s.getConnections().size()); + for (FigureConnection c : s.getConnections()) { + cl.add((Connection) c); + } + processOutputSlot(lastLineCache, s, cl, 0, null, null, offx2, offy2, anim); + } + } + + if (getModel().getShowCFG()) { + for (BlockConnection c : diagram.getBlockConnections()) { + SceneAnimator anim = animator; + processOutputSlot(lastLineCache, null, Collections.singletonList(c), 0, null, null, offx2, offy2, anim); } } @@ -723,7 +814,7 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } - if (getModel().getShowBlocks()) { + if (getModel().getShowBlocks() || getModel().getShowCFG()) { for (Block b : diagram.getBlocks()) { BlockWidget w = getWidget(b.getInputBlock()); if (w != null && w.isVisible()) { @@ -759,12 +850,15 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } Point cur = controlPoints.get(controlPointIndex); - if (cur == null) { + if (cur == null) { // Long connection, has been cut vertically. cur = specialNullPoint; - } else if (controlPointIndex == 0 && !s.shouldShowName()) { - cur = new Point(cur.x, cur.y - SLOT_OFFSET); - } else if (controlPointIndex == controlPoints.size() - 1 && !c.getInputSlot().shouldShowName()) { - cur = new Point(cur.x, cur.y + SLOT_OFFSET); + } else if (c.hasSlots()) { + if (controlPointIndex == 0 && !s.shouldShowName()) { + cur = new Point(cur.x, cur.y - SLOT_OFFSET); + } else if (controlPointIndex == controlPoints.size() - 1 && + !((Slot)c.getTo()).shouldShowName()) { + cur = new Point(cur.x, cur.y + SLOT_OFFSET); + } } if (pointMap.containsKey(cur)) { @@ -883,6 +977,13 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } + public void gotoBlock(final Block block) { + BlockWidget bw = getWidget(block.getInputBlock()); + if (bw != null) { + centerRectangle(bw.getBounds()); + } + } + private Set idSetToObjectSet(Set ids) { Set result = new HashSet<>(); @@ -1042,7 +1143,7 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } - if (getModel().getShowBlocks()) { + if (getModel().getShowBlocks() || getModel().getShowCFG()) { for (InputBlock b : diagram.getGraph().getBlocks()) { BlockWidget w = getWidget(b); if (w.isVisible()) { @@ -1102,7 +1203,23 @@ public class DiagramScene extends ObjectScene implements DiagramViewer { } } - if (getModel().getShowBlocks()) { + if (getModel().getShowCFG()) { + // Blockless figures and artificial blocks are hidden in this view. + for (Figure f : diagram.getFigures()) { + if (f.getBlock().isArtificial()) { + FigureWidget w = getWidget(f); + w.setVisible(false); + } + } + visibleBlocks.clear(); + for (InputBlock b : diagram.getGraph().getBlocks()) { + if (!b.isArtificial()) { + visibleBlocks.add(b); + } + } + } + + if (getModel().getShowBlocks() || getModel().getShowCFG()) { for (InputBlock b : diagram.getGraph().getBlocks()) { boolean visibleAfter = visibleBlocks.contains(b); diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramViewModel.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramViewModel.java index a91765c9545233ebfdf7c70cd4f490c71bce92c0..b532a3ebe4b91b3c3ac572228c3a883afbfd4302 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramViewModel.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.view; import com.sun.hotspot.igv.data.*; +import com.sun.hotspot.igv.data.services.Scheduler; import com.sun.hotspot.igv.difference.Difference; import com.sun.hotspot.igv.filter.CustomFilter; import com.sun.hotspot.igv.filter.FilterChain; @@ -34,6 +35,7 @@ import com.sun.hotspot.igv.settings.Settings; import com.sun.hotspot.igv.util.RangeSliderModel; import java.awt.Color; import java.util.*; +import org.openide.util.Lookup; /** * @@ -56,7 +58,9 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene private ChangedEvent viewChangedEvent; private ChangedEvent hiddenNodesChangedEvent; private ChangedEvent viewPropertiesChangedEvent; + private boolean showSea; private boolean showBlocks; + private boolean showCFG; private boolean showNodeHull; private boolean hideDuplicates; private ChangedListener filterChainChangedListener = new ChangedListener() { @@ -102,8 +106,12 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene this.onScreenNodes = newModel.onScreenNodes; viewChanged |= (selectedNodes != newModel.selectedNodes); this.selectedNodes = newModel.selectedNodes; + viewPropertiesChanged |= (showSea != newModel.showSea); + this.showSea = newModel.showSea; viewPropertiesChanged |= (showBlocks != newModel.showBlocks); this.showBlocks = newModel.showBlocks; + viewPropertiesChanged |= (showCFG != newModel.showCFG); + this.showCFG = newModel.showCFG; viewPropertiesChanged |= (showNodeHull != newModel.showNodeHull); this.showNodeHull = newModel.showNodeHull; @@ -122,6 +130,15 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene } } + public boolean getShowSea() { + return showSea; + } + + public void setShowSea(boolean b) { + showSea = b; + viewPropertiesChangedEvent.fire(); + } + public boolean getShowBlocks() { return showBlocks; } @@ -131,6 +148,15 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene viewPropertiesChangedEvent.fire(); } + public boolean getShowCFG() { + return showCFG; + } + + public void setShowCFG(boolean b) { + showCFG = b; + viewPropertiesChangedEvent.fire(); + } + public boolean getShowNodeHull() { return showNodeHull; } @@ -164,7 +190,9 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene public DiagramViewModel(Group g, FilterChain filterChain, FilterChain sequenceFilterChain) { super(Arrays.asList("default")); - this.showBlocks = false; + this.showSea = Settings.get().getInt(Settings.DEFAULT_VIEW, Settings.DEFAULT_VIEW_DEFAULT) == Settings.DefaultView.SEA_OF_NODES; + this.showBlocks = Settings.get().getInt(Settings.DEFAULT_VIEW, Settings.DEFAULT_VIEW_DEFAULT) == Settings.DefaultView.CLUSTERED_SEA_OF_NODES; + this.showCFG = Settings.get().getInt(Settings.DEFAULT_VIEW, Settings.DEFAULT_VIEW_DEFAULT) == Settings.DefaultView.CONTROL_FLOW_GRAPH; this.showNodeHull = true; this.group = g; filterGraphs(); @@ -406,9 +434,17 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene public Diagram getDiagramToView() { if (diagram == null) { - diagram = Diagram.createDiagram(getGraphToView(), + InputGraph graph = getGraphToView(); + if (graph.getBlocks().isEmpty()) { + Scheduler s = Lookup.getDefault().lookup(Scheduler.class); + graph.clearBlocks(); + s.schedule(graph); + graph.ensureNodesInBlocks(); + } + diagram = Diagram.createDiagram(graph, Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT), - Settings.get().get(Settings.NODE_SHORT_TEXT, Settings.NODE_SHORT_TEXT_DEFAULT)); + Settings.get().get(Settings.NODE_SHORT_TEXT, Settings.NODE_SHORT_TEXT_DEFAULT), + Settings.get().get(Settings.NODE_TINY_TEXT, Settings.NODE_TINY_TEXT_DEFAULT)); getFilterChain().apply(diagram, getSequenceFilterChain()); if (getFirstPosition() != getSecondPosition()) { CustomFilter f = new CustomFilter( @@ -420,6 +456,7 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene } } + diagram.setCFG(getShowCFG()); return diagram; } diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/EditorTopComponent.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/EditorTopComponent.java index cf5e965de69b58206bca4a956e34b64612e3f321..5ae8c8e8dbbe2187c88d3d927b939a4c41795a93 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/EditorTopComponent.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/EditorTopComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ import com.sun.hotspot.igv.data.ChangedListener; import com.sun.hotspot.igv.data.GraphDocument; import com.sun.hotspot.igv.data.Group; import com.sun.hotspot.igv.data.InputNode; +import com.sun.hotspot.igv.data.InputBlock; import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.data.Properties.PropertyMatcher; import com.sun.hotspot.igv.data.services.InputGraphProvider; @@ -38,6 +39,7 @@ import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.graph.services.DiagramProvider; import com.sun.hotspot.igv.util.LookupHistory; import com.sun.hotspot.igv.util.RangeSlider; +import com.sun.hotspot.igv.settings.Settings; import com.sun.hotspot.igv.view.actions.*; import java.awt.*; import java.awt.event.HierarchyBoundsListener; @@ -91,7 +93,9 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh private DiagramViewer scene; private InstanceContent content; private InstanceContent graphContent; + private EnableSeaLayoutAction seaLayoutAction; private EnableBlockLayoutAction blockLayoutAction; + private EnableCFGLayoutAction cfgLayoutAction; private OverviewAction overviewAction; private HideDuplicatesAction hideDuplicatesAction; private PredSuccAction predSuccAction; @@ -238,12 +242,31 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh toolBar.add(ShowAllAction.get(ZoomInAction.class)); toolBar.add(ShowAllAction.get(ZoomOutAction.class)); + toolBar.addSeparator(); + ButtonGroup layoutButtons = new ButtonGroup(); + + seaLayoutAction = new EnableSeaLayoutAction(); + JToggleButton button = new JToggleButton(seaLayoutAction); + button.setSelected(Settings.get().getInt(Settings.DEFAULT_VIEW, Settings.DEFAULT_VIEW_DEFAULT) == Settings.DefaultView.SEA_OF_NODES); + layoutButtons.add(button); + toolBar.add(button); + seaLayoutAction.addPropertyChangeListener(this); + blockLayoutAction = new EnableBlockLayoutAction(); - JToggleButton button = new JToggleButton(blockLayoutAction); - button.setSelected(false); + button = new JToggleButton(blockLayoutAction); + button.setSelected(Settings.get().getInt(Settings.DEFAULT_VIEW, Settings.DEFAULT_VIEW_DEFAULT) == Settings.DefaultView.CLUSTERED_SEA_OF_NODES); + layoutButtons.add(button); toolBar.add(button); blockLayoutAction.addPropertyChangeListener(this); + cfgLayoutAction = new EnableCFGLayoutAction(); + button = new JToggleButton(cfgLayoutAction); + button.setSelected(Settings.get().getInt(Settings.DEFAULT_VIEW, Settings.DEFAULT_VIEW_DEFAULT) == Settings.DefaultView.CONTROL_FLOW_GRAPH); + layoutButtons.add(button); + toolBar.add(button); + cfgLayoutAction.addPropertyChangeListener(this); + + toolBar.addSeparator(); overviewAction = new OverviewAction(); overviewButton = new JToggleButton(overviewAction); overviewButton.setSelected(false); @@ -508,6 +531,16 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh setSelectedFigures(list); } + public void setSelectedNodes(InputBlock b) { + List
    list = new ArrayList<>(); + for (Figure f : getModel().getDiagramToView().getFigures()) { + if (f.getBlock() == b) { + list.add(f); + } + } + setSelectedFigures(list); + } + @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() == this.predSuccAction) { @@ -520,9 +553,15 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh } else { showScene(); } + } else if (evt.getSource() == this.seaLayoutAction) { + boolean b = seaLayoutAction.isSelected(); + this.getModel().setShowSea(b); } else if (evt.getSource() == this.blockLayoutAction) { - boolean b = (Boolean) blockLayoutAction.getValue(EnableBlockLayoutAction.STATE); + boolean b = blockLayoutAction.isSelected(); this.getModel().setShowBlocks(b); + } else if (evt.getSource() == this.cfgLayoutAction) { + boolean b = cfgLayoutAction.isSelected(); + this.getModel().setShowCFG(b); } else if (evt.getSource() == this.hideDuplicatesAction) { boolean b = (Boolean) hideDuplicatesAction.getValue(HideDuplicatesAction.STATE); this.getModel().setHideDuplicates(b); diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/GraphViewerImplementation.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/GraphViewerImplementation.java index 4fb5781df757e0745d3c543b47266e2e6c553db4..f9832484fb18c14ba6241bd069106ac5531b4cad 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/GraphViewerImplementation.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/GraphViewerImplementation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 +66,10 @@ public class GraphViewerImplementation implements GraphViewer { Diagram diagram = Diagram.createDiagram(graph, Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT), - Settings.get().get(Settings.NODE_SHORT_TEXT, Settings.NODE_SHORT_TEXT_DEFAULT)); + Settings.get().get(Settings.NODE_SHORT_TEXT, Settings.NODE_SHORT_TEXT_DEFAULT), + Settings.get().get(Settings.NODE_TINY_TEXT, Settings.NODE_TINY_TEXT_DEFAULT)); EditorTopComponent tc = new EditorTopComponent(diagram); + diagram.setCFG(tc.getModel().getShowCFG()); tc.open(); tc.requestActive(); } diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/NodeQuickSearch.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/NodeQuickSearch.java index 4d0e51d6469e18356354368135a4907b0ae09a83..6b36fa2d9203c47e958e35fc1d3e8b2bdea44f1c 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/NodeQuickSearch.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/NodeQuickSearch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import com.sun.hotspot.igv.data.Properties.RegexpPropertyMatcher; import com.sun.hotspot.igv.data.services.InputGraphProvider; import com.sun.hotspot.igv.settings.Settings; import com.sun.hotspot.igv.util.LookupHistory; +import com.sun.hotspot.igv.util.StringUtils; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -214,24 +215,16 @@ public class NodeQuickSearch implements SearchProvider { /** * Rank a match by splitting the property into words. Full matches of a word * rank highest, followed by partial matches at the word start, followed by - * the rest of matches in increasing size of the partially matched word, for - * example: - * - * rank("5", "5 AddI") = 1 (full match of first word) - * rank("5", "554 MulI") = 2 (start match of first word) - * rank("5", "25 AddL") = 3 (middle match of first word with excess 1) - * rank("5", "253 AddL") = 4 (middle match of first word with excess 2) + * the rest of matches in increasing size of the partially matched word. See + * examples in class StringUtils. */ private int rankMatch(String qry, String prop) { String query = qry.toLowerCase(); String property = prop.toLowerCase(); for (String component : property.split("\\W+")) { - if (component.equals(query)) { - return 1; - } else if (component.startsWith(query)) { - return 2; - } else if (component.contains(query)) { - return component.length() - query.length() + 2; + int rank = StringUtils.rankMatch(query, component); + if (rank != Integer.MAX_VALUE) { + return rank; } } return Integer.MAX_VALUE; diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableBlockLayoutAction.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableBlockLayoutAction.java index 7831d0c6ef515355aeebda68a10a59afdfd0f06b..95c224520f93bed3a53cfcc687cd32b8e91dadf0 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableBlockLayoutAction.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableBlockLayoutAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,22 +35,22 @@ import org.openide.util.ImageUtilities; */ public class EnableBlockLayoutAction extends AbstractAction { - private boolean state; - public static final String STATE = "state"; - public EnableBlockLayoutAction() { - state = false; putValue(AbstractAction.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(iconResource()))); - putValue(STATE, state); - putValue(Action.SHORT_DESCRIPTION, "Cluster nodes into blocks"); + putValue(SELECTED_KEY, false); + putValue(Action.SHORT_DESCRIPTION, "Show clustered sea of nodes"); } - public void actionPerformed(ActionEvent ev) { - this.state = !state; - this.putValue(STATE, state); + public boolean isSelected() { + return (Boolean)getValue(SELECTED_KEY); } protected String iconResource() { - return "com/sun/hotspot/igv/view/images/blocks.gif"; + return "com/sun/hotspot/igv/view/images/blocks.png"; + } + + @Override + public void actionPerformed(ActionEvent e) { } + } diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableCFGLayoutAction.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableCFGLayoutAction.java new file mode 100644 index 0000000000000000000000000000000000000000..dfae60c45b789360f0be2c6e2bc4642b2d97d39a --- /dev/null +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableCFGLayoutAction.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.view.actions; + +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ImageIcon; +import org.openide.util.ImageUtilities; + +public class EnableCFGLayoutAction extends AbstractAction { + + public EnableCFGLayoutAction() { + putValue(AbstractAction.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(iconResource()))); + putValue(SELECTED_KEY, false); + putValue(Action.SHORT_DESCRIPTION, "Show control-flow graph"); + } + + public boolean isSelected() { + return (Boolean)getValue(SELECTED_KEY); + } + + protected String iconResource() { + return "com/sun/hotspot/igv/view/images/cfg.png"; + } + + @Override + public void actionPerformed(ActionEvent e) { + } +} diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableSeaLayoutAction.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableSeaLayoutAction.java new file mode 100644 index 0000000000000000000000000000000000000000..0d96310e8ef3f49d6f7ff62370385beda68a2b7b --- /dev/null +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableSeaLayoutAction.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 com.sun.hotspot.igv.view.actions; + +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ImageIcon; +import org.openide.util.ImageUtilities; + +public class EnableSeaLayoutAction extends AbstractAction { + + public EnableSeaLayoutAction() { + putValue(AbstractAction.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(iconResource()))); + putValue(SELECTED_KEY, false); + putValue(Action.SHORT_DESCRIPTION, "Show sea of nodes"); + } + + public boolean isSelected() { + return (Boolean)getValue(SELECTED_KEY); + } + + protected String iconResource() { + return "com/sun/hotspot/igv/view/images/sea.png"; + } + + @Override + public void actionPerformed(ActionEvent e) { + } +} diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/BlockWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/BlockWidget.java index ce96f295e6eebcc9bb6903b7341852ed1722f84d..4e8e919e8c523db36fbecd667e0a7889cfc62933 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/BlockWidget.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/BlockWidget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +43,8 @@ public class BlockWidget extends Widget { public static final int BORDER = 20; public static final Color BACKGROUND_COLOR = new Color(235, 235, 255); - private static final Font titleFont = new Font("Serif", Font.PLAIN, 14).deriveFont(Font.BOLD); + private static final Font TITLE_FONT = new Font("Arial", Font.BOLD, 14); + public static final Color TITLE_COLOR = new Color(42, 42, 171); private InputBlock blockNode; private Diagram diagram; @@ -70,9 +71,8 @@ public class BlockWidget extends Widget { g.drawRect(r.x, r.y, r.width, r.height); } - Color titleColor = Color.BLACK; - g.setColor(titleColor); - g.setFont(titleFont); + g.setColor(TITLE_COLOR); + g.setFont(TITLE_FONT); String s = "B" + blockNode.getName(); Rectangle2D r1 = g.getFontMetrics().getStringBounds(s, g); diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java index dfe678111615278b78115b3201ce3782a6127631..cc9f91d11a0c271149b71e6d4ad2ae9be443caf2 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,6 +46,7 @@ import javax.swing.event.MenuListener; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.layout.LayoutFactory; +import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Widget; @@ -106,14 +107,20 @@ public class FigureWidget extends Widget implements Properties.Provider, PopupMe outer.setLayout(LayoutFactory.createOverlayLayout()); middleWidget = new Widget(scene); - middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 0)); + SerialAlignment textAlign = scene.getModel().getShowCFG() ? + LayoutFactory.SerialAlignment.LEFT_TOP : + LayoutFactory.SerialAlignment.CENTER; + middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout(textAlign, 0)); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); middleWidget.getActions().addAction(new DoubleClickAction(this)); middleWidget.setCheckClipping(true); dummyTop = new Widget(scene); - dummyTop.setMinimumSize(new Dimension(Figure.INSET / 2, 1)); + int extraTopHeight = + getFigure().getDiagram().isCFG() && getFigure().hasNamedInputSlot() ? + Figure.TOP_CFG_HEIGHT : 0; + dummyTop.setMinimumSize(new Dimension(Figure.INSET / 2, 1 + extraTopHeight)); middleWidget.addChild(dummyTop); String[] strings = figure.getLines(); @@ -132,10 +139,13 @@ public class FigureWidget extends Widget implements Properties.Provider, PopupMe } Widget dummyBottom = new Widget(scene); - dummyBottom.setMinimumSize(new Dimension(Figure.INSET / 2, 1)); + int extraBottomHeight = + getFigure().getDiagram().isCFG() && getFigure().hasNamedOutputSlot() ? + Figure.BOTTOM_CFG_HEIGHT : 0; + dummyBottom.setMinimumSize(new Dimension(Figure.INSET / 2, 1 + extraBottomHeight)); middleWidget.addChild(dummyBottom); - middleWidget.setPreferredBounds(new Rectangle(0, Figure.SLOT_WIDTH - Figure.OVERLAPPING, f.getWidth(), f.getHeight())); + middleWidget.setPreferredBounds(new Rectangle(0, Figure.getVerticalOffset(), f.getWidth(), f.getHeight())); this.addChild(middleWidget); // Initialize node for property sheet diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/InputSlotWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/InputSlotWidget.java index fdb0a8db765148a8da930f706d555c96a244de02..4bba96c7e01359c231c34bdb34b8910ca599cbde 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/InputSlotWidget.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/InputSlotWidget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.view.widgets; import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.graph.InputSlot; import com.sun.hotspot.igv.view.DiagramScene; -import java.awt.Point; import java.util.List; import org.netbeans.api.visual.widget.Widget; @@ -41,12 +40,6 @@ public class InputSlotWidget extends SlotWidget { public InputSlotWidget(InputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); inputSlot = slot; - //init(); - //getFigureWidget().getLeftWidget().addChild(this); - Point p = inputSlot.getRelativePosition(); - p.x -= this.calculateClientArea().width / 2; - p.y += Figure.SLOT_START; - this.setPreferredLocation(p); } public InputSlot getInputSlot() { @@ -59,6 +52,12 @@ public class InputSlotWidget extends SlotWidget { assert slots.contains(getSlot()); return calculateWidth(slots.size()); } + + @Override + protected int yOffset() { + return getFigureWidget().getFigure().getDiagram().isCFG() ? + calculateClientArea().height - 1 : Figure.SLOT_START; + } /* protected Point calculateRelativeLocation() { if (getFigureWidget().getBounds() == null) { diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.java index 3cf39ca34efee16bed44b38b3d3b3cf85f78aa18..5eeb0f84e5e55b441a3ae2499df8ac0d83b7aeda 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 +25,8 @@ package com.sun.hotspot.igv.view.widgets; import com.sun.hotspot.igv.graph.Connection; import com.sun.hotspot.igv.graph.Figure; -import com.sun.hotspot.igv.graph.InputSlot; import com.sun.hotspot.igv.graph.OutputSlot; +import com.sun.hotspot.igv.graph.Block; import com.sun.hotspot.igv.util.StringUtils; import com.sun.hotspot.igv.view.DiagramScene; import java.awt.*; @@ -138,8 +138,10 @@ public class LineWidget extends Widget implements PopupMenuProvider { public void select(Widget arg0, Point arg1, boolean arg2) { Set
    set = new HashSet<>(); for (Connection c : LineWidget.this.connections) { - set.add(c.getInputSlot().getFigure()); - set.add(c.getOutputSlot().getFigure()); + if (c.hasSlots()) { + set.add(scene.getWidget(c.getTo())); + set.add(scene.getWidget(c.getFrom())); + } } LineWidget.this.scene.setSelectedObjects(set); } @@ -242,10 +244,12 @@ public class LineWidget extends Widget implements PopupMenuProvider { Set highlightedObjects = new HashSet<>(scene.getHighlightedObjects()); Set highlightedObjectsChange = new HashSet<>(); for (Connection c : connections) { - highlightedObjectsChange.add(c.getInputSlot().getFigure()); - highlightedObjectsChange.add(c.getInputSlot()); - highlightedObjectsChange.add(c.getOutputSlot().getFigure()); - highlightedObjectsChange.add(c.getOutputSlot()); + if (c.hasSlots()) { + highlightedObjectsChange.add(c.getTo()); + highlightedObjectsChange.add(c.getTo().getVertex()); + highlightedObjectsChange.add(c.getFrom()); + highlightedObjectsChange.add(c.getFrom().getVertex()); + } } if(b) { highlightedObjects.addAll(highlightedObjectsChange); @@ -312,14 +316,19 @@ public class LineWidget extends Widget implements PopupMenuProvider { @Override public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu menu = new JPopupMenu(); - menu.add(scene.createGotoAction(outputSlot.getFigure())); - menu.addSeparator(); - - for (Connection c : connections) { - InputSlot s = c.getInputSlot(); - menu.add(scene.createGotoAction(s.getFigure())); + if (outputSlot == null) { // One-to-one block line. + assert (connections.size() == 1); + Connection c = connections.get(0); + menu.add(scene.createGotoAction((Block)c.getFromCluster())); + menu.addSeparator(); + menu.add(scene.createGotoAction((Block)c.getToCluster())); + } else { // One-to-many figure line. + menu.add(scene.createGotoAction(outputSlot.getFigure())); + menu.addSeparator(); + for (Connection c : connections) { + menu.add(scene.createGotoAction((Figure)c.getTo().getVertex())); + } } - final LineWidget w = this; menu.addPopupMenuListener(new PopupMenuListener() { diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/OutputSlotWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/OutputSlotWidget.java index 9a5ea2d1afbdca94a4b249cae1f828cbea9fa238..f1a03715d22e34ca7f915970b9975c79600c8a3a 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/OutputSlotWidget.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/OutputSlotWidget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package com.sun.hotspot.igv.view.widgets; import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.graph.OutputSlot; import com.sun.hotspot.igv.view.DiagramScene; -import java.awt.Point; import java.util.List; import org.netbeans.api.visual.widget.Widget; @@ -41,10 +40,6 @@ public class OutputSlotWidget extends SlotWidget { public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; - Point p = outputSlot.getRelativePosition(); - p.y += getSlot().getFigure().getHeight() - Figure.SLOT_START; - p.x -= this.calculateClientArea().width / 2; - this.setPreferredLocation(p); } public OutputSlot getOutputSlot() { @@ -58,4 +53,11 @@ public class OutputSlotWidget extends SlotWidget { return calculateWidth(slots.size()); } + + @Override + protected int yOffset() { + int overlap = getFigureWidget().getFigure().getDiagram().isCFG() ? + calculateClientArea().height : Figure.SLOT_START; + return getSlot().getFigure().getHeight() - overlap; + } } diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/SlotWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/SlotWidget.java index 9e02d9b5c0fcdffa29e6634ea1c10b0f8a146acd..74b6789578863033bbff81891e8f93338e9bd93b 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/SlotWidget.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/SlotWidget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; +import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.util.HashSet; @@ -57,13 +58,16 @@ public abstract class SlotWidget extends Widget implements DoubleClickHandler { this.diagramScene = scene; this.slot = slot; figureWidget = fw; - if (!slot.getSource().getSourceNodes().isEmpty()) { + if (slot.hasSourceNodes()) { this.setToolTipText("" + slot.getToolTipText() + ""); } this.setCheckClipping(true); parent.addChild(this); - //this.setPreferredBounds(this.calculateClientArea()); + Point p = slot.getRelativePosition(); + p.x -= this.calculateClientArea().width / 2; + p.y += yOffset(); + this.setPreferredLocation(p); } @Override @@ -92,7 +96,7 @@ public abstract class SlotWidget extends Widget implements DoubleClickHandler { int w = this.getBounds().width; int h = this.getBounds().height; - if (getSlot().getSource().getSourceNodes().size() > 0) { + if (getSlot().hasSourceNodes()) { final int SMALLER = 0; g.setColor(getSlot().getColor()); @@ -109,7 +113,7 @@ public abstract class SlotWidget extends Widget implements DoubleClickHandler { g.setStroke(new BasicStroke(1f)); } - if (getSlot().getShortName() != null && getSlot().getShortName().length() > 0) { + if (getSlot().shouldShowName()) { g.setFont(font); Rectangle2D r1 = g.getFontMetrics().getStringBounds(getSlot().getShortName(), g); rectW = (int) r1.getWidth() + FONT_OFFSET * 2; @@ -123,14 +127,15 @@ public abstract class SlotWidget extends Widget implements DoubleClickHandler { } g.drawRect(w / 2 - rectW / 2, 0, rectW - 1, s - 1); - if (getSlot().getShortName() != null && getSlot().getShortName().length() > 0 && getScene().getZoomFactor() >= TEXT_ZOOM_FACTOR) { + if (getSlot().shouldShowName() && getScene().getZoomFactor() >= TEXT_ZOOM_FACTOR) { Rectangle2D r1 = g.getFontMetrics().getStringBounds(getSlot().getShortName(), g); g.drawString(getSlot().getShortName(), (int) (w - r1.getWidth()) / 2, g.getFontMetrics().getAscent() - 1);//(int) (r1.getHeight())); } } else { - if (this.getSlot().getConnections().isEmpty()) { + if (this.getSlot().getConnections().isEmpty() && + !getFigureWidget().getFigure().getDiagram().isCFG()) { if (this.getState().isHighlighted()) { g.setColor(Color.BLUE); } else { @@ -155,6 +160,8 @@ public abstract class SlotWidget extends Widget implements DoubleClickHandler { protected abstract int calculateSlotWidth(); + protected abstract int yOffset(); + protected int calculateWidth(int count) { return getFigureWidget().getFigure().getWidth() / count; } diff --git a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/actions/Bundle.properties b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/actions/Bundle.properties index 10da1aa75d853a1d7e016eb1abaa339fdf4d3e62..a983c4b7dad33a6ccf3ffef9f7db805b08d60eb8 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/actions/Bundle.properties +++ b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/actions/Bundle.properties @@ -1,6 +1,8 @@ CTL_EditorAction=Open Editor Window CTL_NextDiagramAction=Show next graph +CTL_EnableSeaLayoutAction=Enable sea-of-nodes layout CTL_EnableBlockLayoutAction=Enable block layout +CTL_EnableCFGLayoutAction=Enable control-flow graph layout CTL_NodeFindAction=Find CTL_PrevDiagramAction=Show previous graph CTL_ExportAction=Export current graph... diff --git a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/blocks.gif b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/blocks.gif deleted file mode 100644 index 71aa946d53918697f7043a6c255611b50d5d11cd..0000000000000000000000000000000000000000 Binary files a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/blocks.gif and /dev/null differ diff --git a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/blocks.png b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/blocks.png new file mode 100644 index 0000000000000000000000000000000000000000..8354de8641cc3ed2724284a5a4106066090da039 Binary files /dev/null and b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/blocks.png differ diff --git a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/cfg.png b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/cfg.png new file mode 100644 index 0000000000000000000000000000000000000000..06791471b01b1da914f76560542934bc2f43ccb5 Binary files /dev/null and b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/cfg.png differ diff --git a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/sea.png b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/sea.png new file mode 100644 index 0000000000000000000000000000000000000000..35edbb5a5a98cf16dbb1e7b0e2cf4e4682c2ecb5 Binary files /dev/null and b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/images/sea.png differ diff --git a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/layer.xml b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/layer.xml index e37ac818667543d04b9338a71553ff71abc08da4..ee65bf0799c731132ee5307f0b6965549bba149e 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/layer.xml +++ b/src/utils/IdealGraphVisualizer/View/src/main/resources/com/sun/hotspot/igv/view/layer.xml @@ -17,7 +17,9 @@ + + @@ -80,6 +82,11 @@ + + + + + diff --git a/src/utils/hsdis/capstone/hsdis-capstone.c b/src/utils/hsdis/capstone/hsdis-capstone.c index d71330ee6a766d63e2128160b6e5f6701fc39366..075b4c67b1457e5566b229d81b05d38ab27cc524 100644 --- a/src/utils/hsdis/capstone/hsdis-capstone.c +++ b/src/utils/hsdis/capstone/hsdis-capstone.c @@ -61,6 +61,26 @@ typedef decode_instructions_printf_callback_ftype printf_callback_t; #define print(...) (*printf_callback) (printf_stream, __VA_ARGS__) +static void* null_event_callback(void* ignore_stream, const char* ignore_event, void* arg) { + return NULL; +} + +/* print all events as XML markup */ +static void* xml_event_callback(void* stream, const char* event, void* arg) { + FILE* fp = (FILE*) stream; +#define NS_PFX "dis:" + if (event[0] != '/') { + /* issue the tag, with or without a formatted argument */ + fprintf(fp, "<"NS_PFX); + fprintf(fp, event, arg); + fprintf(fp, ">"); + } else { + ++event; /* skip slash */ + fprintf(fp, "", event); + } + return NULL; +} + #ifdef _WIN32 __declspec(dllexport) #endif @@ -74,6 +94,21 @@ void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, int newline /* bool value for nice new line */) { csh cs_handle; + if (printf_callback == NULL) { + int (*fprintf_callback)(FILE*, const char*, ...) = &fprintf; + FILE* fprintf_stream = stdout; + printf_callback = (printf_callback_t) fprintf_callback; + if (printf_stream == NULL) + printf_stream = (void*) fprintf_stream; + } + if (event_callback == NULL) { + if (event_stream == NULL) + event_callback = &null_event_callback; + else + event_callback = &xml_event_callback; + } + + if (cs_open(CAPSTONE_ARCH, CAPSTONE_MODE, &cs_handle) != CS_ERR_OK) { print("Could not open cs_handle"); return NULL; @@ -86,7 +121,13 @@ void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, size_t count = cs_disasm(cs_handle, buffer, length, (uintptr_t) buffer, 0 , &insn); if (count) { for (unsigned int j = 0; j < count; j++) { - print(" 0x%" PRIx64 ":\t%s\t\t%s\n", insn[j].address, insn[j].mnemonic, insn[j].op_str); + (*event_callback)(event_stream, "insn", (void*) insn[j].address); + print("%s\t\t%s", insn[j].mnemonic, insn[j].op_str); + (*event_callback)(event_stream, "/insn", (void*) (insn[j].address + insn[j].size)); + if (newline) { + /* follow each complete insn by a nice newline */ + print("\n"); + } } cs_free(insn, count); } diff --git a/src/utils/hsdis/hsdis-license.txt b/src/utils/hsdis/hsdis-license.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c0b08232658857672727e7774b0c3b20413fcca --- /dev/null +++ b/src/utils/hsdis/hsdis-license.txt @@ -0,0 +1,35 @@ +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to +any person obtaining a copy of this software, associated documentation +and/or data (collectively the "Software"), free of charge and under any +and all copyright rights in the Software, and any and all patent rights +owned or freely licensable by each licensor hereunder covering either (i) +the unmodified Software as contributed to or provided by such licensor, +or (ii) the Larger Works (as defined below), to deal in both + +(a) the Software, and + +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file +if one is included with the Software (each a "Larger Work" to which the +Software is contributed by such licensors), + +without restriction, including without limitation the rights to copy, +create derivative works of, display, perform, and distribute the Software +and make, use, sell, offer for sale, import, export, have made, and have +sold the Software and the Larger Work(s), and to sublicense the foregoing +rights on either these or other terms. + +This license is subject to the following condition: + +The above copyright notice and either this complete permission notice or +at a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp index 914c64aacc593ec67824da72cd67c05c5433feaa..004fd71cb2fb240a40441e2f853dbff24df757f3 100644 --- a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp +++ b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp @@ -165,13 +165,13 @@ void G1CardSetTest::translate_cards(uint cards_per_region, uint region_idx, uint } } -class G1CountCardsOccupied : public G1CardSet::CardSetPtrClosure { +class G1CountCardsOccupied : public G1CardSet::ContainerPtrClosure { size_t _num_occupied; public: G1CountCardsOccupied() : _num_occupied(0) { } - void do_cardsetptr(uint region_idx, size_t num_occupied, G1CardSet::CardSetPtr card_set) override { + void do_containerptr(uint region_idx, size_t num_occupied, G1CardSet::ContainerPtr container) override { _num_occupied += num_occupied; } diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp index 9283fc3303fe031a30a749fd30e7351510cfecee..0ad3aed18cceeec2f739ec6b47753191b0ef4ebc 100644 --- a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp +++ b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp @@ -83,7 +83,7 @@ void G1CardSetContainersTest::cardset_inlineptr_test(uint bits_per_card) { G1AddCardResult res; - G1CardSet::CardSetPtr value = G1CardSetInlinePtr(); + G1CardSet::ContainerPtr value = G1CardSetInlinePtr(); for (uint i = 0; i < CardsPerSet; i++) { { diff --git a/test/hotspot/gtest/runtime/test_arguments.cpp b/test/hotspot/gtest/runtime/test_arguments.cpp index 81bae6c468aecafe7950fa7e9ba4652509aeb5a1..0919df6e8dd3ca9edd41de10c4726e3636aa6bbc 100644 --- a/test/hotspot/gtest/runtime/test_arguments.cpp +++ b/test/hotspot/gtest/runtime/test_arguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * 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 "jvm.h" #include "unittest.hpp" #include "runtime/arguments.hpp" +#include "runtime/flags/jvmFlag.hpp" #include "utilities/align.hpp" #include "utilities/globalDefinitions.hpp" @@ -41,6 +42,16 @@ public: static jint parse_xss(const JavaVMOption* option, const char* tail, intx* out_ThreadStackSize) { return Arguments::parse_xss(option, tail, out_ThreadStackSize); } + + static bool parse_argument(const char* name, const char* value) { + char buf[1024]; + int ret = jio_snprintf(buf, sizeof(buf), "%s=%s", name, value); + if (ret > 0) { + return Arguments::parse_argument(buf, JVMFlagOrigin::COMMAND_LINE); + } else { + return false; + } + } }; TEST_F(ArgumentsTest, atojulong) { @@ -201,3 +212,356 @@ TEST_VM_F(ArgumentsTest, parse_xss) { EXPECT_EQ(parse_xss_inner(to_string(K + 1), JNI_OK), calc_expected(K + 1)); } } + +struct Dummy {}; +static Dummy BAD_INT; + +template +struct NumericArgument { + bool bad; + const char* str; + T expected_value; + + NumericArgument(const char* s, T v) : bad(false), str(s), expected_value(v) {} + NumericArgument(const char* s, Dummy & dummy) : bad(true), str(s), expected_value(0) {} +}; + +static void check_invalid_numeric_string(JVMFlag* flag, const char** invalid_strings) { + for (uint i = 0; ; i++) { + const char* str = invalid_strings[i]; + if (str == NULL) { + return; + } + ASSERT_FALSE(ArgumentsTest::parse_argument(flag->name(), str)) + << "Invalid string '" << str + << "' parsed without error for type " << flag->type_string() << "."; + } +} + +template +void check_numeric_flag(JVMFlag* flag, T getvalue(JVMFlag* flag), + NumericArgument* valid_args, size_t n, + bool is_double = false) { + for (size_t i = 0; i < n; i++) { + NumericArgument* info = &valid_args[i]; + const char* str = info->str; + if (info->bad) { + ASSERT_FALSE(ArgumentsTest::parse_argument(flag->name(), str)) + << "Invalid string '" << str + << "' parsed without error for type " << flag->type_string() << "."; + } else { + ASSERT_TRUE(ArgumentsTest::parse_argument(flag->name(), str)) + << "Valid string '" << + str << "' did not parse for type " << flag->type_string() << "."; + ASSERT_EQ(getvalue(flag), info->expected_value) + << "Valid string '" << str + << "' did not parse to the correct value for type " + << flag->type_string() << "."; + } + } + + { + // Invalid strings for *any* type of integer VM arguments + const char* invalid_strings[] = { + "", " 1", "2 ", "3 2", + "0x", "0x0x1" "e" + "K", "M", "G", "1MB", "1KM", "AA", "0B", + "18446744073709551615K", "17179869184G", + "999999999999999999999999999999", + "0x10000000000000000", "18446744073709551616", + "-0x10000000000000000", "-18446744073709551616", + "-0x8000000000000001", "-9223372036854775809", + "0x8000000t", "0x800000000g", + "0x800000000000m", "0x800000000000000k", + "-0x8000000t", "-0x800000000g", + "-0x800000000000m", "-0x800000000000000k", + NULL, + }; + check_invalid_numeric_string(flag, invalid_strings); + } + + if (!is_double) { + const char* invalid_strings_for_integers[] = { + "1.0", "0x4.5", "0.001", "4e10", + NULL, + }; + check_invalid_numeric_string(flag, invalid_strings_for_integers); + } +} + +#define INTEGER_TEST_TABLE(f) \ + /*input i32 u32 i64 u64 */ \ + f("0", 0, 0, 0, 0 ) \ + f("-0", 0, BAD_INT, 0, BAD_INT ) \ + f("-1", -1, BAD_INT, -1, BAD_INT ) \ + f("0x1", 1, 1, 1, 1 ) \ + f("-0x1", -1, BAD_INT, -1, BAD_INT ) \ + f("4711", 4711, 4711, 4711, 4711 ) \ + f("1K", 1024, 1024, 1024, 1024 ) \ + f("1k", 1024, 1024, 1024, 1024 ) \ + f("2M", 2097152, 2097152, 2097152, 2097152 ) \ + f("2m", 2097152, 2097152, 2097152, 2097152 ) \ + f("1G", 1073741824, 1073741824, 1073741824, 1073741824 ) \ + f("2G", BAD_INT, 0x80000000, 2147483648LL, 2147483648ULL ) \ + f("1T", BAD_INT, BAD_INT, 1099511627776LL, 1099511627776ULL ) \ + f("1t", BAD_INT, BAD_INT, 1099511627776LL, 1099511627776ULL ) \ + f("-1K", -1024, BAD_INT, -1024, BAD_INT ) \ + f("0x1K", 1024, 1024, 1024, 1024 ) \ + f("-0x1K", -1024, BAD_INT, -1024, BAD_INT ) \ + f("0K", 0, 0, 0, 0 ) \ + f("0x1000000k", BAD_INT, BAD_INT, 17179869184LL, 17179869184ULL ) \ + f("0x800000m", BAD_INT, BAD_INT, 0x80000000000LL, 0x80000000000ULL ) \ + f("0x8000g", BAD_INT, BAD_INT, 0x200000000000LL, 0x200000000000ULL ) \ + f("0x8000t", BAD_INT, BAD_INT, 0x80000000000000LL, 0x80000000000000ULL ) \ + f("-0x1000000k", BAD_INT, BAD_INT, -17179869184LL, BAD_INT ) \ + f("-0x800000m", BAD_INT, BAD_INT, -0x80000000000LL, BAD_INT ) \ + f("-0x8000g", BAD_INT, BAD_INT, -0x200000000000LL, BAD_INT ) \ + f("-0x8000t", BAD_INT, BAD_INT, -0x80000000000000LL, BAD_INT ) \ + f("0x7fffffff", 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff ) \ + f("0xffffffff", BAD_INT, 0xffffffff, 0xffffffff, 0xffffffff ) \ + f("0x80000000", BAD_INT, 0x80000000, 0x80000000, 0x80000000 ) \ + f("-0x7fffffff", -2147483647, BAD_INT, -2147483647LL, BAD_INT ) \ + f("-0x80000000", -2147483648, BAD_INT, -2147483648LL, BAD_INT ) \ + f("-0x80000001", BAD_INT, BAD_INT, -2147483649LL, BAD_INT ) \ + f("0x100000000", BAD_INT, BAD_INT, 0x100000000LL, 0x100000000ULL ) \ + f("0xcafebabe", BAD_INT, 0xcafebabe, 0xcafebabe, 0xcafebabe ) \ + f("0XCAFEBABE", BAD_INT, 0xcafebabe, 0xcafebabe, 0xcafebabe ) \ + f("0XCAFEbabe", BAD_INT, 0xcafebabe, 0xcafebabe, 0xcafebabe ) \ + f("0xcafebabe1", BAD_INT, BAD_INT, 0xcafebabe1, 0xcafebabe1 ) \ + f("0x7fffffffffffffff", BAD_INT, BAD_INT, max_jlong, 9223372036854775807ULL ) \ + f("0x8000000000000000", BAD_INT, BAD_INT, BAD_INT, 9223372036854775808ULL ) \ + f("0xffffffffffffffff", BAD_INT, BAD_INT, BAD_INT, max_julong ) \ + f("9223372036854775807", BAD_INT, BAD_INT, 9223372036854775807LL, 9223372036854775807ULL ) \ + f("9223372036854775808", BAD_INT, BAD_INT, BAD_INT, 9223372036854775808ULL ) \ + f("-9223372036854775808", BAD_INT, BAD_INT, min_jlong, BAD_INT ) \ + f("18446744073709551615", BAD_INT, BAD_INT, BAD_INT, max_julong ) \ + \ + /* All edge cases without a k/m/g/t suffix */ \ + f("0x7ffffffe", max_jint-1, 0x7ffffffe, 0x7ffffffeLL, 0x7ffffffeULL ) \ + f("0x7fffffff", max_jint, 0x7fffffff, 0x7fffffffLL, 0x7fffffffULL ) \ + f("0x80000000", BAD_INT, 0x80000000, 0x80000000LL, 0x80000000ULL ) \ + f("0xfffffffe", BAD_INT, max_juint-1, 0xfffffffeLL, 0xfffffffeULL ) \ + f("0xffffffff", BAD_INT, max_juint, 0xffffffffLL, 0xffffffffULL ) \ + f("0x100000000", BAD_INT, BAD_INT, 0x100000000LL, 0x100000000ULL ) \ + f("-0x7fffffff", min_jint+1, BAD_INT, -0x7fffffffLL, BAD_INT ) \ + f("-0x80000000", min_jint, BAD_INT, -0x80000000LL, BAD_INT ) \ + f("-0x80000001", BAD_INT, BAD_INT, -0x80000001LL, BAD_INT ) \ + \ + f("0x7ffffffffffffffe", BAD_INT, BAD_INT, max_jlong-1, 0x7ffffffffffffffeULL ) \ + f("0x7fffffffffffffff", BAD_INT, BAD_INT, max_jlong, 0x7fffffffffffffffULL ) \ + f("0x8000000000000000", BAD_INT, BAD_INT, BAD_INT, 0x8000000000000000ULL ) \ + f("0xfffffffffffffffe", BAD_INT, BAD_INT, BAD_INT, max_julong-1 ) \ + f("0xffffffffffffffff", BAD_INT, BAD_INT, BAD_INT, max_julong ) \ + f("0x10000000000000000", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + f("-0x7fffffffffffffff", BAD_INT, BAD_INT, min_jlong+1, BAD_INT ) \ + f("-0x8000000000000000", BAD_INT, BAD_INT, min_jlong, BAD_INT ) \ + f("-0x8000000000000001", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + \ + /* edge cases for suffix: K */ \ + f("0x1ffffek", 0x1ffffe * k, 0x1ffffeU * k,0x1ffffeLL * k, 0x1ffffeULL * k ) \ + f("0x1fffffk", 0x1fffff * k, 0x1fffffU * k,0x1fffffLL * k, 0x1fffffULL * k ) \ + f("0x200000k", BAD_INT, 0x200000U * k,0x200000LL * k, 0x200000ULL * k ) \ + f("0x3ffffek", BAD_INT, 0x3ffffeU * k,0x3ffffeLL * k, 0x3ffffeULL * k ) \ + f("0x3fffffk", BAD_INT, 0x3fffffU * k,0x3fffffLL * k, 0x3fffffULL * k ) \ + f("0x400000k", BAD_INT, BAD_INT, 0x400000LL * k, 0x400000ULL * k ) \ + f("-0x1fffffk", -0x1fffff * k, BAD_INT, -0x1fffffLL * k, BAD_INT ) \ + f("-0x200000k", -0x200000 * k, BAD_INT, -0x200000LL * k, BAD_INT ) \ + f("-0x200001k", BAD_INT, BAD_INT, -0x200001LL * k, BAD_INT ) \ + \ + f("0x1ffffffffffffek", BAD_INT, BAD_INT, 0x1ffffffffffffeLL * k, 0x1ffffffffffffeULL * k ) \ + f("0x1fffffffffffffk", BAD_INT, BAD_INT, 0x1fffffffffffffLL * k, 0x1fffffffffffffULL * k ) \ + f("0x20000000000000k", BAD_INT, BAD_INT, BAD_INT, 0x20000000000000ULL * k ) \ + f("0x3ffffffffffffek", BAD_INT, BAD_INT, BAD_INT, 0x3ffffffffffffeULL * k ) \ + f("0x3fffffffffffffk", BAD_INT, BAD_INT, BAD_INT, 0x3fffffffffffffULL * k ) \ + f("0x40000000000000k", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + f("-0x1fffffffffffffk", BAD_INT, BAD_INT, -0x1fffffffffffffLL * k, BAD_INT ) \ + f("-0x20000000000000k", BAD_INT, BAD_INT, -0x20000000000000LL * k, BAD_INT ) \ + f("-0x20000000000001k", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + \ + /* edge cases for suffix: M */ \ + f("0x7fem", 0x7fe * m, 0x7feU * m, 0x7feLL * m, 0x7feULL * m ) \ + f("0x7ffm", 0x7ff * m, 0x7ffU * m, 0x7ffLL * m, 0x7ffULL * m ) \ + f("0x800m", BAD_INT, 0x800U * m, 0x800LL * m, 0x800ULL * m ) \ + f("0xffem", BAD_INT, 0xffeU * m, 0xffeLL * m, 0xffeULL * m ) \ + f("0xfffm", BAD_INT, 0xfffU * m, 0xfffLL * m, 0xfffULL * m ) \ + f("0x1000m", BAD_INT, BAD_INT, 0x1000LL * m, 0x1000ULL * m ) \ + f("-0x7ffm", -0x7ff * m, BAD_INT, -0x7ffLL * m, BAD_INT ) \ + f("-0x800m", -0x800 * m, BAD_INT, -0x800LL * m, BAD_INT ) \ + f("-0x801m", BAD_INT, BAD_INT, -0x801LL * m, BAD_INT ) \ + \ + f("0x7fffffffffem", BAD_INT, BAD_INT, 0x7fffffffffeLL * m, 0x7fffffffffeULL * m ) \ + f("0x7ffffffffffm", BAD_INT, BAD_INT, 0x7ffffffffffLL * m, 0x7ffffffffffULL * m ) \ + f("0x80000000000m", BAD_INT, BAD_INT, BAD_INT, 0x80000000000ULL * m ) \ + f("0xffffffffffem", BAD_INT, BAD_INT, BAD_INT, 0xffffffffffeULL * m ) \ + f("0xfffffffffffm", BAD_INT, BAD_INT, BAD_INT, 0xfffffffffffULL * m ) \ + f("0x100000000000m", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + f("-0x7ffffffffffm", BAD_INT, BAD_INT, -0x7ffffffffffLL * m, BAD_INT ) \ + f("-0x80000000000m", BAD_INT, BAD_INT, -0x80000000000LL * m, BAD_INT ) \ + f("-0x80000000001m", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + \ + /* edge cases for suffix: G */ \ + f("0x0g", 0x0 * g, 0x0U * g, 0x0LL * g, 0x0ULL * g ) \ + f("0x1g", 0x1 * g, 0x1U * g, 0x1LL * g, 0x1ULL * g ) \ + f("0x2g", BAD_INT, 0x2U * g, 0x2LL * g, 0x2ULL * g ) \ + f("0x3g", BAD_INT, 0x3U * g, 0x3LL * g, 0x3ULL * g ) \ + f("0x4g", BAD_INT, BAD_INT, 0x4LL * g, 0x4ULL * g ) \ + f("-0x1g", -0x1 * g, BAD_INT, -0x1LL * g, BAD_INT ) \ + f("-0x2g", -0x2 * g, BAD_INT, -0x2LL * g, BAD_INT ) \ + f("-0x3g", BAD_INT, BAD_INT, -0x3LL * g, BAD_INT ) \ + \ + f("0x1fffffffeg", BAD_INT, BAD_INT, 0x1fffffffeLL * g, 0x1fffffffeULL * g ) \ + f("0x1ffffffffg", BAD_INT, BAD_INT, 0x1ffffffffLL * g, 0x1ffffffffULL * g ) \ + f("0x200000000g", BAD_INT, BAD_INT, BAD_INT, 0x200000000ULL * g ) \ + f("0x3fffffffeg", BAD_INT, BAD_INT, BAD_INT, 0x3fffffffeULL * g ) \ + f("0x3ffffffffg", BAD_INT, BAD_INT, BAD_INT, 0x3ffffffffULL * g ) \ + f("0x400000000g", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + f("-0x1ffffffffg", BAD_INT, BAD_INT, -0x1ffffffffLL * g, BAD_INT ) \ + f("-0x200000000g", BAD_INT, BAD_INT, -0x200000000LL * g, BAD_INT ) \ + f("-0x200000001g", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + \ + /* edge cases for suffix: T */ \ + f("0x7ffffet", BAD_INT, BAD_INT, 0x7ffffeLL * t, 0x7ffffeULL * t ) \ + f("0x7ffffft", BAD_INT, BAD_INT, 0x7fffffLL * t, 0x7fffffULL * t ) \ + f("0x800000t", BAD_INT, BAD_INT, BAD_INT, 0x800000ULL * t ) \ + f("0xfffffet", BAD_INT, BAD_INT, BAD_INT, 0xfffffeULL * t ) \ + f("0xfffffft", BAD_INT, BAD_INT, BAD_INT, 0xffffffULL * t ) \ + f("0x1000000t", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) \ + f("-0x7ffffft", BAD_INT, BAD_INT, -0x7fffffLL * t, BAD_INT ) \ + f("-0x800000t", BAD_INT, BAD_INT, -0x800000LL * t, BAD_INT ) \ + f("-0x800001t", BAD_INT, BAD_INT, BAD_INT, BAD_INT ) + +#define INTEGER_TEST_i32(s, i32, u32, i64, u64) NumericArgument(s, i32), +#define INTEGER_TEST_u32(s, i32, u32, i64, u64) NumericArgument(s, u32), +#define INTEGER_TEST_i64(s, i32, u32, i64, u64) NumericArgument(s, i64), +#define INTEGER_TEST_u64(s, i32, u32, i64, u64) NumericArgument(s, u64), + +// signed 32-bit +template ::value), ENABLE_IF(sizeof(T) == 4)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_i32) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// unsigned 32-bit +template ::value), ENABLE_IF(sizeof(T) == 4)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_u32) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// signed 64-bit +template ::value), ENABLE_IF(sizeof(T) == 8)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + T t = static_cast(G) * k; + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_i64) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// unsigned 64-bit +template ::value), ENABLE_IF(sizeof(T) == 8)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + T t = static_cast(G) * k; + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_u64) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// Testing the parsing of -XX:= +// +// All of the integral types that can be used for command line options: +// int, uint, intx, uintx, uint64_t, size_t +// +// In all supported platforms, these types can be mapped to only 4 native types: +// {signed, unsigned} x {32-bit, 64-bit} +// +// We use SFINAE to pick the correct column in the INTEGER_TEST_TABLE for each type. + +TEST_VM_F(ArgumentsTest, set_numeric_flag_int) { + check_flag("TestFlagFor_int", [] (JVMFlag* flag) { + return flag->get_int(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_uint) { + check_flag("TestFlagFor_uint", [] (JVMFlag* flag) { + return flag->get_uint(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_intx) { + check_flag("TestFlagFor_intx", [] (JVMFlag* flag) { + return flag->get_intx(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_uintx) { + check_flag("TestFlagFor_uintx", [] (JVMFlag* flag) { + return flag->get_uintx(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_uint64_t) { + check_flag("TestFlagFor_uint64_t", [] (JVMFlag* flag) { + return flag->get_uint64_t(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_size_t) { + check_flag("TestFlagFor_size_t", [] (JVMFlag* flag) { + return flag->get_size_t(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_double) { + JVMFlag* flag = JVMFlag::find_flag("TestFlagFor_double"); + if (flag == NULL) { // not available in product builds + return; + } + + // TODO -- JDK-8282774 + // Need to add more test input that have a fractional part like "4.2". + NumericArgument valid_strings[] = { + NumericArgument("0", 0.0), + NumericArgument("1", 1.0), + NumericArgument("-0", -0.0), + NumericArgument("-1", -1.0), + }; + + auto getvalue = [] (JVMFlag* flag) { + return flag->get_double(); + }; + + check_numeric_flag(flag, getvalue, valid_strings, + ARRAY_SIZE(valid_strings), /*is_double=*/true); +} diff --git a/test/hotspot/gtest/runtime/test_largeOptions.cpp b/test/hotspot/gtest/runtime/test_largeOptions.cpp deleted file mode 100644 index a8d5af24915706f563a6b949678dcdc6b2c2a608..0000000000000000000000000000000000000000 --- a/test/hotspot/gtest/runtime/test_largeOptions.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -#include "precompiled.hpp" -#include "compiler/compiler_globals.hpp" -#include "runtime/arguments.hpp" -#include "runtime/flags/jvmFlag.hpp" -#include "runtime/globals.hpp" -#include "unittest.hpp" - -class LargeOptionsTest : public ::testing::Test { -public: - static bool test_option_value(const char* option, intx value) { - char buffer[100]; - UnlockDiagnosticVMOptions = true; - os::snprintf(buffer, 100, "%s=" INTX_FORMAT, option, value); - return Arguments::parse_argument(buffer, JVMFlagOrigin::COMMAND_LINE); - } - - static bool test_option_value(const char* option) { - UnlockDiagnosticVMOptions = true; - return Arguments::parse_argument(option, JVMFlagOrigin::COMMAND_LINE); - } -}; - -#ifdef _LP64 -// CompilerDirectivesLimit is a diagnostic int option. -TEST_VM(LARGE_OPTION, large_ints) { - for (intx x = max_jint - 1; x <= (intx)max_jint + 1; x++) { - bool result = LargeOptionsTest::test_option_value("CompilerDirectivesLimit", x); - if (x > max_jint) { - ASSERT_FALSE(result); - } else { - ASSERT_TRUE(result); - ASSERT_EQ(CompilerDirectivesLimit, x); - } - } -} - -TEST_VM(LARGE_OPTION, small_ints) { - for (intx x = min_jint + 1; x >= (intx)min_jint - 1; x--) { - bool result = LargeOptionsTest::test_option_value("CompilerDirectivesLimit", x); - if (x < min_jint) { - ASSERT_FALSE(result); - } else { - ASSERT_TRUE(result); - ASSERT_EQ(CompilerDirectivesLimit, x); - } - } -} - -TEST_VM(LARGE_OPTION, large_int_overflow) { // Test 0x100000000 - ASSERT_FALSE(LargeOptionsTest::test_option_value("CompilerDirectivesLimit", 4294967296)); -} -#endif - -// HandshakeTimeout is a diagnostic uint option. -TEST_VM(LARGE_OPTION, large_uints) { - for (uintx x = max_juint - 1; x <= (uintx)max_juint + 1; x++) { - bool result = LargeOptionsTest::test_option_value("HandshakeTimeout", x); - if (x <= max_juint) { - ASSERT_TRUE(result); - ASSERT_EQ(HandshakeTimeout, x); - } else { - ASSERT_FALSE(result); - } - } -} - -#ifdef _LP64 -// MaxJNILocalCapacity is an intx option. -TEST_VM(LARGE_OPTION, large_intxs) { - // max_intx + 1 equals min_intx! - for (julong x = max_intx - 1; x <= (julong)max_intx + 1; x++) { - ASSERT_TRUE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity", x)); - ASSERT_EQ((julong)MaxJNILocalCapacity, x); - } -} - -TEST_VM(LARGE_OPTION, small_intxs) { - ASSERT_TRUE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity", min_intx + 1)); - ASSERT_EQ(MaxJNILocalCapacity, -9223372036854775807); - ASSERT_TRUE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity", min_intx)); - ASSERT_EQ(MaxJNILocalCapacity, min_intx); - // Test value that's less than min_intx (-0x8000000000000001). - ASSERT_FALSE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity=-9223372036854775809")); -} -#endif diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index 60bd02a42eecfc7b2d003384b51d33e9376335be..bf642c04595b871ed9cb712c6e47af906c524d8a 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -32,6 +32,7 @@ #include "utilities/ostream.hpp" #include "utilities/align.hpp" #include "unittest.hpp" +#include "runtime/frame.inline.hpp" static size_t small_page_size() { return os::vm_page_size(); @@ -372,6 +373,15 @@ static inline bool can_reserve_executable_memory(void) { #define PRINT_MAPPINGS(s) { tty->print_cr("%s", s); os::print_memory_mappings((char*)p, total_range_len, tty); } //#define PRINT_MAPPINGS +// Release a range allocated with reserve_multiple carefully, to not trip mapping +// asserts on Windows in os::release_memory() +static void carefully_release_multiple(address start, int num_stripes, size_t stripe_len) { + for (int stripe = 0; stripe < num_stripes; stripe++) { + address q = start + (stripe * stripe_len); + EXPECT_TRUE(os::release_memory((char*)q, stripe_len)); + } +} + #ifndef _AIX // JDK-8257041 // Reserve an area consisting of multiple mappings // (from multiple calls to os::reserve_memory) @@ -384,25 +394,34 @@ static address reserve_multiple(int num_stripes, size_t stripe_len) { const bool exec_supported = can_reserve_executable_memory(); #endif - size_t total_range_len = num_stripes * stripe_len; - // Reserve a large contiguous area to get the address space... - address p = (address)os::reserve_memory(total_range_len); - EXPECT_NE(p, (address)NULL); - // .. release it... - EXPECT_TRUE(os::release_memory((char*)p, total_range_len)); - // ... re-reserve in the same spot multiple areas... - for (int stripe = 0; stripe < num_stripes; stripe++) { - address q = p + (stripe * stripe_len); - // Commit, alternatingly with or without exec permission, - // to prevent kernel from folding these mappings. + address p = NULL; + for (int tries = 0; tries < 256 && p == NULL; tries ++) { + size_t total_range_len = num_stripes * stripe_len; + // Reserve a large contiguous area to get the address space... + p = (address)os::reserve_memory(total_range_len); + EXPECT_NE(p, (address)NULL); + // .. release it... + EXPECT_TRUE(os::release_memory((char*)p, total_range_len)); + // ... re-reserve in the same spot multiple areas... + for (int stripe = 0; stripe < num_stripes; stripe++) { + address q = p + (stripe * stripe_len); + // Commit, alternatingly with or without exec permission, + // to prevent kernel from folding these mappings. #ifdef __APPLE__ - const bool executable = exec_supported ? (stripe % 2 == 0) : false; + const bool executable = exec_supported ? (stripe % 2 == 0) : false; #else - const bool executable = stripe % 2 == 0; + const bool executable = stripe % 2 == 0; #endif - q = (address)os::attempt_reserve_memory_at((char*)q, stripe_len, executable); - EXPECT_NE(q, (address)NULL); - EXPECT_TRUE(os::commit_memory((char*)q, stripe_len, executable)); + q = (address)os::attempt_reserve_memory_at((char*)q, stripe_len, executable); + if (q == NULL) { + // Someone grabbed that area concurrently. Cleanup, then retry. + tty->print_cr("reserve_multiple: retry (%d)...", stripe); + carefully_release_multiple(p, stripe, stripe_len); + p = NULL; + } else { + EXPECT_TRUE(os::commit_memory((char*)q, stripe_len, executable)); + } + } } return p; } @@ -425,14 +444,6 @@ static address reserve_one_commit_multiple(int num_stripes, size_t stripe_len) { } #ifdef _WIN32 -// Release a range allocated with reserve_multiple carefully, to not trip mapping -// asserts on Windows in os::release_memory() -static void carefully_release_multiple(address start, int num_stripes, size_t stripe_len) { - for (int stripe = 0; stripe < num_stripes; stripe++) { - address q = start + (stripe * stripe_len); - EXPECT_TRUE(os::release_memory((char*)q, stripe_len)); - } -} struct NUMASwitcher { const bool _b; NUMASwitcher(bool v): _b(UseNUMAInterleaving) { UseNUMAInterleaving = v; } @@ -865,3 +876,13 @@ TEST_VM(os, iso8601_time) { // Canary should still be intact EXPECT_EQ(buffer[os::iso8601_timestamp_size], 'X'); } + +TEST_VM(os, is_first_C_frame) { +#if !defined(_WIN32) && !defined(ZERO) + frame invalid_frame; + EXPECT_TRUE(os::is_first_C_frame(&invalid_frame)); // the frame has zeroes for all values + + frame cur_frame = os::current_frame(); // this frame has to have a sender + EXPECT_FALSE(os::is_first_C_frame(&cur_frame)); +#endif // _WIN32 +} diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 518238d9c0a3b114f16d8614ad8b1f6c321cc07a..870f1d3c596e431984c93de765268c4994301998 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -94,7 +94,6 @@ gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8241293 macosx-x64 # :hotspot_runtime runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java 8253437 windows-x64 -runtime/cds/DeterministicDump.java 8253495 generic-all runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64 runtime/os/TestTracePageSizes.java#no-options 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#explicit-large-page-size 8267460 linux-aarch64 diff --git a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java index fd6c8ca50bf29daa43d37a1421680879380fb285..15a603822455ff29e745a7b402a946a1d2c0ce2c 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java +++ b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, Red Hat, Inc. All rights reserved. + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,6 +73,13 @@ public class TestCodeEntryAlignment { "-XX:CodeEntryAlignment=" + align ); } + for (int align = 256; align <= 1024; align *= 2) { + shouldPass( + "-XX:+UnlockExperimentalVMOptions", + "-XX:CodeCacheSegmentSize=" + align, + "-XX:CodeEntryAlignment=" + align + ); + } } } diff --git a/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java index 4c4c38848d81dbd5ad257ae14091dde8ef2cc0c6..103e99fefefe395a8d12ae8c8c5f5ba493c0f376 100644 --- a/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java +++ b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java @@ -38,6 +38,19 @@ * compiler.arraycopy.TestArrayCopyAsLoadsStores */ +/* + * @test + * @bug 8282590 + * @library / + * + * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m* + * -XX:TypeProfileLevel=200 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode + * -XX:-TieredCompilation -XX:+StressReflectiveCode -XX:-ReduceInitialCardMarks + * compiler.arraycopy.TestArrayCopyAsLoadsStores + */ + package compiler.arraycopy; import java.util.Arrays; diff --git a/test/hotspot/jtreg/compiler/c2/TestBit.java b/test/hotspot/jtreg/compiler/c2/TestBit.java index f8af537a62fd27430b84c0483b9284343a44970f..02596b7ee55fcab726f9d1516a7ae2ebbcebbcdd 100644 --- a/test/hotspot/jtreg/compiler/c2/TestBit.java +++ b/test/hotspot/jtreg/compiler/c2/TestBit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import jdk.test.lib.process.ProcessTools; * @library /test/lib / * * @requires vm.flagless - * @requires os.arch=="aarch64" | os.arch=="amd64" | os.arch == "ppc64le" + * @requires os.arch=="aarch64" | os.arch=="amd64" | os.arch == "ppc64le" | os.arch == "riscv64" * @requires vm.debug == true & vm.compiler2.enabled * * @run driver compiler.c2.TestBit @@ -55,7 +55,8 @@ public class TestBit { String expectedTestBitInstruction = "ppc64le".equals(System.getProperty("os.arch")) ? "ANDI" : "aarch64".equals(System.getProperty("os.arch")) ? "tb" : - "amd64".equals(System.getProperty("os.arch")) ? "test" : null; + "amd64".equals(System.getProperty("os.arch")) ? "test" : + "riscv64".equals(System.getProperty("os.arch")) ? "andi" : null; if (expectedTestBitInstruction != null) { output.shouldContain(expectedTestBitInstruction); diff --git a/test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java b/test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java new file mode 100644 index 0000000000000000000000000000000000000000..9e4ba1dd6f0a14bcb2fcad9e369a4841b64d2752 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022, Red Hat, Inc. All rights reserved. + * 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 8283451 + * @summary C2: assert(_base == Long) failed: Not a Long + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressCCP -XX:+StressIGVN + * -Xcomp -XX:CompileOnly=TestModDivTopInput -XX:-TieredCompilation -XX:StressSeed=87628618 TestModDivTopInput + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressCCP -XX:+StressIGVN + * -Xcomp -XX:CompileOnly=TestModDivTopInput -XX:-TieredCompilation TestModDivTopInput + */ + +public class TestModDivTopInput { + + public static final int N = 400; + + public static float fFld=-2.447F; + public long lFld=-189L; + + public void mainTest(String[] strArr1) { + + int i18, i20=-14, i21, iArr2[]=new int[N]; + boolean b2=true; + double d2; + long l; + + init(iArr2, -13265); + + for (i18 = 13; i18 < 315; ++i18) { + if (b2) continue; + for (d2 = 5; d2 < 83; d2++) { + } + for (i21 = 4; i21 < 83; i21++) { + for (l = 1; 2 > l; l++) { + } + b2 = b2; + lFld %= (i20 | 1); + i20 = (int)fFld; + i20 += (int)d2; + } + } + } + + public static void main(String[] strArr) { + TestModDivTopInput _instance = new TestModDivTopInput(); + for (int i = 0; i < 10; i++ ) { + _instance.mainTest(strArr); + } + } + + static void init(int[] arr, int v) { + for (int i = 0; i < arr.length; i++) { + arr[i] = v; + } + } + +} diff --git a/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java b/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java index 71689eaca1843368ef1fc73b45a8aa4656045751..af23628577b0ecb98fcbaebddb0cb74693e457cb 100644 --- a/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java +++ b/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java @@ -1,5 +1,6 @@ /* * Copyright 2009 Goldman Sachs International. All Rights Reserved. + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +28,7 @@ * @bug 6865031 * @summary Application gives bad result (throws bad exception) with compressed oops * + * @requires vm.bits == 64 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops * -XX:HeapBaseMinAddress=32g -XX:-LoopUnswitching * -XX:CompileCommand=inline,compiler.c2.cr6865031.AbstractMemoryEfficientList::equals diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestSkeletonPredicates.java b/test/hotspot/jtreg/compiler/c2/irTests/TestSkeletonPredicates.java new file mode 100644 index 0000000000000000000000000000000000000000..79bcd16cfb252ff539cf3b57136d20e35f10e5be --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestSkeletonPredicates.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022, Red Hat, Inc. All rights reserved. + * 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 compiler.c2.irTests; + +import compiler.lib.ir_framework.*; +import jdk.test.lib.Utils; +import java.util.Random; + +/* + * @test + * @bug 8278228 + * @summary C2: Improve identical back-to-back if elimination + * @library /test/lib / + * @run driver compiler.c2.irTests.TestSkeletonPredicates + */ + +public class TestSkeletonPredicates { + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:-UseLoopPredicate", "-XX:LoopUnrollLimit=240", "-XX:+StressIGVN", "-XX:StressSeed=255527877"); + TestFramework.runWithFlags("-XX:-UseLoopPredicate", "-XX:LoopUnrollLimit=240", "-XX:+StressIGVN"); + } + + static volatile int barrier; + + @ForceInline + static boolean test1_helper(int start, int stop, double[] array1, double[] array2) { + for (int i = start; i < stop; i++) { + if ((i % 2) == 0) { + array1[i] = 42.42; + } else { + barrier = 0x42; + } + } + return false; + } + + @Test + @IR(counts = { IRNode.COUNTEDLOOP, "3" }) + static double[] test1(int stop, double[] array2) { + double[] array1 = null; + array1 = new double[10]; + for (int j = 0; j < stop; j++) { + if (test1_helper(8, j, array1, array2)) { + return null; + } + } + return array1; + } + + @Run(test = "test1") + void test1_runner() { + double[] array2 = new double[10]; + double[] array3 = new double[1000]; + test1_helper(1, 1000, array3, array3); + test1(11, array3); + } +} diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestSuperwordFailsUnrolling.java b/test/hotspot/jtreg/compiler/c2/irTests/TestSuperwordFailsUnrolling.java new file mode 100644 index 0000000000000000000000000000000000000000..2ba5e4e73400381c34e810eaaaa4988d15fe7265 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestSuperwordFailsUnrolling.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022, Red Hat, Inc. All rights reserved. + * 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 compiler.c2.irTests; + +import compiler.lib.ir_framework.*; +import sun.hotspot.WhiteBox; + +/* + * @test + * @bug 8283187 + * @summary C2: loop candidate for superword not always unrolled fully if superword fails + * @library /test/lib / + * @build sun.hotspot.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -DSkipWhiteBoxInstall=true -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI compiler.c2.irTests.TestSuperwordFailsUnrolling + */ + +public class TestSuperwordFailsUnrolling { + private static int v = 0; + private final static WhiteBox wb = WhiteBox.getWhiteBox(); + + public static void main(String[] args) { + Object avx = wb.getVMFlag("UseAVX"); + if (avx != null && ((Long)avx) > 2) { + TestFramework.runWithFlags("-XX:UseAVX=2", "-XX:LoopMaxUnroll=8"); + } + TestFramework.runWithFlags("-XX:LoopMaxUnroll=8"); + } + + @Test + @IR(applyIf = { "UsePopCountInstruction", "true" }, counts = { IRNode.POPCOUNT_L, "10" }) + private static int test(long[] array1, long[] array2) { + v = 0; + for (int i = 0; i < array1.length; i++) { + v += Long.bitCount(array1[i]); + } + return v; + } + + @Run(test = "test") + void test_runner() { + long[] array = new long[1000]; + test(array, array); + } +} diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java index 6329ed74e9e859e334542f7a1e310cc035b547d1..50294e068cb4894dd73ce48d16ce77724b6abcc4 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ package compiler.intrinsics.sha.cli; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedRISCV64CPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU; @@ -49,6 +50,8 @@ public class TestUseSHA1IntrinsicsOptionOnUnsupportedCPU { DigestOptionsBase.USE_SHA1_INTRINSICS_OPTION), new GenericTestCaseForUnsupportedAArch64CPU( DigestOptionsBase.USE_SHA1_INTRINSICS_OPTION), + new GenericTestCaseForUnsupportedRISCV64CPU( + DigestOptionsBase.USE_SHA1_INTRINSICS_OPTION), new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU( DigestOptionsBase.USE_SHA1_INTRINSICS_OPTION), new GenericTestCaseForOtherCPU( diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java index dbc938d2b542ae4a68b0407251ddcd46f6b053a9..9ce909185f24088ce5e785904f4b4b2f539ec936 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ package compiler.intrinsics.sha.cli; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedRISCV64CPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU; @@ -49,6 +50,8 @@ public class TestUseSHA256IntrinsicsOptionOnUnsupportedCPU { DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION), new GenericTestCaseForUnsupportedAArch64CPU( DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION), + new GenericTestCaseForUnsupportedRISCV64CPU( + DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION), new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU( DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION), new GenericTestCaseForOtherCPU( diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java index eef34f01d841575d25d7bdb015025244d52b3620..1ab05caca4e8bd53cabec5060f71f44fc78eb572 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ package compiler.intrinsics.sha.cli; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedRISCV64CPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU; @@ -49,6 +50,8 @@ public class TestUseSHA512IntrinsicsOptionOnUnsupportedCPU { DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION), new GenericTestCaseForUnsupportedAArch64CPU( DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION), + new GenericTestCaseForUnsupportedRISCV64CPU( + DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION), new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU( DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION), new GenericTestCaseForOtherCPU( diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java index df471c4bf03fe78c6ace8023d7036293e38f19fa..e6131d6c0aec284d6774362261b951fe82f0adb7 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ package compiler.intrinsics.sha.cli; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedRISCV64CPU; import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; import compiler.intrinsics.sha.cli.testcases.UseSHASpecificTestCaseForUnsupportedCPU; @@ -49,6 +50,8 @@ public class TestUseSHAOptionOnUnsupportedCPU { DigestOptionsBase.USE_SHA_OPTION), new GenericTestCaseForUnsupportedAArch64CPU( DigestOptionsBase.USE_SHA_OPTION), + new GenericTestCaseForUnsupportedRISCV64CPU( + DigestOptionsBase.USE_SHA_OPTION), new UseSHASpecificTestCaseForUnsupportedCPU( DigestOptionsBase.USE_SHA_OPTION), new GenericTestCaseForOtherCPU( diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java index 2b8d143dd68b575c7dff17451a403c13b9042b5e..468cd83d7a2887871967ea79bb47cc7e17490d3a 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import jdk.test.lib.cli.predicate.OrPredicate; /** * Generic test case for SHA-related options targeted to any CPU except - * AArch64, PPC, S390x, and X86. + * AArch64, RISCV64, PPC, S390x, and X86. */ public class GenericTestCaseForOtherCPU extends DigestOptionsBase.TestCase { @@ -44,13 +44,14 @@ public class GenericTestCaseForOtherCPU extends } public GenericTestCaseForOtherCPU(String optionName, boolean checkUseSHA) { - // Execute the test case on any CPU except AArch64, PPC, S390x, and X86. + // Execute the test case on any CPU except AArch64, RISCV64, PPC, S390x, and X86. super(optionName, new NotPredicate( new OrPredicate(Platform::isAArch64, + new OrPredicate(Platform::isRISCV64, new OrPredicate(Platform::isS390x, new OrPredicate(Platform::isPPC, new OrPredicate(Platform::isX64, - Platform::isX86)))))); + Platform::isX86))))))); this.checkUseSHA = checkUseSHA; } @@ -59,7 +60,7 @@ public class GenericTestCaseForOtherCPU extends protected void verifyWarnings() throws Throwable { String shouldPassMessage = String.format("JVM should start with " + "option '%s' without any warnings", optionName); - // Verify that on non-x86 and non-AArch64 CPU usage of SHA-related + // Verify that on non-x86, non-RISCV64 and non-AArch64 CPU usage of SHA-related // options will not cause any warnings. CommandLineOptionTest.verifySameJVMStartup(null, new String[] { ".*" + optionName + ".*" }, shouldPassMessage, diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedRISCV64CPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedRISCV64CPU.java new file mode 100644 index 0000000000000000000000000000000000000000..2ecfec07a4ca50a91468cb40b97402294248e757 --- /dev/null +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedRISCV64CPU.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved. + * 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 compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.DigestOptionsBase; +import jdk.test.lib.process.ExitCode; +import jdk.test.lib.Platform; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; + +/** + * Generic test case for SHA-related options targeted to RISCV64 CPUs + * which don't support instruction required by the tested option. + */ +public class GenericTestCaseForUnsupportedRISCV64CPU extends + DigestOptionsBase.TestCase { + + final private boolean checkUseSHA; + + public GenericTestCaseForUnsupportedRISCV64CPU(String optionName) { + this(optionName, true); + } + + public GenericTestCaseForUnsupportedRISCV64CPU(String optionName, boolean checkUseSHA) { + super(optionName, new AndPredicate(Platform::isRISCV64, + new NotPredicate(DigestOptionsBase.getPredicateForOption( + optionName)))); + + this.checkUseSHA = checkUseSHA; + } + + @Override + protected void verifyWarnings() throws Throwable { + String shouldPassMessage = String.format("JVM startup should pass with" + + "option '-XX:-%s' without any warnings", optionName); + //Verify that option could be disabled without any warnings. + CommandLineOptionTest.verifySameJVMStartup(null, new String[] { + DigestOptionsBase.getWarningForUnsupportedCPU(optionName) + }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + DigestOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, + CommandLineOptionTest.prepareBooleanFlag(optionName, false)); + + if (checkUseSHA) { + shouldPassMessage = String.format("If JVM is started with '-XX:-" + + "%s' '-XX:+%s', output should contain warning.", + DigestOptionsBase.USE_SHA_OPTION, optionName); + + // Verify that when the tested option is enabled, then + // a warning will occur in VM output if UseSHA is disabled. + if (!optionName.equals(DigestOptionsBase.USE_SHA_OPTION)) { + CommandLineOptionTest.verifySameJVMStartup( + new String[] { DigestOptionsBase.getWarningForUnsupportedCPU(optionName) }, + null, + shouldPassMessage, + shouldPassMessage, + ExitCode.OK, + DigestOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, + CommandLineOptionTest.prepareBooleanFlag(DigestOptionsBase.USE_SHA_OPTION, false), + CommandLineOptionTest.prepareBooleanFlag(optionName, true)); + } + } + } + + @Override + protected void verifyOptionValues() throws Throwable { + // Verify that option is disabled by default. + CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", + String.format("Option '%s' should be disabled by default", + optionName), + DigestOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS); + + if (checkUseSHA) { + // Verify that option is disabled even if it was explicitly enabled + // using CLI options. + CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", + String.format("Option '%s' should be off on unsupported " + + "RISCV64CPU even if set to true directly", optionName), + DigestOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, + CommandLineOptionTest.prepareBooleanFlag(optionName, true)); + + // Verify that option is disabled when +UseSHA was passed to JVM. + CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", + String.format("Option '%s' should be off on unsupported " + + "RISCV64CPU even if %s flag set to JVM", + optionName, CommandLineOptionTest.prepareBooleanFlag( + DigestOptionsBase.USE_SHA_OPTION, true)), + DigestOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, + CommandLineOptionTest.prepareBooleanFlag( + DigestOptionsBase.USE_SHA_OPTION, true)); + } + } +} diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java new file mode 100644 index 0000000000000000000000000000000000000000..afc308c37dd7a12a8d6ad93d394d50e3bd4095e2 --- /dev/null +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.intrinsics.string; + +/* + * @test + * @bug 8999999 + * @summary Validates StringCoding.countPositives intrinsic with a small range of tests. + * @library /compiler/patches + * + * @build java.base/java.lang.Helper + * @run main compiler.intrinsics.string.TestCountPositives + */ + +public class TestCountPositives { + + private static byte[] tBa = new byte[4096 + 16]; + + /** + * Completely initialize the test array, preparing it for tests of the + * StringCoding.hasNegatives method with a given array segment offset, + * length, and number of negative bytes. + */ + public static void initialize(int off, int len, int neg) { + assert (len + off <= tBa.length); + // insert "canary" (negative) values before offset + for (int i = 0; i < off; ++i) { + tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + } + // fill the array segment + for (int i = off; i < len + off; ++i) { + tBa[i] = (byte) (((i - off + 15) & 0x7F)); + } + if (neg != 0) { + // modify a number (neg) disparate array bytes inside + // segment to be negative. + int div = (neg > 1) ? (len - 1) / (neg - 1) : 0; + int idx; + for (int i = 0; i < neg; ++i) { + idx = off + (len - 1) - div * i; + tBa[idx] = (byte) (0x80 | tBa[idx]); + } + } + // insert "canary" negative values after array segment + for (int i = len + off; i < tBa.length; ++i) { + tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + } + } + + /** Sizes of array segments to test. */ + private static int sizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 17, 19, 23, 37, 61, 131, + 4099 }; + + /** + * Test different array segment sizes, offsets, and number of negative + * bytes. + */ + public static void test_countPositives() throws Exception { + int len, off; + int ng; + + for (ng = 0; ng < 57; ++ng) { // number of negatives in array segment + for (off = 0; off < 8; ++off) { // starting offset of array segment + for (int i = 0; i < sizes.length; ++i) { // array segment size + // choice + len = sizes[i]; + if (len + off > tBa.length) + continue; + initialize(off, len, ng); + int calculated = Helper.StringCodingCountPositives(tBa, off, len); + int expected = countPositives(tBa, off, len); + if (calculated != expected) { + if (expected != len && calculated >= 0 && calculated < expected) { + // allow intrinsics to return early with a lower value, + // but only if we're not expecting the full length (no + // negative bytes) + continue; + } + throw new Exception("Failed test countPositives " + "offset: " + off + " " + + "length: " + len + " " + "return: " + calculated + " expected: " + expected + " negatives: " + + ng); + } + } + } + } + } + + private static int countPositives(byte[] ba, int off, int len) { + int limit = off + len; + for (int i = off; i < limit; i++) { + if (ba[i] < 0) { + return i - off; + } + } + return len; + } + + public void run() throws Exception { + // iterate to eventually get intrinsic inlined + for (int j = 0; j < 1000; ++j) { + test_countPositives(); + } + } + + public static void main(String[] args) throws Exception { + (new TestCountPositives()).run(); + System.out.println("countPositives validated"); + } +} diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java index 9d26ed16eb67887d0d5aced98ed92371cb7f4ad4..ec5b9337b49bc64533110725cbb572628e23814f 100644 --- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java @@ -83,6 +83,11 @@ public class DisassembleCodeBlobTest { + " : non-null return value for invalid installCode"); } + private void checkLineStart(CompileCodeTestCase testCase, String line, String match) { + Asserts.assertTrue(line.startsWith(match), + testCase + " : line \"" + line + "\" does not start with: \"" + match +"\""); + } + private void check(CompileCodeTestCase testCase) { System.out.println(testCase); // to have a clean state @@ -98,19 +103,33 @@ public class DisassembleCodeBlobTest { } // The very first call to the disassembler contains a string specifying the // architecture: [Disassembling for mach='i386:x86-64'] - // Therefore compare strings 2 and 3. + // so discard it and try again. String str2 = CompilerToVMHelper.disassembleCodeBlob(installedCode); - String str3 = CompilerToVMHelper.disassembleCodeBlob(installedCode); - String[] str2Lines = str2.split(System.lineSeparator()); - String[] str3Lines = str3.split(System.lineSeparator()); - // skip the first two lines since it contains a timestamp that may vary from different invocations - // - // Compiled method (c2) 309 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes) - // - // Compiled method (c2) 310 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes) - for (int i = 2; i < str2Lines.length; i++) { - Asserts.assertEQ(str2Lines[i], str3Lines[i], - testCase + " : 3nd invocation returned different value from 2nd"); + String[] strLines = str2.split("\\R"); + // Check some basic layout + int MIN_LINES = 5; + Asserts.assertTrue(strLines.length > 2, + testCase + " : read " + strLines.length + " lines, " + MIN_LINES + " expected"); + int l = 1; + checkLineStart(testCase, strLines[l++], "Compiled method "); // 2 + checkLineStart(testCase, strLines[l++], " total in heap "); // 3 + int foundDisassemblyLine = -1; + int foundEntryPointLine = -1; + for (; l < strLines.length; ++l) { + String line = strLines[l]; + if (line.equals("[Disassembly]") || line.equals("[MachCode]")) { + Asserts.assertTrue(foundDisassemblyLine == -1, + testCase + " : Duplicate disassembly section markers found at lines " + foundDisassemblyLine + " and " + l); + foundDisassemblyLine = l; + } + if (line.equals("[Entry Point]") || line.equals("[Verified Entry Point]")) { + Asserts.assertTrue(foundDisassemblyLine != -1, + testCase + " : entry point found but [Disassembly] section missing "); + foundEntryPointLine = l; + break; + } } + Asserts.assertTrue(foundDisassemblyLine != -1, testCase + " : no disassembly section found"); + Asserts.assertTrue(foundEntryPointLine != -1, testCase + " : no entry point found"); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java index 033ed28d2e5c0e4e14007d01490495237234ff17..de91a0054b2a0fca1fe4255d5c08750c4872c328 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java @@ -173,6 +173,7 @@ public class IRNode { public static final String DIV_L = START + "DivL" + MID + END; public static final String CONV_I2L = START + "ConvI2L" + MID + END; public static final String CONV_L2I = START + "ConvL2I" + MID + END; + public static final String POPCOUNT_L = START + "PopCountL" + MID + END; public static final String VECTOR_CAST_B2X = START + "VectorCastB2X" + MID + END; public static final String VECTOR_CAST_S2X = START + "VectorCastS2X" + MID + END; diff --git a/test/hotspot/jtreg/compiler/loopopts/FillArrayWithUnsafe.java b/test/hotspot/jtreg/compiler/loopopts/FillArrayWithUnsafe.java new file mode 100644 index 0000000000000000000000000000000000000000..6e3b840987ae2d674d73608f45e423bb2363bf5e --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/FillArrayWithUnsafe.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2022, Arm Limited. All rights reserved. + * 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 8283408 + * @summary Fill a byte array with Java Unsafe API + * @run main/othervm -XX:+OptimizeFill compiler.loopopts.FillArrayWithUnsafe + */ + +package compiler.loopopts; + +import java.lang.reflect.Field; + +import sun.misc.Unsafe; + +public class FillArrayWithUnsafe { + + private static Unsafe unsafe; + + public static void main(String[] args) throws Exception { + Class klass = Unsafe.class; + Field field = klass.getDeclaredField("theUnsafe"); + field.setAccessible(true); + unsafe = (Unsafe) field.get(null); + + byte[] buffer; + // Make sure method newByteArray is compiled by C2 + for (int i = 0; i < 50000; i++) { + buffer = newByteArray(100, (byte) 0x80); + } + } + + public static byte[] newByteArray(int size, byte val) { + byte[] arr = new byte[size]; + int offset = unsafe.arrayBaseOffset(byte[].class); + for (int i = offset; i < offset + size; i++) { + unsafe.putByte(arr, i, val); + } + return arr; + } +} + diff --git a/test/hotspot/jtreg/compiler/loopopts/TestPredicateInputBelowLoopPredicate.java b/test/hotspot/jtreg/compiler/loopopts/TestPredicateInputBelowLoopPredicate.java index 8ffa476ff26c6c798661ed2711f0338b922e587e..3b0cc314074d3e078006f096fab4003de193d7f6 100644 --- a/test/hotspot/jtreg/compiler/loopopts/TestPredicateInputBelowLoopPredicate.java +++ b/test/hotspot/jtreg/compiler/loopopts/TestPredicateInputBelowLoopPredicate.java @@ -24,7 +24,7 @@ /* * @test * bug 8280799 - * @summary С2: assert(false) failed: cyclic dependency prevents range check elimination + * @summary C2: assert(false) failed: cyclic dependency prevents range check elimination * @run main/othervm -XX:-BackgroundCompilation -XX:-UseCountedLoopSafepoints TestPredicateInputBelowLoopPredicate */ diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Double.java b/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Double.java index 2e3e2717a65b594cf7dedcfa7e739ddd87cd18ce..7be8af6d035c044ef8d6a70273cb88368052749e 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Double.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Double.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8074981 * @summary Add C2 x86 Superword support for scalar product reduction optimizations : float test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Float.java b/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Float.java index 0e06a9e4327aa762b72217041c88bd8d9be73019..797927b42bf95e20576146f88ffd577468671f39 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Float.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Float.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8074981 * @summary Add C2 x86 Superword support for scalar product reduction optimizations : float test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Int.java b/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Int.java index c3cdbf3746404d0e9a95da35e8e5c0d5283ab615..be8f7d586c2da4d230b28d82e66fe4e9ad5e3d97 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Int.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/ProdRed_Int.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8074981 * @summary Add C2 x86 Superword support for scalar product reduction optimizations : int test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java index d33bd411f162bb3c4546af80a45b756471162eda..d96d5e29c00708353cbc75780584af9b799551c4 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8074981 * @summary Add C2 x86 Superword support for scalar product reduction optimizations : int test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions * -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Double.java b/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Double.java index 992fa4b516136bed7f9882acbddd557050d251e5..b09c873d05d74f29be5258cd13fbb8e2b1292249 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Double.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Double.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8138583 * @summary Add C2 AArch64 Superword support for scalar sum reduction optimizations : double abs & neg test - * @requires os.arch=="aarch64" + * @requires os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Float.java b/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Float.java index 3e79b3528b71df491f29e55eb5305d99f1ef9df0..fe40ed6f98d4fd58c7aaf90cac0c307c6672523d 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Float.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Float.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8138583 * @summary Add C2 AArch64 Superword support for scalar sum reduction optimizations : float abs & neg test - * @requires os.arch=="aarch64" + * @requires os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/SumRedSqrt_Double.java b/test/hotspot/jtreg/compiler/loopopts/superword/SumRedSqrt_Double.java index 6603dd224ef9f4faf4c2898e70afb44325a35230..516319104933dbb0147a794b67d77c056a7db15c 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/SumRedSqrt_Double.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/SumRedSqrt_Double.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8135028 * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double sqrt test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Double.java b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Double.java index d9a0c98800499ea0bcf10f373944f2ed2c9f339a..d999ae423cf2c525b1583d3f77a9c59ae0857975 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Double.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Double.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8074981 * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Float.java b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Float.java index 722db95aed34aa98174dbe36308d1cc0383b553c..65912a5c7faab89283babb091eaed0c7a45bf8c4 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Float.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Float.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8074981 * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : float test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Int.java b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Int.java index f58f21feb2327e4d779e18fa554821b8d5e7079c..fffdc2f75659ac4e7443ce13dbf215060508be2a 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Int.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Int.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8074981 * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : int test - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 diff --git a/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java b/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java index ded4a58945d09e2337bbea37a0a416445b77377a..6d8b5be79bf84a30556901c98bf53768fd285fd6 100644 --- a/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java +++ b/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java @@ -32,6 +32,11 @@ public class Helper { return StringCoding.hasNegatives(ba, off, len); } + @jdk.internal.vm.annotation.ForceInline + public static int StringCodingCountPositives(byte[] ba, int off, int len) { + return StringCoding.countPositives(ba, off, len); + } + @jdk.internal.vm.annotation.ForceInline public static byte[] compressByte(byte[] src, int srcOff, int dstSize, int dstOff, int len) { byte[] dst = new byte[dstSize]; diff --git a/test/hotspot/jtreg/compiler/runtime/Test6826736.java b/test/hotspot/jtreg/compiler/runtime/Test6826736.java index 2f078506e55f3f5455873db3f68304302bc1ca9b..0b028947f7766b3628d438f4da9e68acfb64d5c7 100644 --- a/test/hotspot/jtreg/compiler/runtime/Test6826736.java +++ b/test/hotspot/jtreg/compiler/runtime/Test6826736.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ * @bug 6826736 * @summary CMS: core dump with -XX:+UseCompressedOops * + * @requires vm.bits == 64 * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch * -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g * -XX:CompileThreshold=100 -XX:-BlockLayoutRotateLoops diff --git a/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java b/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java index 782ab6b9b46dcd773534a69e5449c23d15f90698..e922c5b885397a0584db25c3dd3075ba6176a9b7 100644 --- a/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java +++ b/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,16 @@ public class IntrinsicPredicates { public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE = new OrPredicate(new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" }, null), + new OrPredicate(new CPUSpecificPredicate("riscv64.*", new String[] { "sha1" }, null), new OrPredicate(new CPUSpecificPredicate("s390.*", new String[] { "sha1" }, null), // x86 variants new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "sha" }, null), new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] { "sha" }, null), - new CPUSpecificPredicate("x86.*", new String[] { "sha" }, null))))); + new CPUSpecificPredicate("x86.*", new String[] { "sha" }, null)))))); public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE = new OrPredicate(new CPUSpecificPredicate("aarch64.*", new String[] { "sha256" }, null), + new OrPredicate(new CPUSpecificPredicate("riscv64.*", new String[] { "sha256" }, null), new OrPredicate(new CPUSpecificPredicate("s390.*", new String[] { "sha256" }, null), new OrPredicate(new CPUSpecificPredicate("ppc64.*", new String[] { "sha" }, null), new OrPredicate(new CPUSpecificPredicate("ppc64le.*", new String[] { "sha" }, null), @@ -84,10 +86,11 @@ public class IntrinsicPredicates { new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] { "sha" }, null), new OrPredicate(new CPUSpecificPredicate("x86.*", new String[] { "sha" }, null), new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "avx2", "bmi2" }, null), - new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null))))))))); + new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null)))))))))); public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE = new OrPredicate(new CPUSpecificPredicate("aarch64.*", new String[] { "sha512" }, null), + new OrPredicate(new CPUSpecificPredicate("riscv64.*", new String[] { "sha512" }, null), new OrPredicate(new CPUSpecificPredicate("s390.*", new String[] { "sha512" }, null), new OrPredicate(new CPUSpecificPredicate("ppc64.*", new String[] { "sha" }, null), new OrPredicate(new CPUSpecificPredicate("ppc64le.*", new String[] { "sha" }, null), @@ -96,7 +99,7 @@ public class IntrinsicPredicates { new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] { "sha" }, null), new OrPredicate(new CPUSpecificPredicate("x86.*", new String[] { "sha" }, null), new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "avx2", "bmi2" }, null), - new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null))))))))); + new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null)))))))))); public static final BooleanSupplier SHA3_INSTRUCTION_AVAILABLE // sha3 is only implemented on aarch64 for now diff --git a/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java b/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java index 51cbb5e8c2fb79678b9c140f003232d87cbe1bf0..950fef40ec0f0a8881b65d49d6cfdf25d2ee00ac 100644 --- a/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java +++ b/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,11 +36,14 @@ package compiler.unsafe; import jdk.internal.misc.Unsafe; +import java.nio.ByteOrder; import static jdk.test.lib.Asserts.assertEQ; public class UnsafeCopyMemory { static private Unsafe UNSAFE = Unsafe.getUnsafe(); + static final boolean IS_BIG_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; + // On-heap arrays static int[] srcArr = new int[1]; static int[] dstArr = new int[1]; @@ -104,8 +107,12 @@ public class UnsafeCopyMemory { srcArr [readIdx] = v1; dstArrL[writeIdx] = v2; + // On LE systems, low-order bytes of long and int overlap, but + // on BE systems, they differ by the size of an int. + long mismatchedOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (IS_BIG_ENDIAN ? 4 : 0); + UNSAFE.copyMemory(srcArr, Unsafe.ARRAY_INT_BASE_OFFSET, - dstArrL, Unsafe.ARRAY_LONG_BASE_OFFSET, 4); // mismatched + dstArrL, mismatchedOffset, 4); // mismatched long r = resArrL[0]; // snapshot srcArr[readIdx] = v3; @@ -156,6 +163,7 @@ public class UnsafeCopyMemory { Object srcArrLocal = (flag ? srcArrIntLocal : srcArrLongLocal); long srcOffset = (flag ? Unsafe.ARRAY_INT_BASE_OFFSET : Unsafe.ARRAY_LONG_BASE_OFFSET); + srcOffset += (!flag && IS_BIG_ENDIAN ? 4 : 0); srcArrIntLocal[0] = v1; srcArrLongLocal[0] = v1; @@ -179,6 +187,7 @@ public class UnsafeCopyMemory { Object dstArrLocal = (flag ? dstArrIntLocal : dstArrLongLocal); long dstOffset = (flag ? Unsafe.ARRAY_INT_BASE_OFFSET : Unsafe.ARRAY_LONG_BASE_OFFSET); + dstOffset += (!flag && IS_BIG_ENDIAN ? 4 : 0); srcArr[readIdx] = v1; dstArrIntLocal[0] = v2; diff --git a/test/hotspot/jtreg/compiler/vectorapi/VectorCastShape128Test.java b/test/hotspot/jtreg/compiler/vectorapi/VectorCastShape128Test.java index 5feef36e5312fd1001fe28562caf1a012f2cd023..d086e8fed5317807c26be4ce50701b996b4eff28 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/VectorCastShape128Test.java +++ b/test/hotspot/jtreg/compiler/vectorapi/VectorCastShape128Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Arm Limited. All rights reserved. + * Copyright (c) 2021, 2022, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -114,6 +114,9 @@ public class VectorCastShape128Test { 0, Long.MAX_VALUE, Long.MIN_VALUE, + // A special value to make sure correct rounding of + // conversion from long to float. See: JDK-8282764. + 0x561a524000000001L, }; diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java index a83364fa51cd8a029a80fdb2bad12089f28b5ab1..de70b3ca6a77be5da3a3c66ae00da97c4b08f522 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper; /* * @test * @bug 8259610 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector cast intrinsics work as intended on avx1. diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java index 1b50613598b2669b12b7aa2c43311d7d4d48a69e..f05f8903355a171af3b2392b62f5e1a4ca54d6a5 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper; /* * @test * @bug 8259610 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector cast intrinsics work as intended on avx2. diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java index 749c6a21e06ef4c3d3f1bc01c59f644da12a134f..a231889b9ed4d8e24565d2ef13d36f8c84e80e0d 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper; /* * @test * @bug 8259610 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector cast intrinsics work as intended on avx512. diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java index d9fbaf92d844c8595134fc5c295685973ae7bf5f..c8d907db43b0678053760415a1c520ff60bc9bad 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper; /* * @test * @bug 8278623 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector cast intrinsics work as intended on avx512bw. diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java index 8799cccd918415912c378b4245bc680bbab0a280..9d8b7db7a852bf49f4cf1bee019bdb768165fe8a 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper; /* * @test * @bug 8259610 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector cast intrinsics work as intended on avx512dq. diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java index 11777a3ccfcf8b211021285017fcb0d4f3f75de5..1beefec1124457d1095cfcbb46610da5a202a2a4 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper; /* * @test * @bug 8259610 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector cast intrinsics work as intended on neon. @@ -42,7 +43,7 @@ public class TestVectorCastNeon { VectorReshapeHelper.runMainHelper( TestVectorCast.class, TestCastMethods.NEON_CAST_TESTS.stream(), - "-XX:+UseNeon"); + "-XX:UseSVE=0"); } } diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java index 614e8e870de43ae4a286258a6379f5f6f44bbde5..1ab1c3ca18824bed2a3010d75867bdd7790bdb5d 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper; /* * @test * @bug 8259610 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector cast intrinsics work as intended on sve. diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java index 538736193ef25eea797e41b1628425e13ac9d90c..11821a6b8ebbbf6cc844b7c3c3db3f6d5fe29a74 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * 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,6 +35,7 @@ import jdk.incubator.vector.VectorSpecies; /* * @test * @bug 8259610 + * @key randomness * @modules jdk.incubator.vector * @modules java.base/jdk.internal.misc * @summary Test that vector reinterpret intrinsics work as intended. diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java index c769c14bde0b7a2fb508e09244a15490c026051e..6cfd934bb276f2169a9b826a5f95102052b02fa0 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.incubator.vector.*; import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; public class VectorReshapeHelper { public static final int INVOCATIONS = 10_000; @@ -105,7 +106,7 @@ public class VectorReshapeHelper { public static void runCastHelper(VectorOperators.Conversion castOp, VectorSpecies isp, VectorSpecies osp) throws Throwable { - var random = RandomGenerator.getDefault(); + var random = Utils.getRandomInstance(); boolean isUnsignedCast = castOp.name().startsWith("ZERO"); String testMethodName = VectorSpeciesPair.makePair(isp, osp, isUnsignedCast).format(); var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass(); @@ -219,7 +220,7 @@ public class VectorReshapeHelper { } public static void runExpandShrinkHelper(VectorSpecies isp, VectorSpecies osp) throws Throwable { - var random = RandomGenerator.getDefault(); + var random = Utils.getRandomInstance(); String testMethodName = VectorSpeciesPair.makePair(isp, osp).format(); var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass(); var testMethod = MethodHandles.lookup().findStatic(caller, @@ -249,7 +250,7 @@ public class VectorReshapeHelper { } public static void runDoubleExpandShrinkHelper(VectorSpecies isp, VectorSpecies osp) throws Throwable { - var random = RandomGenerator.getDefault(); + var random = Utils.getRandomInstance(); String testMethodName = VectorSpeciesPair.makePair(isp, osp).format(); var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass(); var testMethod = MethodHandles.lookup().findStatic(caller, @@ -278,7 +279,7 @@ public class VectorReshapeHelper { } public static void runRebracketHelper(VectorSpecies isp, VectorSpecies osp) throws Throwable { - var random = RandomGenerator.getDefault(); + var random = Utils.getRandomInstance(); String testMethodName = VectorSpeciesPair.makePair(isp, osp).format(); var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass(); var testMethod = MethodHandles.lookup().findStatic(caller, diff --git a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java index 37c5280d2367fcf251daab9404e03deb3787293a..c84bc7e0159918365d9daeed4533410565220e00 100644 --- a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java +++ b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java @@ -21,6 +21,7 @@ * questions. */ +import static java.lang.Character.isDigit; import static java.lang.Long.parseLong; import static java.lang.System.getProperty; import static java.nio.file.Files.readAllBytes; @@ -40,6 +41,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collection; +import java.util.concurrent.TimeUnit; import java.util.Optional; import java.util.stream.Stream; @@ -60,17 +62,18 @@ import java.util.stream.Stream; * * This test is performed in three steps. The first VM starts a second VM with * gc logging enabled. The second VM starts a third VM and redirects the third - * VMs output to the first VM, it then exits and hopefully closes its log file. + * VMs output to the first VM. The second VM then exits and hopefully closes + * its log file. * - * The third VM waits for the second to exit and close its log file. After that, - * the third VM tries to rename the log file of the second VM. If it succeeds in - * doing so it means that the third VM did not inherit the open log file - * (windows can not rename opened files easily) + * The third VM waits for the second to exit and close its log file. + * On Windows, the third VM tries to rename the log file of the second VM. + * If it succeeds in doing so it means that the third VM did not inherit + * the open log file (windows cannot rename opened files easily). + * On unix like systems, the third VM uses "lsof" for verification. * - * The third VM communicates the success to rename the file by printing "CLOSED - * FD". The first VM checks that the string was printed by the third VM. - * - * On unix like systems "lsof" is used. + * The third VM communicates success by printing "RETAINS FD". The first VM + * waits for the third VM to exit and checks that the string was printed by + * the third VM. */ public class TestInheritFD { @@ -80,9 +83,145 @@ public class TestInheritFD { public static final String EXIT = "VM RESULT => VM EXIT"; public static final String LOG_SUFFIX = ".strangelogsuffixthatcanbecheckedfor"; public static final String USER_DIR = System.getProperty("user.dir"); + public static final String LSOF_PID_PREFIX = " VM lsof pid="; + public static final String SECOND_VM_PID_PREFIX = "Second VM pid="; + public static final String THIRD_VM_PID_PREFIX = "Third VM pid="; + public static final String THIRD_VM_WAITING_PREFIX = "Third VM waiting for second VM pid="; + + public static float timeoutFactor = Float.parseFloat(System.getProperty("test.timeout.factor", "1.0")); + public static long subProcessTimeout = (long)(15L * timeoutFactor); + + // Extract a pid from the specified String at the specified start offset. + private static long extractPidFromStringOffset(String str, int start) { + int end; + for (end = start; end < str.length(); end++) { + if (!isDigit(str.charAt(end))) { + break; + } + } + if (start == end) { // no digits at all + return -1; + } + return parseLong(str.substring(start, end)); + } + + // Wait for the sub-process pids identified in commFile to finish executing. + // Returns true if RETAINS_FD was found in the commFile and false otherwise. + private static boolean waitForSubPids(File commFile) throws Exception { + String out = ""; + int sleepCnt = 0; + long secondVMPID = -1; + long secondVMlsofPID = -1; + long thirdVMPID = -1; + long thirdVMlsofPID = -1; + // Only have to gather info until the doneWithPattern shows up in the output: + String doneWithPattern; + if (isWindows()) { + doneWithPattern = THIRD_VM_PID_PREFIX; + } else { + doneWithPattern = "Third" + LSOF_PID_PREFIX; + } + do { + out = new String(readAllBytes(commFile.toPath())); + if (secondVMPID == -1) { + int ind = out.indexOf(SECOND_VM_PID_PREFIX); + if (ind != -1) { + int startPid = ind + SECOND_VM_PID_PREFIX.length(); + secondVMPID = extractPidFromStringOffset(out, startPid); + System.out.println("secondVMPID=" + secondVMPID); + } + } + if (!isWindows() && secondVMlsofPID == -1) { + String prefix = "Second" + LSOF_PID_PREFIX; + int ind = out.indexOf(prefix); + if (ind != -1) { + int startPid = ind + prefix.length(); + secondVMlsofPID = extractPidFromStringOffset(out, startPid); + System.out.println("secondVMlsofPID=" + secondVMlsofPID); + } + } + if (thirdVMPID == -1) { + int ind = out.indexOf(THIRD_VM_PID_PREFIX); + if (ind != -1) { + int startPid = ind + THIRD_VM_PID_PREFIX.length(); + thirdVMPID = extractPidFromStringOffset(out, startPid); + System.out.println("thirdVMPID=" + thirdVMPID); + } + } + if (!isWindows() && thirdVMlsofPID == -1) { + String prefix = "Third" + LSOF_PID_PREFIX; + int ind = out.indexOf(prefix); + if (ind != -1) { + int startPid = ind + prefix.length(); + thirdVMlsofPID = extractPidFromStringOffset(out, startPid); + System.out.println("thirdVMlsofPID=" + thirdVMlsofPID); + } + } + Thread.sleep(100); + sleepCnt++; + } while (!out.contains(doneWithPattern) && !out.contains(EXIT)); + + System.out.println("Called Thread.sleep(100) " + sleepCnt + " times."); + + long subPids[] = new long[4]; // At most 4 pids to check. + String subNames[] = new String[4]; // At most 4 names for those pids. + int ind = 0; + if (!isWindows() && secondVMlsofPID != -1) { + // The second VM's lsof cmd should be the first non-windows sub-process to finish: + subPids[ind] = secondVMlsofPID; + subNames[ind] = "second VM lsof"; + ind++; + } + // The second VM should the second non-windows or first windows sub-process to finish: + subPids[ind] = secondVMPID; + subNames[ind] = "second VM"; + ind++; + if (!isWindows() && thirdVMlsofPID != -1) { + // The third VM's lsof cmd should be the third non-windows sub-process to finish: + subPids[ind] = thirdVMlsofPID; + subNames[ind] = "third VM lsof"; + ind++; + } + // The third VM should the last sub-process to finish: + subPids[ind] = thirdVMPID; + subNames[ind] = "third VM"; + ind++; + if (isWindows()) { + // No lsof pids on windows so we use fewer array slots. + // Make sure they are marked as not used. + for (; ind < subPids.length; ind++) { + subPids[ind] = -1; + } + } + + try { + for (ind = 0; ind < subPids.length; ind++) { + if (subPids[ind] == -1) { + continue; + } + System.out.print("subs[" + ind + "]={pid=" + subPids[ind] + ", name=" + subNames[ind] + "}"); + ProcessHandle.of(subPids[ind]).ifPresent(handle -> handle.onExit().orTimeout(subProcessTimeout, TimeUnit.SECONDS).join()); + System.out.println(" finished."); + } + } catch (Exception e) { + // Terminate the "subs" line from above: + System.out.println(" Exception was thrown while trying to join() subPids: " + e.toString()); + throw e; + } finally { + // Reread to get everything in the commFile: + out = new String(readAllBytes(commFile.toPath())); + System.out.println(""); + System.out.println(out); + System.out.println(""); + } + + return out.contains(RETAINS_FD); + } // first VM public static void main(String[] args) throws Exception { + System.out.println("subProcessTimeout=" + subProcessTimeout + " seconds."); + System.out.println("First VM starts."); String logPath = Utils.createTempFile("logging", LOG_SUFFIX).toFile().getName(); File commFile = Utils.createTempFile("communication", ".txt").toFile(); @@ -99,24 +238,18 @@ public class TestInheritFD { pb.redirectOutput(commFile); // use temp file to communicate between processes pb.start(); - String out = ""; - do { - out = new String(readAllBytes(commFile.toPath())); - Thread.sleep(100); - System.out.println("SLEEP 100 millis"); - } while (!out.contains(EXIT)); - - System.out.println(out); - if (out.contains(RETAINS_FD)) { - System.out.println("Log file was not inherited by third VM"); + if (waitForSubPids(commFile)) { + System.out.println("Log file was not inherited by third VM."); } else { - throw new RuntimeException("could not match: " + RETAINS_FD); + throw new RuntimeException("Log file was leaked to the third VM."); } + System.out.println("First VM ends."); } static class VMStartedWithLogging { // second VM public static void main(String[] args) throws IOException, InterruptedException { + System.out.println(SECOND_VM_PID_PREFIX + ProcessHandle.current().pid()); ProcessBuilder pb = createJavaProcessBuilder( "-Dtest.jdk=" + getProperty("test.jdk"), VMShouldNotInheritFileDescriptors.class.getName(), @@ -126,30 +259,43 @@ public class TestInheritFD { pb.start(); if (!isWindows()) { - System.out.println("(Second VM) Open file descriptors:\n" + outputContainingFilenames().stream().collect(joining("\n"))); + System.out.println("(Second VM) Open file descriptors:\n" + outputContainingFilenames("Second").stream().collect(joining("\n"))); + } + if (false) { // Enable to simulate a timeout in the second VM. + Thread.sleep(300 * 1000); } + System.out.println("Second VM ends."); } } static class VMShouldNotInheritFileDescriptors { // third VM public static void main(String[] args) throws InterruptedException { + System.out.println(THIRD_VM_PID_PREFIX + ProcessHandle.current().pid()); try { File logFile = new File(args[0]); long parentPid = parseLong(args[1]); fakeLeakyJVM(false); // for debugging of test case + System.out.println(THIRD_VM_WAITING_PREFIX + parentPid); + ProcessHandle.of(parentPid).ifPresent(handle -> handle.onExit().orTimeout(subProcessTimeout, TimeUnit.SECONDS).join()); + if (isWindows()) { - windows(logFile, parentPid); + windows(logFile); } else { - Collection output = outputContainingFilenames(); + Collection output = outputContainingFilenames("Third"); System.out.println("(Third VM) Open file descriptors:\n" + output.stream().collect(joining("\n"))); System.out.println(findOpenLogFile(output) ? LEAKS_FD : RETAINS_FD); } + if (false) { // Enable to simulate a timeout in the third VM. + Thread.sleep(300 * 1000); + } } catch (Exception e) { - System.out.println(e.toString()); + System.out.println("Exception was thrown: " + e.toString()); + throw e; } finally { System.out.println(EXIT); + System.out.println("Third VM ends."); } } } @@ -165,9 +311,11 @@ public class TestInheritFD { } } - static Stream run(String... args){ + static Stream runLsof(String whichVM, String... args){ try { - return new BufferedReader(new InputStreamReader(new ProcessBuilder(args).start().getInputStream())).lines(); + Process lsof = new ProcessBuilder(args).start(); + System.out.println(whichVM + LSOF_PID_PREFIX + lsof.pid()); + return new BufferedReader(new InputStreamReader(lsof.getInputStream())).lines(); } catch (IOException e) { throw new RuntimeException(e); } @@ -186,12 +334,12 @@ public class TestInheritFD { return lsofCommandCache; } - static Collection outputContainingFilenames() { + static Collection outputContainingFilenames(String whichVM) { long pid = ProcessHandle.current().pid(); String[] command = lsofCommand().orElseThrow(() -> new RuntimeException("lsof like command not found")); // Only search the directory in which the VM is running (user.dir property). System.out.println("using command: " + command[0] + " -a +d " + USER_DIR + " " + command[1] + " " + pid); - return run(command[0], "-a", "+d", USER_DIR, command[1], "" + pid).collect(toList()); + return runLsof(whichVM, command[0], "-a", "+d", USER_DIR, command[1], "" + pid).collect(toList()); } static boolean findOpenLogFile(Collection fileNames) { @@ -208,9 +356,7 @@ public class TestInheritFD { .isPresent(); } - static void windows(File f, long parentPid) throws InterruptedException { - System.out.println("waiting for pid: " + parentPid); - ProcessHandle.of(parentPid).ifPresent(handle -> handle.onExit().join()); + static void windows(File f) throws InterruptedException { System.out.println("trying to rename file to the same name: " + f); System.out.println(f.renameTo(f) ? RETAINS_FD : LEAKS_FD); // this parts communicates a closed file descriptor by printing "VM RESULT => RETAINS FD" } diff --git a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java index c46b32b220d9c76064b7ef8c6c8df64eb3e56d32..8e2033e73296273889d3c0797ff2c28b1cb24968 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java @@ -224,8 +224,8 @@ public class CompressedClassPointers { "-XX:+VerifyBeforeGC", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Narrow klass base: 0x0000000000000000"); - if (!Platform.isAArch64()) { - // Currently relax this test for Aarch64. + if (!Platform.isAArch64() && !Platform.isPPC()) { + // Currently relax this test for Aarch64 and ppc. output.shouldContain("Narrow klass shift: 0"); } output.shouldHaveExitValue(0); @@ -244,8 +244,8 @@ public class CompressedClassPointers { "-XX:+VerifyBeforeGC", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Narrow klass base: 0x0000000000000000"); - if (!Platform.isAArch64()) { - // Currently relax this test for Aarch64. + if (!Platform.isAArch64() && !Platform.isPPC()) { + // Currently relax this test for Aarch64 and ppc. output.shouldContain("Narrow klass shift: 0"); } output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java b/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java index dfc84241beb65c47ddb78f04ee1468707d853ae7..b96e3a80abafcfc05396c24db0a117c1ba0fd013 100644 --- a/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java +++ b/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -133,7 +133,7 @@ public class CheckForProperDetailStackTrace { // It's ok for ARM not to have symbols, because it does not support NMT detail // when targeting thumb2. It's also ok for Windows not to have symbols, because // they are only available if the symbols file is included with the build. - if (Platform.isWindows() || Platform.isARM()) { + if (Platform.isWindows() || Platform.isARM() || Platform.isRISCV64()) { return; // we are done } output.reportDiagnosticSummary(); diff --git a/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java b/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java index c11472a0918121f5a4d88f4c200643e61f2575c4..36f74d01b54f8e445d03b7085e7f0c94734489fb 100644 --- a/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java +++ b/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -240,7 +240,7 @@ public class ReservedStackTest { return Platform.isAix() || (Platform.isLinux() && (Platform.isPPC() || Platform.isS390x() || Platform.isX64() || - Platform.isX86() || Platform.isAArch64())) || + Platform.isX86() || Platform.isAArch64() || Platform.isRISCV64())) || Platform.isOSX(); } diff --git a/test/hotspot/jtreg/runtime/Thread/StopAtExit.java b/test/hotspot/jtreg/runtime/Thread/StopAtExit.java index 2255009320210785d342686c566cbbb956a6d41d..86771cf94968540f4501a2e188c6a9c8b33ed61d 100644 --- a/test/hotspot/jtreg/runtime/Thread/StopAtExit.java +++ b/test/hotspot/jtreg/runtime/Thread/StopAtExit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. * 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,21 +23,31 @@ /** * @test - * @bug 8167108 8266130 - * @summary Stress test java.lang.Thread.stop() at thread exit. - * @run main/othervm StopAtExit + * @bug 8167108 8266130 8282704 8283467 + * @summary Stress test JVM/TI StopThread() at thread exit. + * @requires vm.jvmti + * @modules java.base/java.lang:open + * @run main/othervm/native -agentlib:StopAtExit StopAtExit */ +import java.lang.reflect.Method; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; public class StopAtExit extends Thread { private final static int DEF_TIME_MAX = 30; // default max # secs to test private final static String PROG_NAME = "StopAtExit"; + private final static int JVMTI_ERROR_THREAD_NOT_ALIVE = 15; public CountDownLatch exitSyncObj = new CountDownLatch(1); public CountDownLatch startSyncObj = new CountDownLatch(1); + native static int stopThread(StopAtExit thr, Throwable exception); + + public StopAtExit(ThreadGroup group, Runnable target) { + super(group, target); + } + @Override public void run() { try { @@ -50,9 +60,9 @@ public class StopAtExit extends Thread { throw new RuntimeException("Unexpected: " + e); } } catch (ThreadDeath td) { - // ignore because we're testing Thread.stop() which throws it + // ignore because we're testing JVM/TI StopThread() which throws it } catch (NoClassDefFoundError ncdfe) { - // ignore because we're testing Thread.stop() which can cause it + // ignore because we're testing JVM/TI StopThread() which can cause it } } @@ -72,23 +82,43 @@ public class StopAtExit extends Thread { System.out.println("About to execute for " + timeMax + " seconds."); long count = 0; + long manualDestroyCnt = 0; + long manualTerminateCnt = 0; long start_time = System.currentTimeMillis(); while (System.currentTimeMillis() < start_time + (timeMax * 1000)) { count++; - StopAtExit thread = new StopAtExit(); + // Use my own ThreadGroup so the thread count is known and make + // it a daemon ThreadGroup so it is automatically destroyed when + // the thread is terminated. + ThreadGroup myTG = new ThreadGroup("myTG-" + count); + myTG.setDaemon(true); + Throwable myException = new ThreadDeath(); + int retCode; + StopAtExit thread = new StopAtExit(myTG, null); thread.start(); try { // Wait for the worker thread to get going. thread.startSyncObj.await(); // Tell the worker thread to race to the exit and the - // Thread.stop() calls will come in during thread exit. + // JVM/TI StopThread() calls will come in during thread exit. thread.exitSyncObj.countDown(); while (true) { - thread.stop(); + retCode = stopThread(thread, myException); + + if (retCode == JVMTI_ERROR_THREAD_NOT_ALIVE) { + // Done with JVM/TI StopThread() calls since + // thread is not alive. + break; + } else if (retCode != 0) { + throw new RuntimeException("thread " + thread.getName() + + ": stopThread() " + + "retCode=" + retCode + + ": unexpected value."); + } if (!thread.isAlive()) { - // Done with Thread.stop() calls since + // Done with JVM/TI StopThread() calls since // thread is not alive. break; } @@ -96,7 +126,7 @@ public class StopAtExit extends Thread { } catch (InterruptedException e) { throw new Error("Unexpected: " + e); } catch (NoClassDefFoundError ncdfe) { - // Ignore because we're testing Thread.stop() which can + // Ignore because we're testing JVM/TI StopThread() which can // cause it. Yes, a NoClassDefFoundError that happens // in a worker thread can subsequently be seen in the // main thread. @@ -107,9 +137,61 @@ public class StopAtExit extends Thread { } catch (InterruptedException e) { throw new Error("Unexpected: " + e); } - thread.stop(); + // This JVM/TI StopThread() happens after the join() so it + // should do nothing, but let's make sure. + retCode = stopThread(thread, myException); + + if (retCode != JVMTI_ERROR_THREAD_NOT_ALIVE) { + throw new RuntimeException("thread " + thread.getName() + + ": stopThread() " + + "retCode=" + retCode + + ": unexpected value; " + + "expected JVMTI_ERROR_THREAD_NOT_ALIVE(" + + JVMTI_ERROR_THREAD_NOT_ALIVE + ")."); + } + + if (myTG.activeCount() != 0) { + // If the ThreadGroup still has a count, then the thread + // received the async exception while in exit() so we need + // to do a manual terminate. + manualTerminateCnt++; + try { + threadTerminated(myTG, thread); + } catch (Exception e) { + throw new Error("threadTerminated() threw unexpected: " + e); + } + int activeCount = myTG.activeCount(); + if (activeCount != 0) { + throw new Error("threadTerminated() did not clean up " + + "worker thread: count=" + activeCount); + } + if (!myTG.isDestroyed()) { + throw new Error("threadTerminated() did not destroy " + + myTG.getName()); + } + } else if (!myTG.isDestroyed()) { + // If the ThreadGroup does not have a count, but is not + // yet destroyed, then the thread received the async + // exception while the thread was in the later stages of + // its threadTerminated() call so we need to do a manual + // destroy. + manualDestroyCnt++; + try { + myTG.destroy(); + } catch (Exception e) { + throw new Error("myTG.destroy() threw unexpected: " + e); + } + } } + if (manualDestroyCnt != 0) { + System.out.println("Manually destroyed ThreadGroup " + + manualDestroyCnt + " times."); + } + if (manualTerminateCnt != 0) { + System.out.println("Manually terminated Thread " + + manualTerminateCnt + " times."); + } System.out.println("Executed " + count + " loops in " + timeMax + " seconds."); @@ -120,6 +202,13 @@ public class StopAtExit extends Thread { } } + static void threadTerminated(ThreadGroup group, Thread thread) throws Exception { + // ThreadGroup.threadTerminated() is package private: + Method method = ThreadGroup.class.getDeclaredMethod("threadTerminated", Thread.class); + method.setAccessible(true); + method.invoke(group, thread); + } + public static void usage() { System.err.println("Usage: " + PROG_NAME + " [time_max]"); System.err.println("where:"); diff --git a/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp b/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1204915050b230d863e3aeee6c43686dd93be7ff --- /dev/null +++ b/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +#include +#include "jvmti.h" + +extern "C" { + +static jvmtiEnv* jvmti = NULL; + +#define LOG(...) \ + do { \ + printf(__VA_ARGS__); \ + printf("\n"); \ + fflush(stdout); \ + } while (0) + +JNIEXPORT jint JNICALL +Java_StopAtExit_stopThread(JNIEnv *jni, jclass cls, jthread thr, jobject exception) { + return jvmti->StopThread(thr, exception); +} + + +/** Agent library initialization. */ + +JNIEXPORT jint JNICALL +Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { + LOG("\nAgent_OnLoad started"); + + // create JVMTI environment + if (jvm->GetEnv((void **) (&jvmti), JVMTI_VERSION) != JNI_OK) { + return JNI_ERR; + } + + // add specific capabilities for stoping thread + jvmtiCapabilities stopCaps; + memset(&stopCaps, 0, sizeof(stopCaps)); + stopCaps.can_signal_thread = 1; + + jvmtiError err = jvmti->AddCapabilities(&stopCaps); + if (err != JVMTI_ERROR_NONE) { + return JNI_ERR; + } + LOG("Agent_OnLoad finished\n"); + return JNI_OK; +} + +} diff --git a/test/hotspot/jtreg/runtime/cds/DeterministicDump.java b/test/hotspot/jtreg/runtime/cds/DeterministicDump.java index 9cdba1fa922073290ee6c9da8e3e60ef44f71439..6e8ccffce278cf53267693eeb3527f3666708d3e 100644 --- a/test/hotspot/jtreg/runtime/cds/DeterministicDump.java +++ b/test/hotspot/jtreg/runtime/cds/DeterministicDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * 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,6 +54,11 @@ public class DeterministicDump { baseArgs.add("-Xmx128M"); if (Platform.is64bit()) { + if (!compressed) { + System.out.println("CDS archives with uncompressed oops are still non-deterministic"); + System.out.println("See https://bugs.openjdk.java.net/browse/JDK-8282828"); + return; + } // These options are available only on 64-bit. String sign = (compressed) ? "+" : "-"; baseArgs.add("-XX:" + sign + "UseCompressedOops"); @@ -78,9 +83,12 @@ public class DeterministicDump { static String dump(ArrayList args, String... more) throws Exception { String logName = "SharedArchiveFile" + (id++); String archiveName = logName + ".jsa"; + String mapName = logName + ".map"; CDSOptions opts = (new CDSOptions()) .addPrefix("-Xlog:cds=debug") + .addPrefix("-Xlog:cds+map=trace:file=" + mapName + ":none:filesize=0") .setArchiveName(archiveName) + .addSuffix(args) .addSuffix(more); CDSTestUtils.createArchiveAndCheck(opts); diff --git a/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java b/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java index 761b5a05d294ec94c211e250f1b8991074afb62b..a7f31cf1a082f3f74e5db9175c76728338aac652 100644 --- a/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java +++ b/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -70,26 +70,31 @@ import jdk.test.lib.process.OutputAnalyzer; public class SharedBaseAddress { - // shared base address test table - private static final String[] testTable = { - "1g", "8g", "64g","512g", "4t", - "32t", "128t", "0", + // shared base address test table for {32, 64}bit VM + private static final String[] testTableShared = { + "1g", "0", "1", "64k", "64M", + "0xfff80000", // archive top wraps around 32-bit address space + "0xffffffff", // archive bottom wraps around 32-bit address space -- due to align_up() + "0" // always let OS pick the base address at runtime (ASLR for CDS archive) + }; + + // shared base address test table for 64bit VM only + private static final String[] testTable64 = { + "8g", "64g","512g", "4t", + "32t", "128t", "0x800001000", // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522 "0xfffffffffff00000", // archive top wraps around 64-bit address space - "0xfff80000", // archive top wraps around 32-bit address space "0xffffffffffffffff", // archive bottom wraps around 64-bit address space -- due to align_up() - "0xffffffff", // archive bottom wraps around 32-bit address space -- due to align_up() "0x00007ffffff00000", // end of archive will go past the end of user space on linux/x64 - "0x500000000", // (20g) below 32g at a 4g aligned address, but cannot be expressed with a logical + "0x500000000" // (20g) below 32g at a 4g aligned address, but cannot be expressed with a logical // immediate on aarch64 (0x5_0000_0000) (see JDK-8265705) - "0", // always let OS pick the base address at runtime (ASLR for CDS archive) }; // failed pattern private static String failedPattern = "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed"; - public static void main(String[] args) throws Exception { + public static void test(String[] args, String[] testTable) throws Exception { int mid = testTable.length / 2; int start = args[0].equals("0") ? 0 : mid; int end = args[0].equals("0") ? mid : testTable.length; @@ -134,4 +139,11 @@ public class SharedBaseAddress { } } } + + public static void main(String[] args) throws Exception { + test(args, testTableShared); + if (Platform.is64bit()) { + test(args, testTable64); + } + } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java b/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java index 5d981c017944c05890d6d33951b77caafd6fe415..2220fc52baabaea7e8bf0258f8608221a7cef3f9 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * 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,19 +33,24 @@ * @run main/timeout=240 SharedBaseAddress */ +import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; public class SharedBaseAddress { - // shared base address test table - private static final String[] testTable = { - "1g", "8g", "64g","512g", "4t", - "32t", "128t", "0", - "1", "64k", "64M", "320g", + // shared base address test table for {32, 64}bit VM + private static final String[] testTableShared = { + "1g", "0", "1", "64k", "64M" + }; + + // shared base address test table for 64bit VM only + private static final String[] testTable64 = { + "8g", "64g","512g", "4t", + "32t", "128t", "320g", "0x800001000" // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522 }; - public static void main(String[] args) throws Exception { + public static void test(String[] testTable) throws Exception { String appJar = JarBuilder.getOrCreateHelloJar(); for (String testEntry : testTable) { @@ -62,4 +67,11 @@ public class SharedBaseAddress { TestCommon.checkExec(execOutput, "Hello World"); } } + + public static void main(String[] args) throws Exception { + test(testTableShared); + if (Platform.is64bit()) { + test(testTable64); + } + } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java index 04652d2eb782a8f3a943b1e626d0383099f9ad02..391596160d6b65b530357af9fc106c508d793181 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,7 +68,7 @@ public class LockDuringDump { TestCommon.testDump(appJar, TestCommon.list(LockDuringDumpApp.class.getName()), "-XX:+UnlockDiagnosticVMOptions", agentArg, agentArg2); - if (i != 0) { + if (i != 0 && !out.getStdout().contains("LockDuringDumpAgent timeout")) { out.shouldContain("Let's hold the lock on the literal string"); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java index 5e053d83efcf03158575d4db66cf6f31b9e9abd7..57db61e9335c2d19cdb8f62c2b2086aba2ba1312 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * 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,9 +51,21 @@ public class LockDuringDumpAgent implements Runnable { static void waitForThreadStart() { try { + long started = System.currentTimeMillis(); + long timeout = 10000; + synchronized (LITERAL) { + Thread.sleep(1); + } synchronized (lock) { while (!threadStarted) { - lock.wait(); + lock.wait(timeout); + long elapsed = System.currentTimeMillis() - started; + if (elapsed >= timeout) { + System.out.println("This JVM may decide to not launch any Java threads during -Xshare:dump."); + System.out.println("This is OK because no string objects could be in a locked state during heap dump."); + System.out.println("LockDuringDumpAgent timeout after " + elapsed + " ms"); + return; + } } System.out.println("Thread has started"); } diff --git a/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java b/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java index 5653b735273f34d05c98acd46d7d606cfdfb233d..5c41565db8d9beef3ee033f4f22e15689ee98125 100644 --- a/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java +++ b/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,7 +29,7 @@ package MyPackage; * @summary Verifies that AsyncGetCallTrace is call-able and provides sane information. * @compile ASGCTBaseTest.java * @requires os.family == "linux" - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="arm" | os.arch=="aarch64" | os.arch=="ppc64" | os.arch=="s390" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="arm" | os.arch=="aarch64" | os.arch=="ppc64" | os.arch=="s390" | os.arch=="riscv64" * @requires vm.jvmti * @run main/othervm/native -agentlib:AsyncGetCallTraceTest MyPackage.ASGCTBaseTest */ diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java index 680d9078d3bfcfb3d8feae542d7b44324455e2ef..050ec9c05d62b8ee82d9769d066931be0cd6f029 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java @@ -57,7 +57,7 @@ public class ClhsdbVmStructsDump { "field Klass _name Symbol*", "type ClassLoaderData* null", "field JavaThread _osthread OSThread*", - "type TenuredGeneration CardGeneration", + "type TenuredGeneration Generation", "type Universe null", "type ConstantPoolCache MetaspaceObj")); test.run(theApp.getPid(), cmds, expStrMap, null); diff --git a/test/hotspot/jtreg/serviceability/sa/TestType.java b/test/hotspot/jtreg/serviceability/sa/TestType.java index 1e4a9e56e575b9de43b59935862031cc96bc0ec4..4f71e42cd4e7c83eae6f2c03f24ea05bb5238fbc 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestType.java +++ b/test/hotspot/jtreg/serviceability/sa/TestType.java @@ -62,7 +62,6 @@ public class TestType { "type ConstantPoolCache MetaspaceObj", "type ConstantPool Metadata", "type CompilerThread JavaThread", - "type CardGeneration Generation", "type ArrayKlass Klass", "type InstanceKlass Klass")); // String to check for in the output of "type InstanceKlass" diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001.java index f5c721cfac75252349f92e9f7095ed258b244bc5..608d3410639368e0c9a51352fda127632dad3e74 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -281,7 +281,7 @@ public class ownedmonitors001 { Value value = debuggeeRef.getValue(field); expMonitors.add((ObjectReference)value); } catch (Exception e) { - log3("Unexpected excption while getting ObjectReference for monitors"); + log3("Unexpected exception while getting ObjectReference for monitors"); testExitCode = FAILED; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001.java index 9de6f2c301f7e32ce892a22e38ec116f1cd26052..213a7fb3c467c79eef01ef8b67bebd060babff27 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. * 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,6 +151,8 @@ public class thread001 { if (checkedRequest != null) { log.display("Disabling event request"); checkedRequest.disable(); + // need to resume all threads in case a stray ThreadStartEvent arrived + vm.resume(); } // force debuggee to quit diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java index 4a482ab2164a39ea08eab29c1f19c4a2a73899ad..2092256ef6c0596664eeedcddd631eaef53ae772 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -267,7 +267,7 @@ public class exception001 { JDWP.SuspendPolicy.ALL); log.display(" ... breakpoint reached with threadID: " + testedThreadID); - // get excepion objectID value for static field + // get exception objectID value for static field log.display("Getting exception objectID from static field: " + EXCEPTION_FIELD_NAME); JDWP.Value value = debugee.getStaticFieldValue(testedClassID, EXCEPTION_FIELD_NAME, JDWP.Tag.OBJECT); exceptionObjectID = ((Long)value.getValue()).longValue(); diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmOOMTest.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmOOMTest.java index eb3cc9f89d615f8554d10357d990b92a0600d33f..fb44a54b8252fe28c50f38ebb97dcc161e83d82b 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmOOMTest.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmOOMTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,7 +69,7 @@ public abstract class MlvmOOMTest extends MlvmTest { /** * Checks the OOME type is expected. - * Method just exits if OOME is expected and throws an exeption if not. + * Method just exits if OOME is expected and throws an exception if not. * @param oome thrown by {@link #eatMemory(List)} */ protected abstract void checkOOME(OutOfMemoryError oome); diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java index 425468ef26a3de521f559e4a2ed10efdd702350e..f3802ec5c461563fdd488427804d9db14637447a 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ package transform; +import com.sun.org.apache.xerces.internal.util.XMLChar; import java.io.IOException; import javax.xml.transform.TransformerConfigurationException; @@ -32,19 +33,16 @@ import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import org.testng.Assert; -import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; /* * @test - * @bug 6883209 - * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.OpenJDK100017Test + * @bug 6883209 8273370 + * @modules java.xml/com.sun.org.apache.xerces.internal.util * @run testng/othervm transform.OpenJDK100017Test * @summary Test XSLT won't cause StackOverflow when it handle many characters. */ -@Listeners({jaxp.library.BasePolicy.class}) public class OpenJDK100017Test { @Test @@ -56,7 +54,9 @@ public class OpenJDK100017Test { StringBuilder sb = new StringBuilder(4096); for (int x = 4096; x > 0; x--) { - sb.append((char) x); + if (XMLChar.isValid(x)) { + sb.append((char)x); + } } ser.characters(sb.toString().toCharArray(), 0, sb.toString().toCharArray().length); ser.endDocument(); diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/SerializationTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/SerializationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b13a9a2c93bdb403ef18fd758a76457e83bf2135 --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/SerializationTest.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 transform; + +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.prefs.InvalidPreferencesFormatException; +import java.util.prefs.Preferences; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.testng.Assert; +import org.testng.annotations.Test; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.dom.Element; + +/* + * @test + * @bug 8273370 + * @run testng transform.SerializationTest + * @summary Verifies that the characters are written correctly during serialization. + */ +public class SerializationTest { + + private static final String PREFS_DTD_URI + = "http://java.sun.com/dtd/preferences.dtd"; + private static String CLS_DIR = System.getProperty("test.classes", "."); + private static String SRC_DIR = System.getProperty("test.src"); + + /** + * Verifies that the XMLSupport for exportSubtree handles control characters + * correctly by reporting en error. + * + * Note: exportSubtree currently throws AssertionError. It would be more + * appropriate to throw InvalidPreferencesFormatException as the import + * method does. Since this is an edge case however, we'll keep it as is to + * avoid signature change. + * + * The following was the original test: + Preferences p = Preferences.userRoot().node("test"); + p.put("key", "[\u0018\u0019]"); + p.exportSubtree(new ByteArrayOutputStream()); + * + * The code however, hanged when running in JTReg. This test therefore replaced + * the above code with the process extracted from the exportSubtree routine. + * + * @throws Exception if the test fails + */ + @Test + public void testTrasformer() throws Exception { + Assert.assertThrows(AssertionError.class, + () -> export(new ByteArrayOutputStream())); + } + + private void export(OutputStream os) throws IOException { + Document doc = createPrefsDoc("preferences"); + Element preferences = doc.getDocumentElement(); + preferences.setAttribute("EXTERNAL_XML_VERSION", "1.0"); + Element xmlRoot = (Element) preferences.appendChild(doc.createElement("root")); + xmlRoot.setAttribute("type", "user"); + + Element e = xmlRoot; + + e.appendChild(doc.createElement("map")); + e = (Element) e.appendChild(doc.createElement("node")); + e.setAttribute("name", "test"); + + putPreferencesInXml(e, doc); + + writeDoc(doc, os); + } + + private static Document createPrefsDoc(String qname) { + try { + DOMImplementation di = DocumentBuilderFactory.newInstance(). + newDocumentBuilder().getDOMImplementation(); + DocumentType dt = di.createDocumentType(qname, null, PREFS_DTD_URI); + return di.createDocument(null, qname, dt); + } catch (ParserConfigurationException e) { + throw new AssertionError(e); + } + } + + private static void putPreferencesInXml(Element elt, Document doc) { + Element map = (Element) elt.appendChild(doc.createElement("map")); + Element entry = (Element) map.appendChild(doc.createElement("entry")); + entry.setAttribute("key", "key"); + entry.setAttribute("value", "[\u0018\u0019]"); + } + + private void writeDoc(Document doc, OutputStream out) + throws IOException { + try { + TransformerFactory tf = TransformerFactory.newInstance(); + tf.setAttribute("indent-number", 2); + Transformer t = tf.newTransformer(); + t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doc.getDoctype().getSystemId()); + t.setOutputProperty(OutputKeys.INDENT, "yes"); + //Transformer resets the "indent" info if the "result" is a StreamResult with + //an OutputStream object embedded, creating a Writer object on top of that + //OutputStream object however works. + t.transform(new DOMSource(doc), + new StreamResult(new BufferedWriter(new OutputStreamWriter(out, "UTF-8")))); + } catch (TransformerException e) { + throw new AssertionError(e); + } + } + + /** + * Verifies that the XMLSupport for importPreferences handles control + * characters correctly by reporting en error. + * + * Note: this is the existing behavior. This test is here to match with the + * export method. + * + * "preferences.xml" was generated by calling the exportSubtree method + * before the patch. + * + * @throws Exception if the test fails + */ + @Test + public void testParser() throws Exception { + Assert.assertThrows(InvalidPreferencesFormatException.class, () -> { + Preferences.importPreferences( + new FileInputStream(new File(SRC_DIR + "/preferences.xml"))); + }); + } +} diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/preferences.xml b/test/jaxp/javax/xml/jaxp/unittest/transform/preferences.xml new file mode 100644 index 0000000000000000000000000000000000000000..f2ac3cf4860bee00db1b43e5382094e91ae0abb9 --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/preferences.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java index 10f9157eef71f9e02f4c46eb7976cba7fa948f3d..9f360c38cec82fe23003c9d6bde621dd6881e4d0 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ import org.testng.annotations.Test; * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4987574 * @run testng/othervm validation.Bug4987574 - * @summary Test schemaFactory.newSchema doesn't throw NullPointerExceptio for empty schema. + * @summary Test schemaFactory.newSchema doesn't throw NullPointerException for empty schema. */ @Listeners({jaxp.library.FilePolicy.class}) public class Bug4987574 { diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index fc1979b6ed635acb4f91c8a7c1b0f98e7f2cf728..8fb2ed067a1794dd11ff086b4429203f4a5c027b 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -542,6 +542,7 @@ java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java 8151492 generic- java/lang/invoke/LFCaching/LFGarbageCollectedTest.java 8078602 generic-all java/lang/invoke/lambda/LambdaFileEncodingSerialization.java 8249079 linux-x64 java/lang/invoke/RicochetTest.java 8251969 generic-all +java/lang/Enum/ConstantDirectoryOptimalCapacity.java 8282120 generic-all ############################################################################ @@ -738,12 +739,10 @@ javax/swing/plaf/metal/MetalGradient/8163193/ButtonGradientTest.java 8277816 ma javax/swing/JInternalFrame/8160248/JInternalFrameDraggingTest.java 8277816 macosx-aarch64 javax/swing/JInternalFrame/8069348/bug8069348.java 8277816 macosx-aarch64 java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java 8277816 macosx-aarch64 -java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java 8282270 linux-all -java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java 8282270 windows-all java/awt/Robot/CheckCommonColors/CheckCommonColors.java 8277816 macosx-aarch64 java/awt/ColorClass/AlphaColorTest.java 8277816 macosx-aarch64 java/awt/AlphaComposite/WindowAlphaCompositeTest.java 8277816 macosx-aarch64 - + # macos12 failure javax/swing/JMenu/4515762/bug4515762.java 8276074 macosx-all @@ -760,7 +759,6 @@ javax/swing/JTree/4908142/bug4908142.java 8278348 macosx-all # jdk_time - ############################################################################ # core_tools diff --git a/test/jdk/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java b/test/jdk/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java index b304121fa0c9fc177857bf7cf64e1064ab02c290..2367c361d5730a417b5a97cdf2c4c80d80502250 100644 --- a/test/jdk/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java +++ b/test/jdk/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /** * @test - * @bug 6330287 6331386 7044060 + * @bug 6330287 6331386 7044060 8267319 * @summary verify that DHKeyPairGenerator returns keys of the expected size * (modulus and exponent) * -and- @@ -58,7 +58,7 @@ public class TestExponentSize { */ private enum Sizes { two56(256), three84(384), five12(512), seven68(768), ten24(1024), - twenty48(2048); + fifteen36(1536), twenty48(2048), thirty72(3072); private final int intSize; private final BigInteger bigIntValue; @@ -83,11 +83,14 @@ public class TestExponentSize { KeyPair kp; KeyPairGenerator kpg = KeyPairGenerator.getInstance("DH", "SunJCE"); - // Sun's default uses a default psize of 2048 and + // Sun's default uses a default psize of 3072 and // lsize of (pSize / 2) but at least 384 bits kp = kpg.generateKeyPair(); - checkKeyPair(kp, Sizes.twenty48, Sizes.ten24); + checkKeyPair(kp, Sizes.thirty72, Sizes.fifteen36); + kpg.initialize(Sizes.twenty48.getIntSize()); + kp = kpg.generateKeyPair(); + checkKeyPair(kp, Sizes.twenty48, Sizes.ten24); DHPublicKey publicKey = (DHPublicKey)kp.getPublic(); BigInteger p = publicKey.getParams().getP(); BigInteger g = publicKey.getParams().getG(); diff --git a/test/jdk/com/sun/crypto/provider/KeyGenerator/Test4628062.java b/test/jdk/com/sun/crypto/provider/KeyGenerator/Test4628062.java index 3e93874a88ab07966587d18cbd8c998576fad3e8..10cb29b6db2e064396535139edc103be630a195d 100644 --- a/test/jdk/com/sun/crypto/provider/KeyGenerator/Test4628062.java +++ b/test/jdk/com/sun/crypto/provider/KeyGenerator/Test4628062.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4628062 4963723 + * @bug 4628062 4963723 8267319 * @summary Verify that AES KeyGenerator supports default initialization * when init is not called * @author Valerie Peng @@ -34,7 +34,8 @@ import java.util.*; public class Test4628062 { - private static final int[] AES_SIZES = { 16, 24, 32 }; // in bytes + // first value is the default key size + private static final int[] AES_SIZES = { 32, 16, 24 }; // in bytes private static final int[] HMACSHA224_SIZES = { 28 }; private static final int[] HMACSHA256_SIZES = { 32 }; private static final int[] HMACSHA384_SIZES = { 48 }; diff --git a/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java b/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java index 835a52c7719ab60f1ded91dc309d28f68a9829f2..db34b1714b533000f8a0077d65be09643657b92c 100644 --- a/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java +++ b/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java @@ -66,14 +66,14 @@ public class HiDPIRobotScreenCaptureTest { } Frame frame = new Frame(); - // Position the frame on prime number coordinates to avoid - // them being multiple of the desktop scale; this tests Linux + // Position the frame on prime number coordinates (mind OFFSET) + // to avoid them being multiple of the desktop scale; this tests Linux // color picker better. // Also, the position should be far enough from the top left // corner of the screen to reduce the chance of being repositioned // by the system because that area's occupied by the global // menu bar and such. - frame.setBounds(83, 97, 400, 300); + frame.setBounds(78, 92, 100, 100); frame.setUndecorated(true); Panel panel = new Panel(new BorderLayout()); diff --git a/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java b/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java index ef45c08988a3fae6b3c1eb26c507a4b8e9eb6977..6ba5ec18e0a90519496fa9ac2377c9afda0b3c4d 100644 --- a/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java +++ b/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java @@ -31,6 +31,12 @@ import java.awt.Panel; import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; +import java.awt.image.BufferedImage; +import javax.swing.UIManager; +import javax.imageio.ImageIO; +import java.io.File; +import java.io.IOException; + /** * @test @@ -40,11 +46,7 @@ import java.awt.Robot; * Gtk backends and presence of UI scaling * @requires os.family == "linux" * @run main/othervm -Djdk.gtk.version=2 -Dsun.java2d.uiScale=1 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=2 -Dsun.java2d.uiScale=2 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=2 -Dsun.java2d.uiScale=3 ScreenCaptureGtkTest * @run main/othervm -Djdk.gtk.version=3 -Dsun.java2d.uiScale=1 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=3 -Dsun.java2d.uiScale=2 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=3 -Dsun.java2d.uiScale=3 ScreenCaptureGtkTest */ public class ScreenCaptureGtkTest { @@ -52,15 +54,18 @@ public class ScreenCaptureGtkTest { Color.GREEN, Color.BLUE, Color.ORANGE, Color.RED}; public static void main(String[] args) throws Exception { + final int topOffset = 50; + final int leftOffset = 50; + Frame frame = new Frame(); - // Position the frame on prime number coordinates to avoid - // them being multiple of the desktop scale; this tests Linux - // color picker better. + // Position the frame such that color picker will work with + // prime number coordinates (mind the offset) to avoid them being + // multiple of the desktop scale; this tests Linux color picker better. // Also, the position should be far enough from the top left // corner of the screen to reduce the chance of being repositioned // by the system because that area's occupied by the global // menu bar and such. - frame.setBounds(83, 97, 400, 300); + frame.setBounds(89, 99, 100, 100); frame.setUndecorated(true); Panel panel = new Panel(new BorderLayout()); @@ -74,9 +79,9 @@ public class ScreenCaptureGtkTest { g.fillRect(0, 0, w, h); // Paint several distinct pixels next to one another // in order to test color picker's precision. - for (int i = 1; i < 4; i++) { + for (int i = 1; i < COLORS.length; i++) { g.setColor(COLORS[i]); - g.fillRect(i, 0, 1, 1); + g.fillRect(leftOffset + i, topOffset, 1, 1); } } }; @@ -88,19 +93,25 @@ public class ScreenCaptureGtkTest { robot.waitForIdle(); robot.delay(500); - final Point screenLocation = frame.getLocationOnScreen(); - checkPixelColors(robot, screenLocation.x, screenLocation.y); + captureImageOf(frame, robot); - robot.delay(100); - frame.dispose(); + final Point screenLocation = frame.getLocationOnScreen(); + try { + checkPixelColors(robot, screenLocation.x + leftOffset, + screenLocation.y + topOffset); + } finally { + robot.delay(100); + frame.dispose(); + } } static void checkPixelColors(Robot robot, int x, int y) { - for (int i = 0; i < 4; i++) { + for (int i = 0; i < COLORS.length; i++) { final Color actualColor = robot.getPixelColor(x + i, y); System.out.print("Checking color at " + (x + i) + ", " + y + " to be equal to " + COLORS[i]); if (!actualColor.equals(COLORS[i])) { System.out.println("... Mismatch: found " + actualColor + " instead"); + saveImage(); throw new RuntimeException("Wrong screen pixel color"); } else { @@ -108,4 +119,24 @@ public class ScreenCaptureGtkTest { } } } + + private static BufferedImage image; + + static void captureImageOf(Frame frame, Robot robot) { + Rectangle rect = frame.getBounds(); + rect.setLocation(frame.getLocationOnScreen()); + + System.out.println("Creating screen capture of " + rect); + image = robot.createScreenCapture(rect); + } + + static void saveImage() { + System.out.println("Check image.png"); + try { + ImageIO.write(image, "png", new File("image.png")); + } catch(IOException e) { + System.out.println("failed to save image.png."); + e.printStackTrace(); + } + } } diff --git a/test/jdk/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java b/test/jdk/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java index fcec97d7fb1de67c2534c980ec7a3bab304332b4..aada6d7af8a37fe3a7e99cbd03d2069925a99c28 100644 --- a/test/jdk/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java +++ b/test/jdk/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -672,7 +672,7 @@ public class AutoTestOnTop { } catch (Exception e) { error("Test failed: stage#" + stageNum + "action #" + actNum + ": " + msgCase + ": " + msgAction + ": setAlwaysOnTop(" + value + ") called at state " + msgVisibility + - " threw exeption " + e); + " threw exception " + e); } } @@ -685,7 +685,7 @@ public class AutoTestOnTop { } catch (Exception e) { error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": isAlwaysOnTop() called at state " + msgVisibility + - " threw exeption " + e); + " threw exception " + e); } return result; } diff --git a/test/jdk/java/awt/dnd/ImageDecoratedDnDNegative/DnDSource.java b/test/jdk/java/awt/dnd/ImageDecoratedDnDNegative/DnDSource.java index c1548966ab5b2b9f15527f5ec3f20ce38bb4b054..750448c562d6512ab14d918a0d96b38811b70415 100644 --- a/test/jdk/java/awt/dnd/ImageDecoratedDnDNegative/DnDSource.java +++ b/test/jdk/java/awt/dnd/ImageDecoratedDnDNegative/DnDSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ class DnDSource extends Button implements Transferable, * a Drag gesture has been recognized */ int iProblem = 0; - String[] problem = {"unready", "throw exeption", "good"}; + String[] problem = {"unready", "throw exception", "good"}; public void dragGestureRecognized(DragGestureEvent dge) { System.out.println("starting Drag"); if( !DragSource.isDragImageSupported() ) { diff --git a/test/jdk/java/awt/font/GlyphVector/MultiSlotFontTest.java b/test/jdk/java/awt/font/GlyphVector/MultiSlotFontTest.java new file mode 100644 index 0000000000000000000000000000000000000000..65acd420345b8839b6d38847039ca92faa7e357a --- /dev/null +++ b/test/jdk/java/awt/font/GlyphVector/MultiSlotFontTest.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8240756 + * @summary Non-English characters are printed with wrong glyphs on MacOS + * @modules java.desktop/sun.java2d java.desktop/sun.java2d.loops java.desktop/sun.font + * @requires os.family == "mac" + * @run main MultiSlotFontTest + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.image.BufferedImage; +import sun.font.StandardGlyphVector; +import sun.java2d.OSXOffScreenSurfaceData; +import sun.java2d.SunGraphics2D; +import sun.java2d.SurfaceData; +import sun.java2d.loops.SurfaceType; + +public class MultiSlotFontTest { + + private static final int WIDTH = 100; + private static final int HEIGHT = 60; + + private static final String TEST_STR = "\u3042\u3044\u3046\u3048\u304Aabc"; + private static final int EXPECTED_HEIGHT = 10; + private static final int EXPECTED_WIDTH = 77; + private static final int LIMIT_DIFF_HEIGHT = 3; + private static final int LIMIT_DIFF_WIDTH = 15; + + public static void main(String[] args) throws Exception { + MultiSlotFontTest test = new MultiSlotFontTest(); + } + + public MultiSlotFontTest() { + BufferedImage img = createImage(); + + SurfaceData sd = OSXOffScreenSurfaceData.createDataIC(img, + SurfaceType.IntRgb); + SunGraphics2D g2d = new SunGraphics2D(sd, + Color.BLACK, Color.WHITE, null); + Font font = g2d.getFont(); + + if (font.canDisplayUpTo(TEST_STR) != -1) { + System.out.println("There is no capable font. Skipping the test."); + System.out.println("Font: " + font); + return; + } + + FontRenderContext frc = new FontRenderContext(null, false, false); + StandardGlyphVector gv = new StandardGlyphVector(font, TEST_STR, frc); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + g2d.drawGlyphVector(gv, 0.0f, (float)(HEIGHT - 5)); + g2d.dispose(); + + Dimension d = getBounds(img); + + if (Math.abs(d.height - EXPECTED_HEIGHT) > LIMIT_DIFF_HEIGHT || + Math.abs(d.width - EXPECTED_WIDTH) > LIMIT_DIFF_WIDTH) { + debugOut(img); + throw new RuntimeException( + "Incorrect GlyphVector shape " + d + "," + gv); + } + } + + private static BufferedImage createImage() { + BufferedImage image = new BufferedImage(WIDTH, HEIGHT, + BufferedImage.TYPE_INT_RGB); + Graphics g = image.createGraphics(); + g.setColor(Color.WHITE); + g.fillRect(0, 0, WIDTH, HEIGHT); + g.dispose(); + return image; + } + + private Dimension getBounds(BufferedImage img) { + int top = HEIGHT; + int left = WIDTH; + int right = 0; + int bottom = 0; + for (int y = 0; y < HEIGHT; y++) { + for (int x = 0; x < WIDTH; x++) { + if ((img.getRGB(x, y) & 0xFFFFFF) == 0) { + if (top > y) top = y; + if (bottom < y) bottom = y; + if (left > x) left = x; + if (right < x) right = x; + } + } + } + return new Dimension(right - left, bottom - top); + } + + private void debugOut(BufferedImage img) { + for (int y = 0; y < HEIGHT; y++) { + for (int x = 0; x < WIDTH; x++) { + int c = img.getRGB(x, y) & 0xFFFFFF; + if (c == 0) { + System.out.print("*"); + } else { + System.out.print(" "); + } + } + System.out.println(); + } + } +} diff --git a/test/jdk/java/awt/print/PrinterJob/InitToBlack.java b/test/jdk/java/awt/print/PrinterJob/InitToBlack.java index 783320829b632d658349195ae14aa5a37a857bfc..a4d7dd0a9589c5c3fb1d605cd7df927d5da1f5e5 100644 --- a/test/jdk/java/awt/print/PrinterJob/InitToBlack.java +++ b/test/jdk/java/awt/print/PrinterJob/InitToBlack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,21 +22,57 @@ */ /** + * @test * @bug 4184565 * @summary Confirm that the default foreground color on a printer * graphics object is black so that rendering will appear * without having to execute setColor first. - * @run applet/manual=yesno InitToBlack.html + * @run main/manual InitToBlack */ -import java.awt.*; -import java.awt.print.*; -import java.applet.Applet; +import java.awt.BorderLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.Book; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; -public class InitToBlack extends Applet implements Printable { +public class InitToBlack implements Printable { - public void init() { + private static volatile JFrame frame; + private static volatile boolean testResult = false; + private static volatile CountDownLatch printButtonCountDownLatch = + new CountDownLatch(1); + private static volatile CountDownLatch CountDownLatch = + new CountDownLatch(1); + private static volatile String failureReason; + + @Override + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + Graphics2D g2d = (Graphics2D) graphics; + g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); + graphics.drawString("Test Passes", 200, 200); + return PAGE_EXISTS; + } + + private void test() { PrinterJob pjob = PrinterJob.getPrinterJob(); + if (pjob.getPrintService() == null) { + System.out.println("There is no printer configured on this system"); + return; + } Book book = new Book(); book.append(this, pjob.defaultPage()); @@ -49,17 +85,97 @@ public class InitToBlack extends Applet implements Printable { } } - public int print(Graphics g, PageFormat pf, int pageIndex) { - Graphics2D g2d = (Graphics2D) g; - g2d.translate(pf.getImageableX(), pf.getImageableY()); + private static void createTestUI() { + frame = new JFrame("Test InitToBlack"); + String INSTRUCTION = """ + Aim: This test checks whether the default foreground color on a printer + graphics object is black so that rendering will appear without having + to execute setColor. + Step: + 1) Click on the "Print" button. Check whether page is printed on the printer. + 2) Check whether "Test Passes" is printed on the page and it should be in + black color. If yes then press "Pass" button else press "Fail" button. + """; + JTextArea instructionTextArea = new JTextArea(INSTRUCTION, 4, 40); + instructionTextArea.setEditable(false); - g.drawString("Test Passes", 200, 200); + JPanel buttonPanel = new JPanel(); + JButton printButton = new JButton("Print"); + printButton.addActionListener((ae) -> { + InitToBlack initToBlack = new InitToBlack(); + initToBlack.test(); + printButtonCountDownLatch.countDown(); + }); - return PAGE_EXISTS; + JButton passButton = new JButton("Pass"); + passButton.addActionListener((ae) -> { + testResult = true; + CountDownLatch.countDown(); + frame.dispose(); + }); + JButton failButton = new JButton("Fail"); + failButton.addActionListener((ae) -> { + getFailureReason(); + frame.dispose(); + }); + buttonPanel.add(printButton); + buttonPanel.add(passButton); + buttonPanel.add(failButton); + + JPanel panel = new JPanel(new BorderLayout()); + panel.add(instructionTextArea, BorderLayout.CENTER); + panel.add(buttonPanel, BorderLayout.SOUTH); + + frame.add(panel); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } + + public static void getFailureReason() { + final JDialog dialog = new JDialog(); + dialog.setTitle("Read testcase failure reason"); + JPanel jPanel = new JPanel(new BorderLayout()); + JTextArea jTextArea = new JTextArea(5, 20); + + JButton okButton = new JButton("Ok"); + okButton.addActionListener((ae) -> { + failureReason = jTextArea.getText(); + testResult = false; + CountDownLatch.countDown(); + dialog.dispose(); + }); + + jPanel.add(new JLabel("Enter the testcase failed reason below and " + + "click OK button", JLabel.CENTER), BorderLayout.NORTH); + jPanel.add(jTextArea, BorderLayout.CENTER); + + JPanel okayBtnPanel = new JPanel(); + okayBtnPanel.add(okButton); + + jPanel.add(okayBtnPanel, BorderLayout.SOUTH); + dialog.add(jPanel); + dialog.setLocationRelativeTo(null); + dialog.pack(); + dialog.setVisible(true); } - public static void main(String[] args) { - new InitToBlack().init(); - System.exit(0); + public static void main(String[] args) throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(InitToBlack::createTestUI); + if (!printButtonCountDownLatch.await(2, TimeUnit.MINUTES)) { + throw new RuntimeException("Timeout: User did not perform action " + + "on Print button."); + } + if (!CountDownLatch.await(2, TimeUnit.MINUTES)) { + throw new RuntimeException("Timeout : User did not decide " + + "whether test passed or failed"); + } + + if (!testResult) { + throw new RuntimeException("Test failed : " + failureReason); + } else { + System.out.println("Test Passed"); + } } } diff --git a/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java new file mode 100644 index 0000000000000000000000000000000000000000..a2a2312d6e30143a15d782a0f3437c647b7a075a --- /dev/null +++ b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8080535 8191410 8215194 8221431 8239383 8268081 8283465 + * @summary Check if the NUM_ENTITIES field reflects the correct number + * of Character.UnicodeBlock constants. + * @modules java.base/java.lang:open + * @run testng NumberEntities + */ + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; + +import java.lang.reflect.Field; +import java.util.Map; + +@Test +public class NumberEntities { + public void test_NumberEntities() throws Throwable { + // The number of entries in Character.UnicodeBlock.map. + // See src/java.base/share/classes/java/lang/Character.java + Field n = Character.UnicodeBlock.class.getDeclaredField("NUM_ENTITIES"); + Field m = Character.UnicodeBlock.class.getDeclaredField("map"); + n.setAccessible(true); + m.setAccessible(true); + assertEquals(((Map)m.get(null)).size(), n.getInt(null)); + } +} diff --git a/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java b/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java deleted file mode 100644 index abe63eb0b7c881885241ef39f36f064f606b7806..0000000000000000000000000000000000000000 --- a/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. - * 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 8080535 8191410 8215194 8221431 8239383 8268081 - * @summary Expected size of Character.UnicodeBlock.map is not optimal - * @library /test/lib - * @modules java.base/java.lang:open - * java.base/java.util:open - * @build jdk.test.lib.util.OptimalCapacity - * @run main OptimalMapSize - */ - -import java.lang.reflect.Field; -import jdk.test.lib.util.OptimalCapacity; - -// What will be the number of the Unicode blocks in the future. -// -// According to http://www.unicode.org/versions/Unicode7.0.0/ , -// in Unicode 7 there will be added 32 new blocks (96 with aliases). -// According to http://www.unicode.org/versions/beta-8.0.0.html , -// in Unicode 8 there will be added 10 more blocks (30 with aliases). -// -// After implementing support of Unicode 9 and 10 in Java, there will -// be 638 entries in Character.UnicodeBlock.map. -// -// As of Unicode 11, 667 entries are expected. -// As of Unicode 12.1, 676 entries are expected. -// As of Unicode 13.0, 684 entries are expected. -// As of Unicode 14.0, 696 entries are expected. -// -// Initialization of the map and this test will have to be adjusted -// accordingly then. -// -// Note that HashMap's implementation aligns the initial capacity to -// a power of two size, so it will end up 1024 (and thus succeed) in -// cases, such as 638, 667, 676, 684, and 696. - -public class OptimalMapSize { - public static void main(String[] args) throws Throwable { - // The initial size of Character.UnicodeBlock.map. - // See src/java.base/share/classes/java/lang/Character.java - Field f = Character.UnicodeBlock.class.getDeclaredField("NUM_ENTITIES"); - f.setAccessible(true); - int num_entities = f.getInt(null); - assert num_entities == 696; - int initialCapacity = (int)(num_entities / 0.75f + 1.0f); - - OptimalCapacity.ofHashMap(Character.UnicodeBlock.class, - "map", initialCapacity); - } -} diff --git a/test/jdk/java/lang/ProcessBuilder/ProcessReaperCCL.java b/test/jdk/java/lang/ProcessBuilder/ProcessReaperCCL.java new file mode 100644 index 0000000000000000000000000000000000000000..00fa38bdb0dec39dbd85ace34c7dde8b12a7b5e7 --- /dev/null +++ b/test/jdk/java/lang/ProcessBuilder/ProcessReaperCCL.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8269488 + * @summary verify that Process Reaper threads have a null CCL + * @run testng ProcessReaperCCL + */ + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +import org.testng.Assert; +import org.testng.annotations.Test; + + +public class ProcessReaperCCL { + + @Test + static void test() throws Exception { + // create a class loader + File dir = new File("."); + URL[] urls = new URL[] {dir.toURI().toURL()}; + ClassLoader cl = new URLClassLoader(urls); + Thread.currentThread().setContextClassLoader(cl); + + // Invoke a subprocess with processBuilder + ProcessBuilder pb = new ProcessBuilder(List.of("echo", "abc", "xyz")); + Process p = pb.start(); + CompletableFuture cf = p.onExit(); + int exitValue = cf.get().exitValue(); + Assert.assertEquals(exitValue, 0, "error exit value"); + + // Verify all "Process Reaper" threads have a null CCL + for (Thread th : Thread.getAllStackTraces().keySet()) { + if ("process reaper".equals(th.getName())) { + Assert.assertEquals(th.getContextClassLoader(), null, "CCL not null"); + } + } + } +} diff --git a/test/jdk/java/lang/Throwable/StackTraceSerialization.java b/test/jdk/java/lang/Throwable/StackTraceSerialization.java index 29a4d2a8c133faa149a53c295172a8f293b42650..015c39b202dc9ca532b1826b55f7805ce936d285 100644 --- a/test/jdk/java/lang/Throwable/StackTraceSerialization.java +++ b/test/jdk/java/lang/Throwable/StackTraceSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -126,7 +126,7 @@ public class StackTraceSerialization { * Returns true if e1 and e2 have equal stack traces and their * causes are recursively equal (by the same definition) and their * suppressed exception information is equals. Returns false or - * throws NullPointerExeption otherwise. + * throws NullPointerException otherwise. */ private static boolean equal(Throwable t1, Throwable t2) { return t1==t2 || diff --git a/test/jdk/java/lang/constant/ClassDescTest.java b/test/jdk/java/lang/constant/ClassDescTest.java index 32cf19b4fb4cf4f101344d3ba3f35810ee38ba94..81104e92c49ac47d26fa4229099f3e022d7b4dd7 100644 --- a/test/jdk/java/lang/constant/ClassDescTest.java +++ b/test/jdk/java/lang/constant/ClassDescTest.java @@ -42,7 +42,7 @@ import static org.testng.Assert.fail; /** * @test - * @bug 8215510 + * @bug 8215510 8283075 * @compile ClassDescTest.java * @run testng ClassDescTest * @summary unit tests for java.lang.constant.ClassDesc @@ -184,6 +184,19 @@ public class ClassDescTest extends SymbolicDescTest { } } + private void testArrayRankOverflow() { + ClassDesc TwoDArrayDesc = + String.class.describeConstable().get().arrayType().arrayType(); + + try { + TwoDArrayDesc.arrayType(Integer.MAX_VALUE); + fail(""); + } catch (IllegalArgumentException iae) { + // Expected + } + } + + public void testArrayClassDesc() throws ReflectiveOperationException { for (String d : basicDescs) { ClassDesc a0 = ClassDesc.ofDescriptor(d); @@ -218,6 +231,7 @@ public class ClassDescTest extends SymbolicDescTest { testBadArrayRank(ConstantDescs.CD_int); testBadArrayRank(ConstantDescs.CD_String); testBadArrayRank(ClassDesc.of("Bar")); + testArrayRankOverflow(); } } diff --git a/test/jdk/java/net/Authenticator/B4722333.java b/test/jdk/java/net/Authenticator/B4722333.java index 70b0fce70c65b4d638120261a3e75e9a97936fe3..143022995af0d43cde092aa00abc8308ad6297dc 100644 --- a/test/jdk/java/net/Authenticator/B4722333.java +++ b/test/jdk/java/net/Authenticator/B4722333.java @@ -25,7 +25,7 @@ * @test * @bug 4722333 * @library /test/lib - * @run main/othervm B4722333 + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 B4722333 * @summary JRE Proxy Authentication Not Working with ISA2000 */ diff --git a/test/jdk/java/net/Authenticator/B4759514.java b/test/jdk/java/net/Authenticator/B4759514.java index a659da82482790cf3c9a27393a9b807dd3b75d06..174527c0e9bb3ecb2d4a5916a5662fbdce9927b3 100644 --- a/test/jdk/java/net/Authenticator/B4759514.java +++ b/test/jdk/java/net/Authenticator/B4759514.java @@ -25,8 +25,8 @@ * @test * @bug 4759514 * @library /test/lib - * @run main/othervm B4759514 - * @run main/othervm -Djava.net.preferIPv6Addresses=true B4759514 + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 B4759514 + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 -Djava.net.preferIPv6Addresses=true B4759514 * @summary Digest Authentication is erroniously quoting the nc value, contrary to RFC 2617 */ diff --git a/test/jdk/java/net/Authenticator/B6870935.java b/test/jdk/java/net/Authenticator/B6870935.java index 9f672775ad5752f77c5a5fceb2be7bc23acc528f..0033b70d75cc867ae8616ebae91454e1012363d9 100644 --- a/test/jdk/java/net/Authenticator/B6870935.java +++ b/test/jdk/java/net/Authenticator/B6870935.java @@ -25,8 +25,10 @@ * @test * @bug 6870935 * @modules java.base/sun.net.www - * @run main/othervm -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935 - * @run main/othervm -Djava.net.preferIPv6Addresses=true + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935 + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Djava.net.preferIPv6Addresses=true * -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935 */ diff --git a/test/jdk/java/net/Authenticator/B8034170.java b/test/jdk/java/net/Authenticator/B8034170.java index 964747e03e817cb4f362112a5b69a0c6917fed5a..dde7b683dd2254fdb28ae30a40b2cb9c05ff094a 100644 --- a/test/jdk/java/net/Authenticator/B8034170.java +++ b/test/jdk/java/net/Authenticator/B8034170.java @@ -31,9 +31,11 @@ import jdk.test.lib.net.URIBuilder; * @bug 8034170 * @summary Digest authentication interop issue * @library /test/lib - * @run main/othervm B8034170 unquoted - * @run main/othervm -Dhttp.auth.digest.quoteParameters=true B8034170 quoted - * @run main/othervm -Djava.net.preferIPv6Addresses=true B8034170 unquoted + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 B8034170 unquoted + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Dhttp.auth.digest.quoteParameters=true B8034170 quoted + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Djava.net.preferIPv6Addresses=true B8034170 unquoted */ public class B8034170 { diff --git a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java index 48492099cc97f179c0944c4d82e6fe39746adb30..243c79d9644b7239122fb5ec0222686ef7b0e528 100644 --- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java +++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java @@ -63,10 +63,10 @@ import java.util.stream.Stream; * no real difference between BASICSERVER and BASIC - it should * be transparent on the client side. * @run main/othervm HTTPSetAuthenticatorTest NONE SERVER PROXY SERVER307 PROXY305 - * @run main/othervm HTTPSetAuthenticatorTest DIGEST SERVER - * @run main/othervm HTTPSetAuthenticatorTest DIGEST PROXY - * @run main/othervm HTTPSetAuthenticatorTest DIGEST PROXY305 - * @run main/othervm HTTPSetAuthenticatorTest DIGEST SERVER307 + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPSetAuthenticatorTest DIGEST SERVER + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPSetAuthenticatorTest DIGEST PROXY + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPSetAuthenticatorTest DIGEST PROXY305 + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPSetAuthenticatorTest DIGEST SERVER307 * @run main/othervm HTTPSetAuthenticatorTest BASIC SERVER * @run main/othervm HTTPSetAuthenticatorTest BASIC PROXY * @run main/othervm HTTPSetAuthenticatorTest BASIC PROXY305 diff --git a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java index 6886ae0979e192729ff6272e6b7dea12dd8dcfbb..2dc6963a63e436e485fc5cf5e6c9f5d9da2faa1d 100644 --- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java +++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java @@ -63,15 +63,16 @@ import static java.net.Proxy.NO_PROXY; * server that perform Digest authentication; * PROXY305: The server attempts to redirect * the client to a proxy using 305 code; - * @run main/othervm HTTPTest SERVER - * @run main/othervm HTTPTest PROXY - * @run main/othervm HTTPTest SERVER307 - * @run main/othervm HTTPTest PROXY305 + * @run main/othervm -Dtest.debug=true -Dtest.digest.algorithm=SHA-512 HTTPTest SERVER + * @run main/othervm -Dtest.debug=true -Dtest.digest.algorithm=SHA-256 HTTPTest SERVER + * @run main/othervm -Dtest.debug=true -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPTest SERVER + * @run main/othervm -Dtest.debug=true -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPTest PROXY + * @run main/othervm -Dtest.debug=true -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPTest SERVER307 + * @run main/othervm -Dtest.debug=true -Dhttp.auth.digest.reEnabledAlgorithms=MD5 HTTPTest PROXY305 * * @author danielfuchs */ public class HTTPTest { - public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("test.debug", "false")); public static enum HttpAuthType { SERVER, PROXY, SERVER307, PROXY305 }; @@ -194,6 +195,10 @@ public class HTTPTest { // silently skip unsupported test combination return; } + String digestalg = System.getProperty("test.digest.algorithm"); + if (digestalg == null || "".equals(digestalg)) + digestalg = "MD5"; + System.out.println("\n**** Testing " + protocol + " " + mode + " mode ****\n"); int authCount = AUTHENTICATOR.count.get(); @@ -205,7 +210,9 @@ public class HTTPTest { HTTPTestServer.create(protocol, mode, AUTHENTICATOR, - getHttpSchemeType()); + getHttpSchemeType(), + null, + digestalg); try { expectedIncrement += run(server, protocol, mode); } finally { diff --git a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java index 91efe8d736b907ab2c42444084730f72a2238ef6..5bdc032280a8ca19150ad5365795d81bcfe4ef39 100644 --- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java +++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java @@ -117,12 +117,22 @@ public class HTTPTestServer extends HTTPTest { HttpSchemeType schemeType, HttpHandler delegate) throws IOException { + return create(protocol, authType, auth, schemeType, null, "MD5"); + } + + public static HTTPTestServer create(HttpProtocolType protocol, + HttpAuthType authType, + HttpTestAuthenticator auth, + HttpSchemeType schemeType, + HttpHandler delegate, + String algorithm) + throws IOException { Objects.requireNonNull(authType); Objects.requireNonNull(auth); switch(authType) { // A server that performs Server Digest authentication. case SERVER: return createServer(protocol, authType, auth, - schemeType, delegate, "/"); + schemeType, delegate, algorithm, "/"); // A server that pretends to be a Proxy and performs // Proxy Digest authentication. If protocol is HTTPS, // then this will create a HttpsProxyTunnel that will @@ -327,6 +337,7 @@ public class HTTPTestServer extends HTTPTest { HttpTestAuthenticator auth, HttpSchemeType schemeType, HttpHandler delegate, + String algorithm, String path) throws IOException { Objects.requireNonNull(authType); @@ -336,7 +347,7 @@ public class HTTPTestServer extends HTTPTest { final HTTPTestServer server = new HTTPTestServer(impl, null, delegate); final HttpHandler hh = server.createHandler(schemeType, auth, authType); HttpContext ctxt = impl.createContext(path, hh); - server.configureAuthentication(ctxt, schemeType, auth, authType); + server.configureAuthentication(ctxt, schemeType, auth, authType, algorithm); impl.start(); return server; } @@ -357,7 +368,7 @@ public class HTTPTestServer extends HTTPTest { : new HTTPTestServer(impl, null, delegate); final HttpHandler hh = server.createHandler(schemeType, auth, authType); HttpContext ctxt = impl.createContext(path, hh); - server.configureAuthentication(ctxt, schemeType, auth, authType); + server.configureAuthentication(ctxt, schemeType, auth, authType, null); impl.start(); return server; @@ -385,7 +396,7 @@ public class HTTPTestServer extends HTTPTest { ? createProxy(protocol, targetAuthType, auth, schemeType, targetDelegate, "/") : createServer(targetProtocol, targetAuthType, - auth, schemeType, targetDelegate, "/"); + auth, schemeType, targetDelegate, "MD5", "/"); HttpServer impl = createHttpServer(protocol); final HTTPTestServer redirectingServer = new HTTPTestServer(impl, redirectTarget, null); @@ -431,11 +442,11 @@ public class HTTPTestServer extends HTTPTest { private void configureAuthentication(HttpContext ctxt, HttpSchemeType schemeType, HttpTestAuthenticator auth, - HttpAuthType authType) { + HttpAuthType authType, String algorithm) { switch(schemeType) { case DIGEST: // DIGEST authentication is handled by the handler. - ctxt.getFilters().add(new HttpDigestFilter(auth, authType)); + ctxt.getFilters().add(new HttpDigestFilter(auth, authType, algorithm)); break; case BASIC: // BASIC authentication is handled by the filter. @@ -603,15 +614,21 @@ public class HTTPTestServer extends HTTPTest { public static String computeDigest(boolean isRequest, String reqMethod, char[] password, + String expectedAlgorithm, DigestResponse params) throws NoSuchAlgorithmException { String A1, HashA1; String algorithm = params.getAlgorithm("MD5"); - boolean md5sess = algorithm.equalsIgnoreCase ("MD5-sess"); + if (algorithm.endsWith("-sess")) { + algorithm = algorithm.substring(0, algorithm.length() - 5); + } + if (!algorithm.equalsIgnoreCase(expectedAlgorithm)) { + throw new IllegalArgumentException("unexpected algorithm"); + } - MessageDigest md = MessageDigest.getInstance(md5sess?"MD5":algorithm); + MessageDigest md = MessageDigest.getInstance(algorithm); if (params.username == null) { throw new IllegalArgumentException("missing username"); @@ -776,13 +793,15 @@ public class HTTPTestServer extends HTTPTest { private final HttpTestAuthenticator auth; private final byte[] nonce; private final String ns; - public HttpDigestFilter(HttpTestAuthenticator auth, HttpAuthType authType) { + private final String algorithm; + public HttpDigestFilter(HttpTestAuthenticator auth, HttpAuthType authType, String algorithm) { super(authType, authType == HttpAuthType.SERVER ? "Digest Server" : "Digest Proxy"); this.auth = auth; nonce = new byte[16]; new Random(Instant.now().toEpochMilli()).nextBytes(nonce); ns = new BigInteger(1, nonce).toString(16); + this.algorithm = (algorithm == null) ? "MD5" : algorithm; } @Override @@ -790,7 +809,7 @@ public class HTTPTestServer extends HTTPTest { throws IOException { he.getResponseHeaders().add(getAuthenticate(), "Digest realm=\"" + auth.getRealm() + "\"," - + "\r\n qop=\"auth\"," + + "\r\n qop=\"auth\", " + "algorithm=\"" + algorithm + "\", " + "\r\n nonce=\"" + ns +"\""); System.out.println(type + ": Requesting Digest Authentication " + he.getResponseHeaders().getFirst(getAuthenticate())); @@ -823,7 +842,7 @@ public class HTTPTestServer extends HTTPTest { } boolean validate(String reqMethod, DigestResponse dg) { - if (!"MD5".equalsIgnoreCase(dg.getAlgorithm("MD5"))) { + if (!this.algorithm.equalsIgnoreCase(dg.getAlgorithm("MD5"))) { System.out.println(type + ": Unsupported algorithm " + dg.algorithm); return false; @@ -854,7 +873,7 @@ public class HTTPTestServer extends HTTPTest { boolean verify(String reqMethod, DigestResponse dg, char[] pw) throws NoSuchAlgorithmException { - String response = DigestResponse.computeDigest(true, reqMethod, pw, dg); + String response = DigestResponse.computeDigest(true, reqMethod, pw, algorithm, dg); if (!dg.response.equals(response)) { System.out.println(type + ": bad response returned by client: " + dg.response + " expected " + response); diff --git a/test/jdk/java/net/httpclient/CancelRequestTest.java b/test/jdk/java/net/httpclient/CancelRequestTest.java index de48316a25b01030b32749c8058c7730d4e3f006..95d56fdbcce2e0918a38c39b231c5cf2f0d826b1 100644 --- a/test/jdk/java/net/httpclient/CancelRequestTest.java +++ b/test/jdk/java/net/httpclient/CancelRequestTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8245462 8229822 + * @bug 8245462 8229822 8254786 * @summary Tests cancelling the request. * @library /test/lib http2/server * @key randomness diff --git a/test/jdk/java/nio/charset/CharsetDecoder/ASCIIDecode.java b/test/jdk/java/nio/charset/CharsetDecoder/ASCIIDecode.java new file mode 100644 index 0000000000000000000000000000000000000000..330c2c49a0705da9a36a71162c46bebf0f8e5c4c --- /dev/null +++ b/test/jdk/java/nio/charset/CharsetDecoder/ASCIIDecode.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8283325 + * @summary Ensure that decoding to ASCII from a stream with a non-ASCII + * character correctly decodes up until the byte in error. + */ + +import java.nio.*; +import java.nio.charset.*; +import java.util.Arrays; + +public class ASCIIDecode { + + public static void main(String[] args) throws Exception { + final Charset ascii = Charset.forName("US-ASCII"); + final CharsetDecoder decoder = ascii.newDecoder(); + + byte[] ba = new byte[] { 0x60, 0x60, 0x60, (byte)0xFF }; + + // Repeat enough times to test that interpreter and JIT:ed versions + // behave the same (without the patch for 8283325 this fails within + // 50 000 iterations on the system used for verification) + for (int i = 0; i < 100_000; i++) { + ByteBuffer bb = ByteBuffer.wrap(ba); + char[] ca = new char[4]; + CharBuffer cb = CharBuffer.wrap(ca); + CoderResult buf = decoder.decode(bb, cb, true); + if (ca[0] != 0x60 || ca[1] != 0x60 || ca[2] != 0x60) { + throw new RuntimeException("Unexpected output on iteration " + i); + } + } + } +} diff --git a/test/jdk/java/nio/file/Files/probeContentType/Basic.java b/test/jdk/java/nio/file/Files/probeContentType/Basic.java index b404673b2f4ff081f3963d1314a2bfbfb06067b6..74e4cd5ab39e5eb51310cebd12ff8cc1af7ace92 100644 --- a/test/jdk/java/nio/file/Files/probeContentType/Basic.java +++ b/test/jdk/java/nio/file/Files/probeContentType/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -161,7 +161,7 @@ public class Basic { new ExType("doc", List.of("application/msword")), new ExType("docx", List.of("application/vnd.openxmlformats-officedocument.wordprocessingml.document")), new ExType("gz", List.of("application/gzip", "application/x-gzip")), - new ExType("jar", List.of("application/java-archive", "application/x-java-archive")), + new ExType("jar", List.of("application/java-archive", "application/x-java-archive", "application/jar")), new ExType("jpg", List.of("image/jpeg")), new ExType("js", List.of("text/javascript", "application/javascript")), new ExType("json", List.of("application/json")), diff --git a/test/jdk/java/nio/file/spi/SetDefaultProvider.java b/test/jdk/java/nio/file/spi/SetDefaultProvider.java index 0c012b24bf84db55c5f0b2f23c9215616e5de7f5..5af47da4f1971d59a5d091b0fe8083929c852ddd 100644 --- a/test/jdk/java/nio/file/spi/SetDefaultProvider.java +++ b/test/jdk/java/nio/file/spi/SetDefaultProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.spi.ToolProvider; -import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.test.lib.process.ProcessTools; @@ -51,7 +50,7 @@ import static org.testng.Assert.*; @Test public class SetDefaultProvider { - private static String SET_DEFAULT_FSP = + private static final String SET_DEFAULT_FSP = "-Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider"; private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar") @@ -73,7 +72,7 @@ public class SetDefaultProvider { String testClasses = System.getProperty("test.classes"); String classpath = moduleClasses + File.pathSeparator + testClasses; int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "p.Main"); - assertTrue(exitValue == 0); + assertEquals(exitValue, 0); } /** @@ -88,7 +87,7 @@ public class SetDefaultProvider { String classpath = jar + File.pathSeparator + testClasses + File.separator + "modules" + File.separator + "m"; int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "p.Main"); - assertTrue(exitValue == 0); + assertEquals(exitValue, 0); } /** @@ -112,7 +111,7 @@ public class SetDefaultProvider { } } int ret = JAR_TOOL.run(System.out, System.out, args.toArray(new String[0])); - assertTrue(ret == 0); + assertEquals(ret, 0); } /** @@ -128,7 +127,7 @@ public class SetDefaultProvider { int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "-Dtest.classes=" + testClasses, "-Djava.security.manager", "-Djava.security.policy==" + policyFile, "p.Main"); - assertTrue(exitValue == 0); + assertEquals(exitValue, 0); } /** @@ -138,7 +137,7 @@ public class SetDefaultProvider { public void testExplodedModule() throws Exception { String modulePath = System.getProperty("jdk.module.path"); int exitValue = exec(SET_DEFAULT_FSP, "-p", modulePath, "-m", "m/p.Main"); - assertTrue(exitValue == 0); + assertEquals(exitValue, 0); } /** @@ -148,7 +147,7 @@ public class SetDefaultProvider { public void testModularJar() throws Exception { String jarFile = createModularJar(); int exitValue = exec(SET_DEFAULT_FSP, "-p", jarFile, "-m", "m/p.Main"); - assertTrue(exitValue == 0); + assertEquals(exitValue, 0); } /** @@ -162,7 +161,7 @@ public class SetDefaultProvider { "--patch-module", "m=" + patchdir, "-p", modulePath, "-m", "m/p.Main"); - assertTrue(exitValue == 0); + assertEquals(exitValue, 0); } /** @@ -178,7 +177,7 @@ public class SetDefaultProvider { "--patch-module", "m=" + patch, "-p", modulePath, "-m", "m/p.Main"); - assertTrue(exitValue == 0); + assertEquals(exitValue, 0); } /** @@ -190,7 +189,7 @@ public class SetDefaultProvider { Path m = Paths.get(dir, "m"); if (Files.exists(m)) return m.toString(); } - assertFalse(true); + fail(); return null; } @@ -210,7 +209,7 @@ public class SetDefaultProvider { Path jar = createTempDirectory("tmp").resolve("m.jar"); String[] args = { "--create", "--file=" + jar, "-C", dir.toString(), "." }; int ret = JAR_TOOL.run(System.out, System.out, args); - assertTrue(ret == 0); + assertEquals(ret, 0); return jar; } diff --git a/test/jdk/java/security/misc/Versions.java b/test/jdk/java/security/misc/Versions.java index 6c14b2bc212ddbb096378ddbca77e5fc90314a45..ebfe9a13a88faf27295af114805cfca1cb026dd4 100644 --- a/test/jdk/java/security/misc/Versions.java +++ b/test/jdk/java/security/misc/Versions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +51,7 @@ public class Versions { "src/java.xml.crypto/share/legal/santuario.md", Pattern.compile("## Apache Santuario v(?\\S+)"), "java.xml.crypto/santuario.md"}, - {"make/data/publicsuffixlist/VERSION", + {"src/java.base/share/data/publicsuffixlist/VERSION", Pattern.compile("list/(?[0-9a-f]+)/public_suffix_list.dat"), "src/java.base/share/legal/public_suffix.md", Pattern.compile("list/(?[0-9a-f]+)/public_suffix_list.dat"), diff --git a/test/jdk/java/text/BreakIterator/Bug7104012.java b/test/jdk/java/text/BreakIterator/Bug7104012.java index ced84b9edb763e4574be409f147c4503db3608a5..8d5ac2969a3461379008f31e5330d440253311d5 100644 --- a/test/jdk/java/text/BreakIterator/Bug7104012.java +++ b/test/jdk/java/text/BreakIterator/Bug7104012.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,7 +71,7 @@ public class Bug7104012 { } if (err) { - throw new RuntimeException("Unexpected exeption."); + throw new RuntimeException("Unexpected exception."); } } diff --git a/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java b/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java index cd19fee1e35110f74ef9655c573c3a56fdae8384..30905ee46f16c1359995d610e3d37615dce35131 100644 --- a/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java +++ b/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ /* * @test + * @bug 8282625 * @library /java/text/testlib * @summary test International Decimal Format Symbols */ @@ -60,6 +61,14 @@ public class IntlTestDecimalFormatSymbols extends IntlTest // just do some VERY basic tests to make sure that get/set work + if (!fr.getLocale().equals(Locale.FRENCH)) { + errln("ERROR: French DecimalFormatSymbols not Locale.FRENCH"); + } + + if (!en.getLocale().equals(Locale.ENGLISH)) { + errln("ERROR: English DecimalFormatSymbols not Locale.ENGLISH"); + } + char zero = en.getZeroDigit(); fr.setZeroDigit(zero); if(fr.getZeroDigit() != en.getZeroDigit()) { diff --git a/test/jdk/java/time/test/java/time/AbstractTest.java b/test/jdk/java/time/test/java/time/AbstractTest.java index 97f1cf4b48606beb913a12f4a2dd8c703a9862d3..6e4734b8e4cb8fc949fcd22b48fae691857372a6 100644 --- a/test/jdk/java/time/test/java/time/AbstractTest.java +++ b/test/jdk/java/time/test/java/time/AbstractTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import static org.testng.Assert.assertTrue; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import java.util.Set; /** * Base test class. @@ -83,11 +84,15 @@ public abstract class AbstractTest { } protected static void assertImmutable(Class cls) { + assertImmutable(cls, Set.of()); + } + + protected static void assertImmutable(Class cls, Set ignoreFields) { assertTrue(Modifier.isPublic(cls.getModifiers())); assertTrue(Modifier.isFinal(cls.getModifiers())); Field[] fields = cls.getDeclaredFields(); for (Field field : fields) { - if (field.getName().contains("$") == false) { + if (!field.getName().contains("$") && !ignoreFields.contains(field.getName())) { if (Modifier.isStatic(field.getModifiers())) { assertTrue(Modifier.isFinal(field.getModifiers()), "Field:" + field.getName()); } else { diff --git a/test/jdk/java/time/test/java/time/TestLocalDate.java b/test/jdk/java/time/test/java/time/TestLocalDate.java index 91eb2a45d895c6c5f333a97e159267f639c23732..4b732b0619b629573c0d284007e60c258108f4e6 100644 --- a/test/jdk/java/time/test/java/time/TestLocalDate.java +++ b/test/jdk/java/time/test/java/time/TestLocalDate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,9 +63,12 @@ import static java.time.temporal.ChronoField.YEAR; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; +import java.time.DateTimeException; import java.time.LocalDate; import java.time.Month; +import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; import java.time.temporal.IsoFields; @@ -420,6 +423,37 @@ public class TestLocalDate extends AbstractTest { } } + @Test + public void test_ofEpochDay_edges() { + long minDay = ChronoField.EPOCH_DAY.range().getMinimum(); + long maxDay = ChronoField.EPOCH_DAY.range().getMaximum(); + long minYear = ChronoField.YEAR.range().getMinimum(); + long maxYear = ChronoField.YEAR.range().getMinimum(); + int[] offsets = new int[] { 0, 1, 2, 3, 28, 29, 30, 31, 32, 363, 364, 365, 366, 367 }; + for (int offset : offsets) { + LocalDate minDate = LocalDate.ofEpochDay(minDay + offset); + assertEquals(minDate, LocalDate.MIN.plusDays(offset)); + assertTrue(ChronoField.YEAR.range().isValidValue(minDate.getYear())); + + LocalDate maxDate = LocalDate.ofEpochDay(maxDay - offset); + assertEquals(maxDate, LocalDate.MAX.minusDays(offset)); + assertTrue(ChronoField.YEAR.range().isValidValue(maxDate.getYear())); + + try { + LocalDate.ofEpochDay(minDay - 1 - offset); + fail("Expected DateTimeException"); + } catch (DateTimeException e) { + // expected + } + try { + LocalDate.ofEpochDay(maxDay + 1 + offset); + fail("Expected DateTimeException"); + } catch (DateTimeException e) { + // expected + } + } + } + void doTest_comparisons_LocalDate(LocalDate... localDates) { for (int i = 0; i < localDates.length; i++) { LocalDate a = localDates[i]; diff --git a/test/jdk/java/time/test/java/time/TestZoneOffset.java b/test/jdk/java/time/test/java/time/TestZoneOffset.java index b6df12f1abf846ccf2d824b0148433eecd8c6319..a69eedfcd6c257e18d2e32be55d017d553cb0e7a 100644 --- a/test/jdk/java/time/test/java/time/TestZoneOffset.java +++ b/test/jdk/java/time/test/java/time/TestZoneOffset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,6 +61,7 @@ package test.java.time; import static org.testng.Assert.assertSame; +import java.util.Set; import java.time.ZoneOffset; import org.testng.annotations.Test; @@ -73,7 +74,7 @@ public class TestZoneOffset extends AbstractTest { @Test public void test_immutable() { - assertImmutable(ZoneOffset.class); + assertImmutable(ZoneOffset.class, /* ignore field */ Set.of("rules")); } @Test diff --git a/test/jdk/java/util/Currency/CurrencyTest.java b/test/jdk/java/util/Currency/CurrencyTest.java index ad7c596485bbd815eb4592db03ec6140ec65ad80..f82b032e2f818adee64f1f3db3e9ac83486b5c89 100644 --- a/test/jdk/java/util/Currency/CurrencyTest.java +++ b/test/jdk/java/util/Currency/CurrencyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +139,7 @@ public class CurrencyTest { /* * check currency changes - * In current implementation, there is no data of old currency and transition date at jdk/make/data/currency/CurrencyData.properties. + * In current implementation, there is no data of old currency and transition date at jdk/src/java.base/share/data/currency/CurrencyData.properties. * So, all the switch data arrays are empty. In the future, if data of old currency and transition date are necessary for any country, the * arrays here can be updated so that the program can check the currency switch. */ diff --git a/test/jdk/java/util/Currency/ValidateISO4217.java b/test/jdk/java/util/Currency/ValidateISO4217.java index 40bb55cfd1f9ff61f4130ed3bba89593123f393e..a0f09842ffe2cc3ca120fca5dc48406467e8c6c7 100644 --- a/test/jdk/java/util/Currency/ValidateISO4217.java +++ b/test/jdk/java/util/Currency/ValidateISO4217.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +24,7 @@ * @test * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759 * 8039317 8074350 8074351 8145952 8187946 8193552 8202026 8204269 - * 8208746 8209775 8264792 8274658 + * 8208746 8209775 8264792 8274658 8283277 * @summary Validate ISO 4217 data for Currency class. * @modules java.base/java.util:open * jdk.localedata @@ -101,7 +101,7 @@ public class ValidateISO4217 { static final String otherCodes = "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-" + "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-" - + "PTE-ROL-RUR-SDD-SIT-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-" + + "PTE-ROL-RUR-SDD-SIT-SLL-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-" + "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-" + "YUM-ZMK-ZWD-ZWN-ZWR"; diff --git a/test/jdk/java/util/Currency/tablea1.txt b/test/jdk/java/util/Currency/tablea1.txt index 7716863419fc454d186443de5aedc8e63e6ce6a7..62d71c8c94b6d2ba5ebe7cdbc7c843bbee30bd53 100644 --- a/test/jdk/java/util/Currency/tablea1.txt +++ b/test/jdk/java/util/Currency/tablea1.txt @@ -1,12 +1,12 @@ # # -# Amendments up until ISO 4217 AMENDMENT NUMBER 170 -# (As of 1 Oct 2021) +# Amendments up until ISO 4217 AMENDMENT NUMBER 171 +# (As of 16 Mar 2022) # # Version FILEVERSION=3 -DATAVERSION=170 +DATAVERSION=171 # ISO 4217 currency data AF AFN 971 2 @@ -218,7 +218,7 @@ RS RSD 941 2 CS CSD 891 2 #CS EUR 978 2 SC SCR 690 2 -SL SLL 694 2 +SL SLE 925 2 SG SGD 702 2 SK EUR 978 2 # MA 131 diff --git a/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java b/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java index e7374dff5cd2dacd23da144607f72b1665aa5112..ad02b3000e218c8f0f4b02e6bca2efc6610f32a4 100644 --- a/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java +++ b/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,113 +22,299 @@ * questions. */ +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.invoke.VarHandle; +import java.util.AbstractMap; +import java.util.AbstractSet; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ThreadLocalRandom; +import java.util.Set; +import java.util.WeakHashMap; +import java.util.function.Consumer; import java.util.function.Supplier; -import java.util.stream.IntStream; -import static java.util.stream.Collectors.toMap; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; /* * @test - * @bug 8210280 + * @bug 8210280 8281631 * @modules java.base/java.util:open - * @summary White box tests for HashMap internals around table resize + * @summary White box tests for HashMap-related internals around table sizing * @run testng WhiteBoxResizeTest - * @key randomness */ public class WhiteBoxResizeTest { - final ThreadLocalRandom rnd = ThreadLocalRandom.current(); + final MethodHandle TABLE_SIZE_FOR; - final VarHandle THRESHOLD; - final VarHandle TABLE; + final VarHandle HM_TABLE; + final VarHandle WHM_TABLE; public WhiteBoxResizeTest() throws ReflectiveOperationException { - Class mClass = HashMap.class; - String nodeClassName = mClass.getName() + "$Node"; - Class nodeArrayClass = Class.forName("[L" + nodeClassName + ";"); - MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(mClass, MethodHandles.lookup()); - TABLE = lookup.findVarHandle(mClass, "table", nodeArrayClass); - this.TABLE_SIZE_FOR = lookup.findStatic( - mClass, "tableSizeFor", - MethodType.methodType(int.class, int.class)); - this.THRESHOLD = lookup.findVarHandle(mClass, "threshold", int.class); + MethodHandles.Lookup hmlookup = MethodHandles.privateLookupIn(HashMap.class, MethodHandles.lookup()); + TABLE_SIZE_FOR = hmlookup.findStatic( + HashMap.class, "tableSizeFor", MethodType.methodType(int.class, int.class)); + HM_TABLE = hmlookup.unreflectVarHandle(HashMap.class.getDeclaredField("table")); + + MethodHandles.Lookup whmlookup = MethodHandles.privateLookupIn(WeakHashMap.class, MethodHandles.lookup()); + WHM_TABLE = whmlookup.unreflectVarHandle(WeakHashMap.class.getDeclaredField("table")); } + /* + * utility methods + */ + int tableSizeFor(int n) { try { return (int) TABLE_SIZE_FOR.invoke(n); - } catch (Throwable t) { throw new AssertionError(t); } + } catch (Throwable t) { + throw new AssertionError(t); + } } - Object[] table(HashMap map) { + Object[] table(Map map) { try { - return (Object[]) TABLE.get(map); - } catch (Throwable t) { throw new AssertionError(t); } + VarHandle vh = map instanceof WeakHashMap ? WHM_TABLE : HM_TABLE; + return (Object[]) vh.get(map); + } catch (Throwable t) { + throw new AssertionError(t); + } } - int capacity(HashMap map) { + int capacity(Map map) { return table(map).length; } - @Test - public void testTableSizeFor() { - assertEquals(tableSizeFor(0), 1); - assertEquals(tableSizeFor(1), 1); - assertEquals(tableSizeFor(2), 2); - assertEquals(tableSizeFor(3), 4); - assertEquals(tableSizeFor(15), 16); - assertEquals(tableSizeFor(16), 16); - assertEquals(tableSizeFor(17), 32); - int maxSize = 1 << 30; - assertEquals(tableSizeFor(maxSize - 1), maxSize); - assertEquals(tableSizeFor(maxSize), maxSize); - assertEquals(tableSizeFor(maxSize + 1), maxSize); - assertEquals(tableSizeFor(Integer.MAX_VALUE), maxSize); + // creates a map with size mappings + Map makeMap(int size) { + Map map = new HashMap<>(); + putN(map, size); + return map; + } + + // creates a "fake" map: size() returns the given size, but + // the entrySet iterator returns only one entry + Map fakeMap(int size) { + return new AbstractMap<>() { + public Set> entrySet() { + return new AbstractSet>() { + public int size() { + return size; + } + + public Iterator> iterator() { + return Set.of(Map.entry("1", "1")).iterator(); + } + }; + } + }; + } + + void putN(Map map, int n) { + for (int i = 0; i < n; i++) { + String string = Integer.toString(i); + map.put(string, string); + } + } + + /* + * tests of tableSizeFor + */ + + @DataProvider(name = "tableSizeFor") + public Object[][] tableSizeForCases() { + final int MAX = 1 << 30; + return new Object[][] { + // tableSizeFor(arg), expected + { 0, 1 }, + { 1, 1 }, + { 2, 2 }, + { 3, 4 }, + { 4, 4 }, + { 5, 8 }, + { 15, 16 }, + { 16, 16 }, + { 17, 32 }, + { MAX-1, MAX }, + { MAX, MAX }, + { MAX+1, MAX }, + { Integer.MAX_VALUE, MAX } + }; + } + + @Test(dataProvider = "tableSizeFor") + public void tableSizeFor(int arg, int expected) { + assertEquals(tableSizeFor(arg), expected); } - @Test - public void capacityTestDefaultConstructor() { - capacityTestDefaultConstructor(new HashMap<>()); - capacityTestDefaultConstructor(new LinkedHashMap<>()); + /* + * tests for lazy table allocation + */ + + @DataProvider(name = "lazy") + public Object[][] lazyTableAllocationCases() { + return new Object[][]{ + {new HashMap<>()}, + // { new WeakHashMap<>() }, // WHM doesn't allocate lazily + {new LinkedHashMap<>()} + }; } - void capacityTestDefaultConstructor(HashMap map) { + @Test(dataProvider = "lazy") + public void lazyTableAllocation(Map map) { assertNull(table(map)); + } - map.put(1, 1); - assertEquals(capacity(map), 16); // default initial capacity + /* + * tests for default capacity (no-arg constructor) + */ - map.putAll(IntStream.range(0, 64).boxed().collect(toMap(i -> i, i -> i))); - assertEquals(capacity(map), 128); + @DataProvider(name = "defaultCapacity") + public Object[][] defaultCapacityCases() { + return new Supplier[][]{ + {() -> new HashMap<>()}, + {() -> new LinkedHashMap<>()}, + {() -> new WeakHashMap<>()} + }; } - @Test - public void capacityTestInitialCapacity() { - int initialCapacity = rnd.nextInt(2, 128); - List>> suppliers = List.of( - () -> new HashMap<>(initialCapacity), - () -> new HashMap<>(initialCapacity, 0.75f), - () -> new LinkedHashMap<>(initialCapacity), - () -> new LinkedHashMap<>(initialCapacity, 0.75f)); + @Test(dataProvider = "defaultCapacity") + public void defaultCapacity(Supplier> s) { + Map map = s.get(); + map.put("", ""); + assertEquals(capacity(map), 16); + } - for (Supplier> supplier : suppliers) { - HashMap map = supplier.get(); - assertNull(table(map)); + /* + * tests for requested capacity (int and int+float constructors) + */ - map.put(1, 1); - assertEquals(capacity(map), tableSizeFor(initialCapacity)); + @DataProvider(name = "requestedCapacity") + public Iterator requestedCapacityCases() { + ArrayList cases = new ArrayList<>(); + for (int i = 2; i < 128; i++) { + int cap = i; + cases.add(new Object[]{"rhm1", cap, (Supplier>) () -> new HashMap<>(cap)}); + cases.add(new Object[]{"rhm2", cap, (Supplier>) () -> new HashMap<>(cap, 0.75f)}); + cases.add(new Object[]{"rlm1", cap, (Supplier>) () -> new LinkedHashMap<>(cap)}); + cases.add(new Object[]{"rlm2", cap, (Supplier>) () -> new LinkedHashMap<>(cap, 0.75f)}); + cases.add(new Object[]{"rwm1", cap, (Supplier>) () -> new WeakHashMap<>(cap)}); + cases.add(new Object[]{"rwm2", cap, (Supplier>) () -> new WeakHashMap<>(cap, 0.75f)}); } + return cases.iterator(); + } + + @Test(dataProvider = "requestedCapacity") + public void requestedCapacity(String label, int cap, Supplier> s) { + Map map = s.get(); + map.put("", ""); + assertEquals(capacity(map), tableSizeFor(cap)); + } + + /* + * Tests for capacity after map is populated with a given number N of mappings. + * Maps are populated using a copy constructor on a map with N mappings, + * other constructors followed by N put() calls, and other constructors followed + * by putAll() on a map with N mappings. + * + * String labels encode the test case for ease of diagnosis if one of the test cases fails. + * For example, "plm2pn" is "populated LinkedHashMap, 2-arg constructor, followed by putN". + */ + + // helper method for one populated capacity case, to provide target types for lambdas + Object[] pcc(String label, + int size, + int expectedCapacity, + Supplier> supplier, + Consumer> consumer) { + return new Object[]{label, size, expectedCapacity, supplier, consumer}; + } + + List genPopulatedCapacityCases(int size, int cap) { + return Arrays.asList( + pcc("phmcpy", size, cap, () -> new HashMap<>(makeMap(size)), map -> { }), + pcc("phm0pn", size, cap, () -> new HashMap<>(), map -> { putN(map, size); }), + pcc("phm1pn", size, cap, () -> new HashMap<>(cap), map -> { putN(map, size); }), + pcc("phm2pn", size, cap, () -> new HashMap<>(cap, 0.75f), map -> { putN(map, size); }), + pcc("phm0pa", size, cap, () -> new HashMap<>(), map -> { map.putAll(makeMap(size)); }), + pcc("phm1pa", size, cap, () -> new HashMap<>(cap), map -> { map.putAll(makeMap(size)); }), + pcc("phm2pa", size, cap, () -> new HashMap<>(cap, 0.75f), map -> { map.putAll(makeMap(size)); }), + + pcc("plmcpy", size, cap, () -> new LinkedHashMap<>(makeMap(size)), map -> { }), + pcc("plm0pn", size, cap, () -> new LinkedHashMap<>(), map -> { putN(map, size); }), + pcc("plm1pn", size, cap, () -> new LinkedHashMap<>(cap), map -> { putN(map, size); }), + pcc("plm2pn", size, cap, () -> new LinkedHashMap<>(cap, 0.75f), map -> { putN(map, size); }), + pcc("plm0pa", size, cap, () -> new LinkedHashMap<>(), map -> { map.putAll(makeMap(size)); }), + pcc("plm1pa", size, cap, () -> new LinkedHashMap<>(cap), map -> { map.putAll(makeMap(size)); }), + pcc("plm2pa", size, cap, () -> new LinkedHashMap<>(cap, 0.75f), map -> { map.putAll(makeMap(size)); }), + + pcc("pwmcpy", size, cap, () -> new WeakHashMap<>(makeMap(size)), map -> { }), + pcc("pwm0pn", size, cap, () -> new WeakHashMap<>(), map -> { putN(map, size); }), + pcc("pwm1pn", size, cap, () -> new WeakHashMap<>(cap), map -> { putN(map, size); }), + pcc("pwm2pn", size, cap, () -> new WeakHashMap<>(cap, 0.75f), map -> { putN(map, size); }), + pcc("pwm0pa", size, cap, () -> new WeakHashMap<>(), map -> { map.putAll(makeMap(size)); }), + pcc("pwm1pa", size, cap, () -> new WeakHashMap<>(cap), map -> { map.putAll(makeMap(size)); }), + pcc("pwm2pa", size, cap, () -> new WeakHashMap<>(cap, 0.75f), map -> { map.putAll(makeMap(size)); }) + ); + } + + List genFakePopulatedCapacityCases(int size, int cap) { + return Arrays.asList( + pcc("fhmcpy", size, cap, () -> new HashMap<>(fakeMap(size)), map -> { }), + pcc("fhm0pa", size, cap, () -> new HashMap<>(), map -> { map.putAll(fakeMap(size)); }), + pcc("fhm1pa", size, cap, () -> new HashMap<>(cap), map -> { map.putAll(fakeMap(size)); }), + pcc("fhm2pa", size, cap, () -> new HashMap<>(cap, 0.75f), map -> { map.putAll(fakeMap(size)); }), + + pcc("flmcpy", size, cap, () -> new LinkedHashMap<>(fakeMap(size)), map -> { }), + pcc("flm0pa", size, cap, () -> new LinkedHashMap<>(), map -> { map.putAll(fakeMap(size)); }), + pcc("flm1pa", size, cap, () -> new LinkedHashMap<>(cap), map -> { map.putAll(fakeMap(size)); }), + pcc("flm2pa", size, cap, () -> new LinkedHashMap<>(cap, 0.75f), map -> { map.putAll(fakeMap(size)); }), + + pcc("fwmcpy", size, cap, () -> new WeakHashMap<>(fakeMap(size)), map -> { }), + // pcc("fwm0pa", size, cap, () -> new WeakHashMap<>(), map -> { map.putAll(fakeMap(size)); }), // see note + pcc("fwm1pa", size, cap, () -> new WeakHashMap<>(cap), map -> { map.putAll(fakeMap(size)); }), + pcc("fwm2pa", size, cap, () -> new WeakHashMap<>(cap, 0.75f), map -> { map.putAll(fakeMap(size)); }) + ); + + // Test case "fwm0pa" is commented out because WeakHashMap uses a different allocation + // policy from the other map implementations: it deliberately under-allocates in this case. + } + + @DataProvider(name = "populatedCapacity") + public Iterator populatedCapacityCases() { + ArrayList cases = new ArrayList<>(); + cases.addAll(genPopulatedCapacityCases(11, 16)); + cases.addAll(genPopulatedCapacityCases(12, 16)); + cases.addAll(genPopulatedCapacityCases(13, 32)); + cases.addAll(genPopulatedCapacityCases(64, 128)); + + // numbers in this range are truncated by a float computation with 0.75f + // but can get an exact result with a double computation with 0.75d + cases.addAll(genFakePopulatedCapacityCases(25165824, 33554432)); + cases.addAll(genFakePopulatedCapacityCases(25165825, 67108864)); + cases.addAll(genFakePopulatedCapacityCases(25165826, 67108864)); + + return cases.iterator(); } + + @Test(dataProvider = "populatedCapacity") + public void populatedCapacity(String label, // unused, included for diagnostics + int size, // unused, included for diagnostics + int expectedCapacity, + Supplier> s, + Consumer> c) { + Map map = s.get(); + c.accept(map); + assertEquals(capacity(map), expectedCapacity); + } + } diff --git a/test/jdk/java/util/Locale/LSRDataTest.java b/test/jdk/java/util/Locale/LSRDataTest.java index 81edf48b9b0466cc84512c53c8deda24b7123fa6..f32642981b5230d0d411cd72637e85398c7019d7 100644 --- a/test/jdk/java/util/Locale/LSRDataTest.java +++ b/test/jdk/java/util/Locale/LSRDataTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. * 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,11 +52,11 @@ public class LSRDataTest { private static final Map> multiLangEquivsMap = new HashMap<>(); private static final Map regionVariantEquivMap = new HashMap<>(); - // path to the lsr file from the make folder, this test relies on the - // relative path to the file in the make folder, considering - // test and make will always exist in the same jdk layout + // path to the lsr file from the data folder, this test relies on the + // relative path to the file in the data folder, considering + // test and src/.../data will always exist in the same jdk layout private static final String LSR_FILE_PATH = System.getProperty("test.src", ".") - + "/../../../../../make/data/lsrdata/language-subtag-registry.txt"; + + "/../../../../../src/java.base/share/data/lsrdata/language-subtag-registry.txt"; public static void main(String[] args) throws IOException { diff --git a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java index 922b18836dd877a36090f4cc0a601c2bec6b4a1b..c078acbaff852ac981ac235654901a288bbd0df2 100644 --- a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java +++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java @@ -48,7 +48,7 @@ /* * @test * @summary Exercise multithreaded maps, using only heavy monitors. - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64" * @library /test/lib * @run main/othervm/timeout=1600 -XX:+IgnoreUnrecognizedVMOptions -XX:+UseHeavyMonitors -XX:+VerifyHeavyMonitors MapLoops */ diff --git a/test/jdk/java/util/prefs/AddNodeChangeListener.java b/test/jdk/java/util/prefs/AddNodeChangeListener.java index d63ffed36b7faf3b34f53db3dcc3b48c50b607dc..11a771f93e3495fe1e25d3b0776c5df1201a79a0 100644 --- a/test/jdk/java/util/prefs/AddNodeChangeListener.java +++ b/test/jdk/java/util/prefs/AddNodeChangeListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * 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,75 +34,88 @@ import java.util.prefs.*; public class AddNodeChangeListener { private static final int SLEEP_ITRS = 10; + private static final String N2_STR = "N2"; private static boolean failed = false; private static Preferences userRoot, N2; private static NodeChangeListenerAdd ncla; public static void main(String[] args) throws BackingStoreException, InterruptedException { - userRoot = Preferences.userRoot(); - ncla = new NodeChangeListenerAdd(); - userRoot.addNodeChangeListener(ncla); - //Should initiate a node added event - addNode(); - // Should not initiate a node added event - addNode(); - //Should initate a child removed event - removeNode(); - - if (failed) { - throw new RuntimeException("Failed"); + try { + userRoot = Preferences.userRoot(); + // Make sure test node is not present before test + clearPrefs(); + + ncla = new NodeChangeListenerAdd(); + userRoot.addNodeChangeListener(ncla); + //Should initiate a node added event + addNode(); + // Should not initiate a node added event + addNode(); + //Should initate a child removed event + removeNode(); + + if (failed) { + throw new RuntimeException("Failed"); + } + } finally { + // Make sure test node is not present after the test + clearPrefs(); } } private static void addNode() throws BackingStoreException, InterruptedException { - N2 = userRoot.node("N2"); + N2 = userRoot.node(N2_STR); userRoot.flush(); - int passItr = -1; - - for (int i = 0; i < SLEEP_ITRS; i++) { - System.out.print("addNode sleep iteration " + i + "..."); - Thread.sleep(3000); - System.out.println("done."); - if (ncla.getAddNumber() == 1) { - passItr = i; - break; - } - } - checkPassItr(passItr, "addNode()"); + checkAndSleep(1, "addNode"); } private static void removeNode() throws BackingStoreException, InterruptedException { N2.removeNode(); userRoot.flush(); - int passItr = -1; + checkAndSleep(0, "removeNode"); + } + /* Check for the expected value in the listener (1 after addNode(), 0 after removeNode()). + * Sleep a few extra times in a loop, if needed, for debugging purposes, to + * see if the event gets delivered late. + */ + private static void checkAndSleep(int expectedListenerVal, String methodName) throws InterruptedException { + int expectedItr = -1; // iteration in which the expected value was retrieved from the listener, or -1 if never for (int i = 0; i < SLEEP_ITRS; i++) { - System.out.print("removeNode sleep iteration " + i + "..."); + System.out.print(methodName + " sleep iteration " + i + "..."); Thread.sleep(3000); System.out.println("done."); - if (ncla.getAddNumber() == 0) { - passItr = i; + if (ncla.getAddNumber() == expectedListenerVal) { + expectedItr = i; break; } } - checkPassItr(passItr, "removeNode()"); - } - /* If the listener wasn't notified on iteration 0, throw a RuntimeException - * with some contextual information - */ - private static void checkPassItr(int itr, String methodName) { - if (itr == 0) { + if (expectedItr == 0) { System.out.println(methodName + " test passed"); } else { failed = true; - if (itr == -1) { - throw new RuntimeException("Failed in " + methodName + " - change listener never notified"); + if (expectedItr == -1) { + System.out.println("Failed in " + methodName + " - change listener never notified"); } else { - throw new RuntimeException("Failed in " + methodName + " - listener notified on iteration " + itr); + System.out.println("Failed in " + methodName + " - listener notified on iteration " + expectedItr); + } + } + } + + /* Check if the node already exists in userRoot, and remove it if so. */ + private static void clearPrefs() throws BackingStoreException { + if (userRoot.nodeExists(N2_STR)) { + System.out.println("Node " + N2_STR + " already/still exists; clearing"); + Preferences clearNode = userRoot.node(N2_STR); + userRoot.flush(); + clearNode.removeNode(); + userRoot.flush(); + if (userRoot.nodeExists(N2_STR)) { + throw new RuntimeException("Unable to clear pre-existing node." + (failed ? " Also, the test failed" : "")); } } } diff --git a/test/jdk/java/util/regex/RegExTest.java b/test/jdk/java/util/regex/RegExTest.java index 39c454ce4f446f2468f3dad079a2414a12749d16..41db0915d178bc6c03c9bc3ad2716760f30f33e8 100644 --- a/test/jdk/java/util/regex/RegExTest.java +++ b/test/jdk/java/util/regex/RegExTest.java @@ -36,7 +36,7 @@ * 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706 * 8194667 8197462 8184692 8221431 8224789 8228352 8230829 8236034 8235812 * 8216332 8214245 8237599 8241055 8247546 8258259 8037397 8269753 8276694 - * + * 8280403 8264160 8281315 * @library /test/lib * @library /lib/testlibrary/java/lang * @build jdk.test.lib.RandomFactory @@ -51,14 +51,9 @@ import java.nio.CharBuffer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Scanner; +import java.util.*; import java.util.function.Function; +import java.util.function.IntFunction; import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.MatchResult; @@ -3854,11 +3849,11 @@ public class RegExTest { } // bounds/word align - twoFindIndexes(" \u0180sherman\u0400 ", bound, 1, 10); + twoFindIndexes(" \u0180sherman\u0400 ", boundU, 1, 10); assertTrue(bwbU.reset("\u0180sherman\u0400").matches()); - twoFindIndexes(" \u0180sh\u0345erman\u0400 ", bound, 1, 11); + twoFindIndexes(" \u0180sh\u0345erman\u0400 ", boundU, 1, 11); assertTrue(bwbU.reset("\u0180sh\u0345erman\u0400").matches()); - twoFindIndexes(" \u0724\u0739\u0724 ", bound, 1, 4); + twoFindIndexes(" \u0724\u0739\u0724 ", boundU, 1, 4); assertTrue(bwbU.reset("\u0724\u0739\u0724").matches()); assertTrue(bwbEU.reset("\u0724\u0739\u0724").matches()); } @@ -4503,6 +4498,8 @@ public class RegExTest { } //This test is for 8037397 + //Ensure we don't drop nested interior character classes to the right of an + //intersection operator. @Test public static void droppedClassesWithIntersection() { String rx = "[A-Z&&[A-Z]0-9]"; @@ -4530,6 +4527,9 @@ public class RegExTest { } //This test is for 8269753 + //This is for ensuring that the caret doesn't point at the wrong character + //in a syntax exception message because we previously didn't compensate for + //tabs when rendering the offending string that contained tab characters. @Test public static void errorMessageCaretIndentation() { String pattern = "\t**"; @@ -4540,6 +4540,8 @@ public class RegExTest { } //This test is for 8276694 + //Ensure our error message indicates we have an unescaped backslash when we + //encounter one. @Test public static void unescapedBackslash() { String pattern = "\\"; @@ -4549,6 +4551,7 @@ public class RegExTest { } //This test is for 8280403 + //Given bad intersection syntax, we should throw a PatternSyntaxException. @Test public static void badIntersectionSyntax() { String pattern = "[˜\\H +F&&]"; @@ -4557,7 +4560,70 @@ public class RegExTest { assertTrue(e.getMessage().contains("Bad intersection syntax")); } + //This test is for 8264160 + //Here we check for inconsistencies between the behavior of \w and the + //behavior of \b. Prior to this fix, the two flags did not behave in a + //consistent way ie \b would recognize non-\w characters as part of a word + //in some cases. This test verifies that the two behave consistently + //for all codepoints we support. + @Test + public static void wordBoundaryInconsistencies() { + Pattern basicWordCharPattern = Pattern.compile("\\w"); + Pattern basicWordCharBoundaryPattern = + Pattern.compile(";\\b.", Pattern.DOTALL); + + Pattern unicodeWordCharPattern = + Pattern.compile("\\w", Pattern.UNICODE_CHARACTER_CLASS); + + Pattern unicodeWordCharBoundaryPattern = + Pattern.compile(";\\b.", + Pattern.DOTALL | Pattern.UNICODE_CHARACTER_CLASS); + + IntFunction basicWordCharCheck = + (cp) -> cpMatches(basicWordCharPattern, cp, false); + + IntFunction basicBoundaryCharCheck = + (cp) -> cpMatches(basicWordCharBoundaryPattern, + cp, true); + + IntFunction unicodeWordCharCheck = + (cp) -> cpMatches(unicodeWordCharPattern, cp, false); + + IntFunction unicodeBoundaryCharCheck = + (cp) -> cpMatches(unicodeWordCharBoundaryPattern, + cp,true); + + //basic pattern comparison + for(int cp = 0; cp <= Character.MAX_CODE_POINT; cp++){ + assertEquals(basicWordCharCheck.apply(cp), + basicBoundaryCharCheck.apply(cp), + "Codepoint: " + cp); + assertEquals(unicodeWordCharCheck.apply(cp), + unicodeBoundaryCharCheck.apply(cp), + "Codepoint: " + cp); + } + } + + private static boolean cpMatches(Pattern p, int cp, boolean boundary) { + String cpString; + if (Character.isBmpCodePoint(cp)) { + cpString = "" + ((char) cp); + } else { + cpString = "" + Character.highSurrogate(cp) + + Character.lowSurrogate(cp); + } + + if (boundary) { + return p.matcher(";" + cpString).matches(); + } else { + return p.matcher(cpString).matches(); + } + } + //This test is for 8281560 + //Checks that when the Canonical Equivalence flag is set, the behavior for + //Matcher::hitEnd is equivalent for these similar, patterns that saw + //inconsistencies. @Test public static void prematureHitEndInNFCCharProperty() { var testInput = "a1a1"; @@ -4582,6 +4648,8 @@ public class RegExTest { } //This test is for 8281315 + //Checks that we are able to correctly match this case with a backref + //without encountering an IndexOutOfBoundsException. @Test public static void iOOBForCIBackrefs(){ String line = "\ud83d\udc95\ud83d\udc95\ud83d\udc95"; diff --git a/test/jdk/java/util/zip/CloseDeflaterTest.java b/test/jdk/java/util/zip/CloseDeflaterTest.java deleted file mode 100644 index 8aa4960f543628edc887c61a10a897373f38657f..0000000000000000000000000000000000000000 --- a/test/jdk/java/util/zip/CloseDeflaterTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. - * 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 8193682 - * @summary Test Infinite loop while writing on closed GZipOutputStream , ZipOutputStream and JarOutputStream. - * @run testng CloseDeflaterTest - */ -import java.io.*; -import java.util.Random; -import java.util.jar.JarOutputStream; -import java.util.zip.GZIPOutputStream; -import java.util.zip.ZipOutputStream; -import java.util.zip.ZipEntry; - -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.fail; - - -public class CloseDeflaterTest { - - //number of bytes to write - private static final int INPUT_LENGTH= 512; - //OutputStream that will throw an exception during a write operation - private static OutputStream outStream = new OutputStream() { - @Override - public void write(byte[] b, int off, int len) throws IOException { - //throw exception during write - throw new IOException(); - } - @Override - public void write(byte b[]) throws IOException {} - @Override - public void write(int b) throws IOException {} - }; - private static byte[] inputBytes = new byte[INPUT_LENGTH]; - private static Random rand = new Random(); - - @DataProvider(name = "testgzipinput") - public Object[][] testGZipInput() { - //testGZip will close the GZipOutputStream using close() method when the boolean - //useCloseMethod is set to true and finish() method if the value is set to false - return new Object[][] { - { GZIPOutputStream.class, true }, - { GZIPOutputStream.class, false }, - }; - } - - @DataProvider(name = "testzipjarinput") - public Object[][] testZipAndJarInput() { - //testZipAndJarInput will perfrom write/closeEntry operations on JarOutputStream when the boolean - //useJar is set to true and on ZipOutputStream if the value is set to false - return new Object[][] { - { JarOutputStream.class, true }, - { ZipOutputStream.class, false }, - }; - } - - @BeforeTest - public void before_test() - { - //add inputBytes array with random bytes to write into Zip - rand.nextBytes(inputBytes); - } - - //Test for infinite loop by writing bytes to closed GZIPOutputStream - @Test(dataProvider = "testgzipinput") - public void testGZip(Class type, boolean useCloseMethod) throws IOException { - GZIPOutputStream zip = new GZIPOutputStream(outStream); - try { - zip.write(inputBytes, 0, INPUT_LENGTH); - //close zip - if(useCloseMethod) { - zip.close(); - } else { - zip.finish(); - } - } catch (IOException e) { - //expected - } - for (int i = 0; i < 3; i++) { - try { - //write on a closed GZIPOutputStream - zip.write(inputBytes, 0, INPUT_LENGTH); - fail("Deflater closed exception not thrown"); - } catch (NullPointerException e) { - //expected , Deflater has been closed exception - } - } - } - - //Test for infinite loop by writing bytes to closed ZipOutputStream/JarOutputStream - @Test(dataProvider = "testzipjarinput") - public void testZipCloseEntry(Class type,boolean useJar) throws IOException { - ZipOutputStream zip = null; - if(useJar) { - zip = new JarOutputStream(outStream); - } else { - zip = new ZipOutputStream(outStream); - } - try { - zip.putNextEntry(new ZipEntry("")); - } catch (IOException e) { - //expected to throw IOException since putNextEntry calls write method - } - try { - zip.write(inputBytes, 0, INPUT_LENGTH); - //close zip entry - zip.closeEntry(); - } catch (IOException e) { - //expected - } - for (int i = 0; i < 3; i++) { - try { - //write on a closed ZipOutputStream - zip.write(inputBytes, 0, INPUT_LENGTH); - fail("Deflater closed exception not thrown"); - } catch (NullPointerException e) { - //expected , Deflater has been closed exception - } - } - } - -} diff --git a/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java b/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4f0fafc8dbeddab48f98ab5618ab46dd513106b3 --- /dev/null +++ b/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8193682 8278794 + * @summary Test Infinite loop while writing on closed Deflater and Inflater. + * @run testng CloseInflaterDeflaterTest + */ +import java.io.*; +import java.util.Random; +import java.util.jar.JarOutputStream; +import java.util.zip.DeflaterInputStream; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.GZIPOutputStream; +import java.util.zip.InflaterOutputStream; +import java.util.zip.ZipOutputStream; +import java.util.zip.ZipEntry; + +import org.testng.annotations.BeforeTest; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import static org.testng.Assert.assertThrows; + + +public class CloseInflaterDeflaterTest { + + // Number of bytes to write/read from Deflater/Inflater + private static final int INPUT_LENGTH= 512; + // OutputStream that will throw an exception during a write operation + private static OutputStream outStream = new OutputStream() { + @Override + public void write(byte[] b, int off, int len) throws IOException { + throw new IOException(); + } + @Override + public void write(byte[] b) throws IOException {} + @Override + public void write(int b) throws IOException {} + }; + // InputStream that will throw an exception during a read operation + private static InputStream inStream = new InputStream() { + @Override + public int read(byte[] b, int off, int len) throws IOException { + throw new IOException(); + } + @Override + public int read(byte[] b) throws IOException { throw new IOException();} + @Override + public int read() throws IOException { throw new IOException();} + }; + // Input bytes for read/write operation + private static byte[] inputBytes = new byte[INPUT_LENGTH]; + // Random function to add bytes to inputBytes + private static Random rand = new Random(); + + /** + * DataProvider to specify whether to use close() or finish() of OutputStream + * + * @return Entry object indicating which method to use for closing OutputStream + */ + @DataProvider + public Object[][] testOutputStreams() { + return new Object[][] { + { true }, + { false }, + }; + } + + /** + * DataProvider to specify on which outputstream closeEntry() has to be called + * + * @return Entry object returning either JarOutputStream or ZipOutputStream + */ + @DataProvider + public Object[][] testZipAndJar() throws IOException{ + return new Object[][] { + { new JarOutputStream(outStream)}, + { new ZipOutputStream(outStream)}, + }; + } + + /** + * Add inputBytes array with random bytes to write into OutputStream + */ + @BeforeTest + public void before_test() + { + rand.nextBytes(inputBytes); + } + + /** + * Test for infinite loop by writing bytes to closed GZIPOutputStream + * + * @param useCloseMethod indicates whether to use Close() or finish() method + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testOutputStreams") + public void testGZip(boolean useCloseMethod) throws IOException { + GZIPOutputStream gzip = new GZIPOutputStream(outStream); + gzip.write(inputBytes, 0, INPUT_LENGTH); + assertThrows(IOException.class, () -> { + // Close GZIPOutputStream + if (useCloseMethod) { + gzip.close(); + } else { + gzip.finish(); + } + }); + // Write on a closed GZIPOutputStream, closed Deflater IOException expected + assertThrows(NullPointerException.class , () -> gzip.write(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by writing bytes to closed DeflaterOutputStream + * + * @param useCloseMethod indicates whether to use Close() or finish() method + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testOutputStreams") + public void testDeflaterOutputStream(boolean useCloseMethod) throws IOException { + DeflaterOutputStream def = new DeflaterOutputStream(outStream); + assertThrows(IOException.class , () -> def.write(inputBytes, 0, INPUT_LENGTH)); + assertThrows(IOException.class, () -> { + // Close DeflaterOutputStream + if (useCloseMethod) { + def.close(); + } else { + def.finish(); + } + }); + // Write on a closed DeflaterOutputStream, 'Deflater has been closed' NPE is expected + assertThrows(NullPointerException.class , () -> def.write(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by reading bytes from closed DeflaterInputStream + * + * @throws IOException if an error occurs + */ + @Test + public void testDeflaterInputStream() throws IOException { + DeflaterInputStream def = new DeflaterInputStream(inStream); + assertThrows(IOException.class , () -> def.read(inputBytes, 0, INPUT_LENGTH)); + // Close DeflaterInputStream + def.close(); + // Read from a closed DeflaterInputStream, closed Deflater IOException expected + assertThrows(IOException.class , () -> def.read(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by writing bytes to closed InflaterOutputStream + * + * @param useCloseMethod indicates whether to use Close() or finish() method + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testOutputStreams") + public void testInflaterOutputStream(boolean useCloseMethod) throws IOException { + InflaterOutputStream inf = new InflaterOutputStream(outStream); + assertThrows(IOException.class , () -> inf.write(inputBytes, 0, INPUT_LENGTH)); + assertThrows(IOException.class , () -> { + // Close InflaterOutputStream + if (useCloseMethod) { + inf.close(); + } else { + inf.finish(); + } + }); + // Write on a closed InflaterOutputStream , closed Inflater IOException expected + assertThrows(IOException.class , () -> inf.write(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by writing bytes to closed ZipOutputStream/JarOutputStream + * + * @param zip will be the instance of either JarOutputStream or ZipOutputStream + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testZipAndJar") + public void testZipCloseEntry(ZipOutputStream zip) throws IOException { + assertThrows(IOException.class , () -> zip.putNextEntry(new ZipEntry(""))); + zip.write(inputBytes, 0, INPUT_LENGTH); + assertThrows(IOException.class , () -> zip.closeEntry()); + // Write on a closed ZipOutputStream , 'Deflater has been closed' NPE is expected + assertThrows(NullPointerException.class , () -> zip.write(inputBytes, 0, INPUT_LENGTH)); + } + +} diff --git a/test/jdk/javax/accessibility/4715503/AccessibleJTableCellBoundingRectangleTest.java b/test/jdk/javax/accessibility/4715503/AccessibleJTableCellBoundingRectangleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..716925a51e66dd79abde28407048032746beffdc --- /dev/null +++ b/test/jdk/javax/accessibility/4715503/AccessibleJTableCellBoundingRectangleTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 + * @key headful + * @bug 4715503 + * @summary AccessibleTable cannot get the Bounding Rectangle of Table Header Cells. + * @run main AccessibleJTableCellBoundingRectangleTest + */ + +import java.awt.Rectangle; +import java.awt.Robot; + +import javax.swing.JFrame; +import javax.swing.JTable; +import javax.swing.SwingUtilities; + +public class AccessibleJTableCellBoundingRectangleTest { + private static JTable jTable; + private static JFrame jFrame; + + private static Object[][] rowData = { { "01", "02", "03", "04", "05" }, + { "11", "12", "13", "14", "15" }, { "21", "22", "23", "24", "25" }, + { "31", "32", "33", "34", "35" }, { "41", "42", "43", "44", "45" } }; + + private static Object[] colNames = { "1", "2", "3", "4", "5" }; + + private static void doTest() throws Exception { + try { + SwingUtilities.invokeAndWait(() -> createGUI()); + Robot robot = new Robot(); + robot.setAutoDelay(500); + robot.waitForIdle(); + + for (int i = 0; i <= colNames.length - 1; i++) { + try { + Rectangle bounds = + jTable.getTableHeader().getAccessibleContext().getAccessibleChild(i) + .getAccessibleContext().getAccessibleComponent().getBounds(); + + if (bounds != null) { + System.out.println("Column " + i + " Bounds: " + bounds); + } else { + throw new RuntimeException( + "Bounding Rectangles getting bounding rectangle for table header cells is null"); + } + } catch (Exception e) { + throw new RuntimeException("Bounding Rectangles getting bounding rectangle for " + + "table header cells threw an exception:\n" + e); + } + } + } finally { + SwingUtilities.invokeAndWait(() -> jFrame.dispose()); + } + } + + private static void createGUI() { + jTable = new JTable(rowData, colNames); + jFrame = new JFrame(); + jFrame.setBounds(100, 100, 300, 300); + jFrame.getContentPane().add(jTable); + jFrame.setVisible(true); + } + + public static void main(String args[]) throws Exception { + doTest(); + System.out.println("Test Passed"); + } +} + diff --git a/test/jdk/javax/accessibility/8283015/AccessibleJTableCellNameTest.java b/test/jdk/javax/accessibility/8283015/AccessibleJTableCellNameTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3c2cc14b8f7665a7929169c39e0aa419d6f77c45 --- /dev/null +++ b/test/jdk/javax/accessibility/8283015/AccessibleJTableCellNameTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 + * @key headful + * @bug 4715496 + * @summary AccessibleJTableCell.getAccessible name incorrectly returns + * cell instance string instead of cell text. + * @run main AccessibleJTableCellNameTest + */ + +import java.awt.Robot; + +import javax.accessibility.Accessible; +import javax.swing.JFrame; +import javax.swing.JTable; +import javax.swing.SwingUtilities; + +public class AccessibleJTableCellNameTest { + private static JTable jTable; + private static JFrame jFrame; + private static volatile Accessible accessible; + + private static Object[][] rowData = { + { "01", "02", "03", "04", "05" }, + { "11", "12", "13", "14", "15" }, + { "21", "22", "23", "24", "25" }, + { "31", "32", "33", "34", "35" }, + { "41", "42", "43", "44", "45" } }; + + private static Object[] colNames = { "1", "2", "3", "4", "5" }; + + private static void doTest() throws Exception { + try { + SwingUtilities.invokeAndWait(() -> createGUI()); + Robot robot = new Robot(); + robot.setAutoDelay(500); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + for (int i = 0; i <= colNames.length - 1; i++) { + Accessible accessible = jTable.getAccessibleContext().getAccessibleTable() + .getAccessibleColumnHeader().getAccessibleAt(0, i); + + if (!(accessible.getAccessibleContext().getAccessibleName().equals(colNames[i]))) { + throw new RuntimeException( + "AccessibleJTableCell.getAccessibleName returns correct name for header cells"); + } + } + }); + } finally { + SwingUtilities.invokeAndWait(() -> jFrame.dispose()); + } + } + + private static void createGUI() { + jTable = new JTable(rowData, colNames); + jFrame = new JFrame(); + jFrame.setBounds(100, 100, 300, 300); + jFrame.getContentPane().add(jTable); + jFrame.setVisible(true); + } + + public static void main(String args[]) throws Exception { + doTest(); + System.out.println("Test Passed"); + } +} + diff --git a/test/jdk/javax/accessibility/manual/SliderDemo.html b/test/jdk/javax/accessibility/manual/SliderDemo.html new file mode 100644 index 0000000000000000000000000000000000000000..7f7ff85995e5c5f443d03cba4aedf2d856cee60e --- /dev/null +++ b/test/jdk/javax/accessibility/manual/SliderDemo.html @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    S.NoTestScenario
    1Test Slider Demo (test different Sliders and its values should changing when + different keys are pressed and mouse drag and click action are performed). +
      +
    1. Tab or use array keys until the Slider icon has focus on it.
    2. +
    3. Press 'space' to choose Slider Demo. Press tab key to move the focus on the slider.
    4. +
    5. Pressing Left / Down arrow keys will decrease the Slider value.
    6. +
    7. Pressing Right / Up arrow keys will increase the Slider value.
    8. +
    9. Pressing Home key Slider value is set to initial value
    10. +
    11. Pressing End key Slider value is set to final or maximum value
    12. +
    13. Pressing PageUp / PageDown key Slider value is jump to the value range + value set.
    14. +
    15. Use mouse to drag the slider head or thumb to increase or decrease the slider value.
    16. +
    17. Disabled Slider value will not change.
    18. +
    + +
    + Expected Result +
    + Verify that Slider value should change according to the Key press key release and mouse + action. +
    Note: actual component appearence may vary depending on look and + feel.
    + + diff --git a/test/jdk/javax/accessibility/manual/SliderDemo.java b/test/jdk/javax/accessibility/manual/SliderDemo.java new file mode 100644 index 0000000000000000000000000000000000000000..a721473f2bc8fa741610e81c803208551c8affc0 --- /dev/null +++ b/test/jdk/javax/accessibility/manual/SliderDemo.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 +@key headful +@summary manual test for accessibility Slider demo +@run main/manual SwingSetTest SliderDemo +*/ diff --git a/test/jdk/javax/accessibility/manual/resource/Slider.png b/test/jdk/javax/accessibility/manual/resource/Slider.png new file mode 100644 index 0000000000000000000000000000000000000000..08a03b2bce51dd591d0351292470142eb9ba98ac Binary files /dev/null and b/test/jdk/javax/accessibility/manual/resource/Slider.png differ diff --git a/test/jdk/javax/accessibility/manual/resource/jsliderIcon.gif b/test/jdk/javax/accessibility/manual/resource/jsliderIcon.gif new file mode 100644 index 0000000000000000000000000000000000000000..61924f50ea5456828dab4227537c68b9276b7145 Binary files /dev/null and b/test/jdk/javax/accessibility/manual/resource/jsliderIcon.gif differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/CMYKJPEGTest.java b/test/jdk/javax/imageio/plugins/jpeg/CMYK/CMYKJPEGTest.java new file mode 100644 index 0000000000000000000000000000000000000000..db4588d29c74a7f9ee6dd54299be03991ff1f615 --- /dev/null +++ b/test/jdk/javax/imageio/plugins/jpeg/CMYK/CMYKJPEGTest.java @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +/* + * + * This test verifies that using the built-in ImageI/O JPEG plugin that JPEG images + * that are in a CMYK ColorSpace can be read into a BufferedImage using the convemience + * APIS and that and the colours are properly interpreted. + * Since there is no standard JDK CMYK ColorSpace, this requires that either the image + * contain an ICC_Profile which can be used by the plugin to create an ICC_ColorSpace + * or that the plugin provides a suitable default CMYK ColorSpace instance by some other means. + * + * The test further verifies that the resultant BufferedImage will be re-written as a CMYK + * BufferedImage. It can do this so long as the BufferedImage has that CMYK ColorSpace + * used by its ColorModel. + * + * The verification requires re-reading again the re-written image and checking the + * re-read image still has a CMYK ColorSpace and the same colours. + * + * Optionally - not for use in the test harness - the test can be passed a parameter + * -display to create a UI which renders all the images the test is + * verifying so it can be manually verified + */ + +/* + * @test + * @bug 8274735 + * @summary Verify CMYK JPEGs can be read and written + */ + +import java.awt.Color; +import static java.awt.Color.*; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +public class CMYKJPEGTest { + + static String[] fileNames = { + "black_cmyk.jpg", + "white_cmyk.jpg", + "gray_cmyk.jpg", + "red_cmyk.jpg", + "blue_cmyk.jpg", + "green_cmyk.jpg", + "cyan_cmyk.jpg", + "magenta_cmyk.jpg", + "yellow_cmyk.jpg", + }; + + static Color[] colors = { + black, + white, + gray, + red, + blue, + green, + cyan, + magenta, + yellow, + }; + + static boolean display; + + static BufferedImage[] readImages; + static BufferedImage[] writtenImages; + static int imageIndex = 0; + + public static void main(String[] args) throws Exception { + + if (args.length > 0) { + display = "-display".equals(args[0]); + } + + String sep = System.getProperty("file.separator"); + String dir = System.getProperty("test.src", "."); + String prefix = dir+sep; + + readImages = new BufferedImage[fileNames.length]; + writtenImages = new BufferedImage[fileNames.length]; + + for (String fileName : fileNames) { + String color = fileName.replace("_cmyk.jpg", ""); + test(prefix+fileName, color, imageIndex++); + } + if (display) { + SwingUtilities.invokeAndWait(() -> createUI()); + } + } + + static void test(String fileName, String color, int index) + throws IOException { + + readImages[index] = ImageIO.read(new File(fileName)); + verify(readImages[index], color, colors[index]); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write(readImages[index], "jpg", baos); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + writtenImages[index] = ImageIO.read(bais); + verify(writtenImages[index], color, colors[index]); + } + + static void verify(BufferedImage img, String colorName, Color c) { + ColorModel cm = img.getColorModel(); + int tc = cm.getNumComponents(); + int cc = cm.getNumColorComponents(); + if (cc != 4 || tc != 4) { + throw new RuntimeException("Unexpected num comp for " + img); + } + + int rgb = img.getRGB(0,0); + int c_red = c.getRed(); + int c_green = c.getGreen(); + int c_blue = c.getBlue(); + int i_red = (rgb & 0x0ff0000) >> 16; + int i_green = (rgb & 0x000ff00) >> 8; + int i_blue = (rgb & 0x00000ff); + int tol = 16; + if ((Math.abs(i_red - c_red) > tol) || + (Math.abs(i_green - c_green) > tol) || + (Math.abs(i_blue - c_blue) > tol)) + { + System.err.println("red="+i_red+" green="+i_green+" blue="+i_blue); + throw new RuntimeException("Too different " + img + " " + colorName + " " + c); + } + } + + static class ImageComp extends JComponent { + + BufferedImage img; + + ImageComp(BufferedImage img) { + this.img = img; + } + + public Dimension getPreferredSize() { + return new Dimension(img.getWidth(), img.getHeight()); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public void paintComponent(Graphics g) { + super.paintComponent(g); + g.drawImage(img, 0, 0, null); + } + } + + static void createUI() { + JFrame f = new JFrame("CMYK JPEG Test"); + JPanel p = new JPanel(); + p.setLayout(new GridLayout(3, colors.length, 10, 10)); + for (String s : fileNames) { + p.add(new JLabel(s.replace("_cmyk.jpg", ""))); + } + for (BufferedImage i : readImages) { + p.add(new ImageComp(i)); + } + for (BufferedImage i : writtenImages) { + p.add(new ImageComp(i)); + } + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.add(p); + f.pack(); + f.setVisible(true); + } +} diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/black_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/black_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1446f063bddf0c80a63a4a9da213b5560ad1d236 Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/black_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/blue_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/blue_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..74aa67622e47c65cfeafda3faca6c913be204b39 Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/blue_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/cyan_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/cyan_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4e97acc33c29f5630927789afc21d3532d027f57 Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/cyan_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/gray_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/gray_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a519437e702e9b6d097595ced0e8410f2864908c Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/gray_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/green_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/green_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c5c4af371314eb9bc7dbcd8e35ab725fc3b76cd9 Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/green_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/magenta_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/magenta_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9209e1f82b9d3ed1fcc17619bb13f4bee987b13e Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/magenta_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/red_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/red_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..594f2ac082355fcf437a9799a40b71ac6522e208 Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/red_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/white_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/white_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..319bbb364706102d0d45c886413bf38bfb005a79 Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/white_cmyk.jpg differ diff --git a/test/jdk/javax/imageio/plugins/jpeg/CMYK/yellow_cmyk.jpg b/test/jdk/javax/imageio/plugins/jpeg/CMYK/yellow_cmyk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4a7a338b256997d8d84290a4418ac9ebd3862648 Binary files /dev/null and b/test/jdk/javax/imageio/plugins/jpeg/CMYK/yellow_cmyk.jpg differ diff --git a/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java b/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java index a9373ed09f9da803f4d522b283bdcc1db5524715..2752649dc74e41e4e4fb48dd5a1430a92c113fce 100644 --- a/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java +++ b/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -484,7 +484,7 @@ public class SSLServerSocketAlpnTest { */ if ((local != null) && (remote != null)) { // If both failed, return the curthread's exception. - local.initCause(remote); + local.addSuppressed(remote); exception = local; } else if (local != null) { exception = local; diff --git a/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java b/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java index ef72474f4177e35dce3844b79ce2ed8b6f3f9151..172eecd46089b7c035b2d8baa21efa1468a80d4d 100644 --- a/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java +++ b/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -480,7 +480,7 @@ public class SSLSocketAlpnTest { */ if ((local != null) && (remote != null)) { // If both failed, return the curthread's exception. - local.initCause(remote); + local.addSuppressed(remote); exception = local; } else if (local != null) { exception = local; diff --git a/test/jdk/javax/net/ssl/DTLS/CipherSuite.java b/test/jdk/javax/net/ssl/DTLS/CipherSuite.java index 773fb08d3176e05f8ddb247e4fb619e19d7648e1..1c4b1c6d84f0269d1410e2e3c4308e969ff6cd5f 100644 --- a/test/jdk/javax/net/ssl/DTLS/CipherSuite.java +++ b/test/jdk/javax/net/ssl/DTLS/CipherSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * 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,9 @@ import javax.net.ssl.SSLEngine; import java.security.Security; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * Test common DTLS cipher suites. @@ -59,10 +62,12 @@ public class CipherSuite extends DTLSOverDatagram { // use the specific cipher suite volatile static String cipherSuite; + private static boolean reenable; public static void main(String[] args) throws Exception { if (args.length > 1 && "re-enable".equals(args[1])) { Security.setProperty("jdk.tls.disabledAlgorithms", ""); + reenable = true; } cipherSuite = args[0]; @@ -77,6 +82,11 @@ public class CipherSuite extends DTLSOverDatagram { if (isClient) { engine.setEnabledCipherSuites(new String[]{cipherSuite}); + } else if (reenable) { + List cipherSuites = + new ArrayList(Arrays.asList(engine.getEnabledCipherSuites())); + cipherSuites.add(cipherSuite); + engine.setEnabledCipherSuites(cipherSuites.toArray(new String[0])); } return engine; diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLHandshakeException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLHandshakeException.java new file mode 100644 index 0000000000000000000000000000000000000000..4c8aba3de44d0e24d02bd771d47fc6f9474ada54 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLHandshakeException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * 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 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLHandshakeException; +import java.util.Objects; + +public class CheckSSLHandshakeException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLHandshakeException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLKeyException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLKeyException.java new file mode 100644 index 0000000000000000000000000000000000000000..dcd62fcf8e7d367504e2b43a6a34ad720d0f40ec --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLKeyException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * 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 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLKeyException; +import java.util.Objects; + +public class CheckSSLKeyException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLKeyException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLPeerUnverifiedException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLPeerUnverifiedException.java new file mode 100644 index 0000000000000000000000000000000000000000..04184e99306bc7838bdbdad8cf5a021f75b36752 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLPeerUnverifiedException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * 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 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLPeerUnverifiedException; +import java.util.Objects; + +public class CheckSSLPeerUnverifiedException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLPeerUnverifiedException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLProtocolException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLProtocolException.java new file mode 100644 index 0000000000000000000000000000000000000000..3f62fac8f771bba2521155b22975d2510fee3fe2 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLProtocolException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * 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 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLProtocolException; +import java.util.Objects; + +public class CheckSSLProtocolException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLProtocolException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java b/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java index 7bb3e2c8d2b50e37262fd0ee2bac37a14e3957a0..441f6bdff483bd5ffb77f2685db64ab02b044a89 100644 --- a/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java +++ b/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8076221 8211883 + * @bug 8076221 8211883 8163327 * @summary Check if weak cipher suites are disabled * @modules jdk.crypto.ec * @run main/othervm DisabledAlgorithms default @@ -60,9 +60,10 @@ public class DisabledAlgorithms { System.getProperty("test.src", "./") + "/" + pathToStores + "/" + trustStoreFile; - // supported RC4, NULL, and anon cipher suites + // supported 3DES, DES, RC4, NULL, and anon cipher suites // it does not contain KRB5 cipher suites because they need a KDC - private static final String[] rc4_null_anon_ciphersuites = new String[] { + private static final String[] desede_des_rc4_null_anon_ciphersuites + = new String[] { "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", "TLS_ECDHE_RSA_WITH_RC4_128_SHA", "SSL_RSA_WITH_RC4_128_SHA", @@ -90,11 +91,25 @@ public class DisabledAlgorithms { "TLS_DH_anon_WITH_AES_256_CBC_SHA", "TLS_DH_anon_WITH_AES_256_CBC_SHA256", "TLS_DH_anon_WITH_AES_256_GCM_SHA384", + "SSL_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_DSS_WITH_DES_CBC_SHA", + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", + "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", "TLS_ECDH_anon_WITH_AES_128_CBC_SHA", "TLS_ECDH_anon_WITH_AES_256_CBC_SHA", "TLS_ECDH_anon_WITH_NULL_SHA", - "TLS_ECDH_anon_WITH_RC4_128_SHA" + "TLS_ECDH_anon_WITH_RC4_128_SHA", + "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_RSA_WITH_3DES_EDE_CBC_SHA" }; public static void main(String[] args) throws Exception { @@ -113,19 +128,25 @@ public class DisabledAlgorithms { System.out.println("jdk.tls.disabledAlgorithms = " + Security.getProperty("jdk.tls.disabledAlgorithms")); - // check if RC4, NULL, and anon cipher suites + // check if 3DES, DES, RC4, NULL, and anon cipher suites // can't be used by default - checkFailure(rc4_null_anon_ciphersuites); + checkFailure(desede_des_rc4_null_anon_ciphersuites); break; case "empty": // reset jdk.tls.disabledAlgorithms Security.setProperty("jdk.tls.disabledAlgorithms", ""); System.out.println("jdk.tls.disabledAlgorithms = " + Security.getProperty("jdk.tls.disabledAlgorithms")); - - // check if RC4, NULL, and anon cipher suites can be used - // if jdk.tls.disabledAlgorithms is empty - checkSuccess(rc4_null_anon_ciphersuites); + // reset jdk.certpath.disabledAlgorithms. This is necessary + // to allow the RSA_EXPORT suites to pass which use an RSA 512 + // bit key which violates the default certpath constraints. + Security.setProperty("jdk.certpath.disabledAlgorithms", ""); + System.out.println("jdk.certpath.disabledAlgorithms = " + + Security.getProperty("jdk.certpath.disabledAlgorithms")); + + // check if 3DES, DES, RC4, NULL, and anon cipher suites + // can be used if jdk.{tls,certpath}.disabledAlgorithms is empty + checkSuccess(desede_des_rc4_null_anon_ciphersuites); break; default: throw new RuntimeException("Wrong parameter: " + args[0]); diff --git a/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java b/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java index 54b4e3c68407208023d54c04ec4c163ccb914fc6..cbb42ee1a699bc0a2f2e91e6c26bee587451fcc9 100644 --- a/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java +++ b/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -349,13 +349,13 @@ public class SSLSocketSSLEngineTemplate { } finally { if (serverException != null) { if (clientException != null) { - serverException.initCause(clientException); + serverException.addSuppressed(clientException); } throw serverException; } if (clientException != null) { if (serverException != null) { - clientException.initCause(serverException); + clientException.addSuppressed(serverException); } throw clientException; } diff --git a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java index ce2e3ee121be403a8b5c3ad0f9f73ea0794c2212..f200752d2a79985906378cdd82b37becfff9d97d 100644 --- a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java +++ b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -544,7 +544,7 @@ public class SSLSocketTemplate { */ if ((local != null) && (remote != null)) { // If both failed, return the curthread's exception. - local.initCause(remote); + local.addSuppressed(remote); exception = local; } else if (local != null) { exception = local; diff --git a/test/jdk/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java b/test/jdk/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java index cc2d184298d7c36e3bfb100c172cf704262670c6..c2fcf2fa48f83605345528552697e64fc505a824 100644 --- a/test/jdk/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java +++ b/test/jdk/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +43,7 @@ public class SerialJavaObjectTests extends BaseTest { } /* - * Validate that an SerialExcepion is thrown when the object specified + * Validate that a SerialException is thrown when the object specified * contains public static fields */ @Test(expectedExceptions = SerialException.class, enabled = false) diff --git a/test/jdk/javax/swing/JComboBox/4231298/JComboBoxPrototypeDisplayValueTest.java b/test/jdk/javax/swing/JComboBox/4231298/JComboBoxPrototypeDisplayValueTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bd71c4fabacee90ce5679fe9c76416c533383613 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/4231298/JComboBoxPrototypeDisplayValueTest.java @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * 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.Color; +import java.awt.Component; +import java.awt.Robot; +import java.util.Arrays; +import java.util.List; +import java.util.Vector; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4231298 + * @summary This testcase tests the RFE 4231298 request, JComboBox Custom + * Renderer should not be called for non displaying elements if + * setPrototypeDisplayValue() has been invoked. + * @run main JComboBoxPrototypeDisplayValueTest + */ +public class JComboBoxPrototypeDisplayValueTest { + + private static Robot robot; + private static JFrame frame; + private static JComboBox buttonComboBox; + private static volatile int count; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + count = 0; + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + SwingUtilities + .invokeAndWait(() -> buttonComboBox.getPreferredSize()); + + robot.waitForIdle(); + if (count > 6) { + System.out.println("Test Failed"); + throw new RuntimeException( + "Custom Renderer got called " + count + " times, " + + "even after calling setPrototypeDisplayValue(), " + + "but the expected maximum is 6 times for " + laf); + } else { + System.out.println("Test Passed for " + laf); + } + } finally { + SwingUtilities.invokeAndWait( + JComboBoxPrototypeDisplayValueTest::disposeFrame); + } + } + } + + public static void createUI() { + Vector data = new Vector(IntStream.rangeClosed(1, 100).boxed() + .map(i -> new JButton("" + i)) + .collect(Collectors.toList())); + buttonComboBox = new JComboBox(data); + ButtonRenderer renderer = new ButtonRenderer(); + buttonComboBox.setRenderer(renderer); + buttonComboBox.setMaximumRowCount(25); + + // New method introduced in Java 1.4 + buttonComboBox.setPrototypeDisplayValue(new JButton("111111111")); + + frame = new JFrame(); + JPanel panel = new JPanel(); + panel.add(buttonComboBox); + frame.getContentPane().add(panel); + frame.setSize(200, 100); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported L&F: " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + + /** + * Custom ListCellRenderer used for the drop down portion and the text + * portion of the ComboBox. + */ + private static class ButtonRenderer implements ListCellRenderer { + private final Color selectedBackground; + private final Color selectedForeground; + private final Color background; + private final Color foreground; + + public ButtonRenderer() { + selectedBackground = Color.BLUE; + selectedForeground = Color.YELLOW; + background = Color.GRAY; + foreground = Color.RED; + } + + public Component getListCellRendererComponent(JList list, Object value, + int index, + boolean isSelected, + boolean cellHasFocus) { + JButton button = (JButton) value; + System.out.println( + "getListCellRendererComponent index = " + index + ", " + + "isSelected = " + isSelected + ", cellHasFocus = " + + cellHasFocus); + + button.setBackground(isSelected ? selectedBackground : background); + button.setForeground(isSelected ? selectedForeground : foreground); + + count++; + System.out.println("Value of the Counter is " + count); + + return button; + } + + } + +} diff --git a/test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java b/test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5b543894ef6c613e4361c843088a2f9e700867b4 --- /dev/null +++ b/test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java @@ -0,0 +1,45 @@ + /* + * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * 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 javax.swing.JEditorPane; + import javax.swing.SwingUtilities; + + /* + * @test + * @bug 4330998 + * @summary Verifies that JEditorPane.setText(null) doesn't throw NullPointerException. + * @run main JEditorPaneSetTextNullTest + */ + public class JEditorPaneSetTextNullTest { + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(() -> new JEditorPane().setText(null)); + System.out.println("Test passed"); + } catch (Exception e) { + throw new RuntimeException("Test failed, caught Exception " + e + + " when calling JEditorPane.setText(null)"); + } + } + + } diff --git a/test/jdk/javax/swing/JSplitPane/4164779/JSplitPaneKeyboardNavigationTest.java b/test/jdk/javax/swing/JSplitPane/4164779/JSplitPaneKeyboardNavigationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ced7410bf0664827a72a8c9384a0ccec8565a265 --- /dev/null +++ b/test/jdk/javax/swing/JSplitPane/4164779/JSplitPaneKeyboardNavigationTest.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * 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.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4164779 + * @summary This test confirms that JSplitPane keyboard navigation supports F6 and Ctrl+Tab. + * @run main JSplitPaneKeyboardNavigationTest + */ +public class JSplitPaneKeyboardNavigationTest { + + private static final StringBuffer failedVerifiers = new StringBuffer(); + private static JPanel panel; + private static JButton leftButton; + private static JButton rightButton1; + private static JButton rightButton2; + private static JButton topButton; + private static JButton bottomButton; + private static Robot robot; + private static JFrame frame; + + public static void main(String[] s) throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + // Press Right button 1 and move focus to it. + pressButton(rightButton1); + hitKeys(KeyEvent.VK_F6); + + // Verifier1 - Verifies that, F6 transfers focus to the right/bottom side of the splitpane + if (isFocusOwner(rightButton2)) { + System.out.println("Verifier 1 passed"); + } else { + failedVerifiers.append("1,"); + System.out.println("Verifier 1 failed, rightButton2 is not focus owner," + + "F6 doesn't transfer focus to the right/bottom side of the splitpane"); + } + + // Press Right button 2 and move focus to it. + pressButton(rightButton2); + hitKeys(KeyEvent.VK_F6); + + // Verifier2 - Verifies that, F6 transfers focus to the left side of the parent splitpane, + // if the right/bottom side of splitpane already has focus, and it is contained within another splitpane + if (isFocusOwner(leftButton)) { + System.out.println("Verifier 2 passed"); + } else { + failedVerifiers.append("2,"); + System.out.println("Verifier 2 failed, leftButton is not focus owner, " + + "F6 doesn't transfer focus to the left side of the splitpane"); + } + + // Press Left button and move focus to it. + pressButton(leftButton); + hitKeys(KeyEvent.VK_CONTROL, KeyEvent.VK_TAB); + // Verifier3 - Verifies that, CTRL-TAB navigates forward outside the JSplitPane + if (isFocusOwner(bottomButton)) { + System.out.println("Verifier 3 passed"); + } else { + failedVerifiers.append("3,"); + System.out.println("Verifier 3 failed, bottomButton is not focus owner, " + + "CTRL-TAB doesn't navigate forward outside the JSplitPane"); + } + + // Press Left button and move focus to it. + pressButton(leftButton); + hitKeys(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB); + + // Verifier4 - Verifies that, CTRL-SHIFT-TAB navigates backward outside the JSplitPane + if (isFocusOwner(topButton)) { + System.out.println("Verifier 4 passed"); + } else { + failedVerifiers.append("4"); + System.out.println("Verifier 4 failed, topButton is not focus owner, " + + "CTRL-SHIFT-TAB doesn't navigate backward outside the JSplitPane"); + } + + if (failedVerifiers.toString().isEmpty()) { + System.out.println("Test passed, All verifiers succeeded for " + laf); + } else { + throw new RuntimeException("Test failed, verifiers " + failedVerifiers.toString() + " failed for " + laf); + } + } finally { + SwingUtilities.invokeAndWait(JSplitPaneKeyboardNavigationTest::disposeFrame); + } + } + } + + private static boolean isFocusOwner(JButton button) throws Exception { + final AtomicBoolean isFocusOwner = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + isFocusOwner.set(button.isFocusOwner()); + }); + return isFocusOwner.get(); + } + + private static void pressButton(JButton button) throws Exception { + final AtomicReference loc = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + loc.set(button.getLocationOnScreen()); + }); + final Point buttonLoc = loc.get(); + robot.mouseMove(buttonLoc.x + 8, buttonLoc.y + 8); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } + + public static void createUI() { + frame = new JFrame(); + panel = new JPanel(); + panel.setLayout(new BorderLayout()); + leftButton = new JButton("Left Button"); + rightButton1 = new JButton("Right Button 1"); + rightButton2 = new JButton("Right Button 2"); + topButton = new JButton("Top Button"); + bottomButton = new JButton("Bottom Button"); + panel.add(topButton, BorderLayout.NORTH); + panel.add(bottomButton, BorderLayout.SOUTH); + final JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, rightButton1, rightButton2); + final JSplitPane splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftButton, splitPane2); + panel.add(splitPane1, BorderLayout.CENTER); + frame.setContentPane(panel); + frame.setSize(200, 200); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.pack(); + frame.setAlwaysOnTop(true); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static void hitKeys(int... keys) { + for (int key : keys) { + robot.keyPress(key); + } + + for (int i = keys.length - 1; i >= 0; i--) { + robot.keyRelease(keys[i]); + } + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported L&F: " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} diff --git a/test/jdk/javax/swing/JSplitPane/4615365/JSplitPaneDividerLocationTest.java b/test/jdk/javax/swing/JSplitPane/4615365/JSplitPaneDividerLocationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..108dae995bdb9fd4d5bf71ee154258a1a83c4996 --- /dev/null +++ b/test/jdk/javax/swing/JSplitPane/4615365/JSplitPaneDividerLocationTest.java @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * 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.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.swing.AbstractButton; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; +/* + * @test + * @key headful + * @bug 4615365 + * @summary This test confirms that the JSplitPane's current and last + * divider positions are correct when realized. + * @run main JSplitPaneDividerLocationTest + */ +public class JSplitPaneDividerLocationTest { + + private static JFrame frame; + private static JPanel panel; + private static JButton leftButton; + private static JToggleButton triggerButton; + private static volatile int currentLoc; + private static volatile int lastLoc; + private static volatile int lastLocExpected; + private static Robot robot; + + public static void main(String[] s) throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + pressButton(triggerButton); + + // Verifies that JSplitPane current and last divider + // positions are correct and not as per JDK-4615365. + if ((currentLoc == -1) || (lastLoc == 0)) { + throw new RuntimeException( + "Test failed for " + laf + " :- last divider loc:" + + "actual = " + lastLoc + ",expected = -1, current " + + "divider loc:actual=" + currentLoc + ",expected>0"); + } + lastLocExpected = currentLoc; + + // Slide the split pane divider slightly to the right side. + final Point leftButtonLoc = getButtonLoc(leftButton); + robot.mouseMove(leftButtonLoc.x + leftButton.getWidth() + 5, + leftButtonLoc.y + 35); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseMove(leftButtonLoc.x + leftButton.getWidth() + 8, + leftButtonLoc.y + 35); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + pressButton(triggerButton); + + // Verifies that JSplitPane current and last divider positions + // reflects the correct positions after a right slide. + if ((lastLoc == lastLocExpected) && (currentLoc > lastLoc)) { + System.out.println("Test Passed."); + } else { + throw new RuntimeException( + "Test failed for " + laf + ", because after a " + + "right " + "slide" + ", last divider " + + "location: " + "actual = " + lastLoc + + ", expected = " + lastLocExpected + + ", current divider " + "location: actual = " + + currentLoc + ", expected > " + lastLoc); + } + } finally { + SwingUtilities.invokeAndWait( + JSplitPaneDividerLocationTest::disposeFrame); + } + } + } + + private static void pressButton(JToggleButton button) throws Exception { + final Point buttonLoc = getButtonLoc(button); + robot.mouseMove(buttonLoc.x + 8, buttonLoc.y + 8); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } + + private static Point getButtonLoc(AbstractButton button) + throws InterruptedException, InvocationTargetException { + final AtomicReference loc = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + loc.set(button.getLocationOnScreen()); + }); + final Point buttonLoc = loc.get(); + return buttonLoc; + } + + private static void createUI() { + frame = new JFrame(); + panel = new JPanel(); + panel.setLayout(new BorderLayout()); + leftButton = new JButton("Left Button"); + JButton rightButton = new JButton("Right Button"); + + final JSplitPane splitPane = + new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftButton, + rightButton); + panel.add(splitPane, BorderLayout.CENTER); + + splitPane.setDividerSize(10); + + triggerButton = new JToggleButton("Trigger"); + triggerButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + currentLoc = splitPane.getDividerLocation(); + lastLoc = splitPane.getLastDividerLocation(); + System.out.println( + "currentLoc = " + currentLoc + ", lastLoc = " + + lastLoc); + } + }); + panel.add(triggerButton, BorderLayout.SOUTH); + + frame.setContentPane(panel); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported L&F: " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} diff --git a/test/jdk/javax/swing/JSplitPane/4820080/JSplitPaneDragColorTest.java b/test/jdk/javax/swing/JSplitPane/4820080/JSplitPaneDragColorTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7e107f1265c75437af370e97b4bc27b47fc06778 --- /dev/null +++ b/test/jdk/javax/swing/JSplitPane/4820080/JSplitPaneDragColorTest.java @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * 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.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.imageio.ImageIO; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4820080 + * @summary This test confirms that the Drag color of JSplitPane divider should + * be the user specified one(Red here). + * @run main JSplitPaneDragColorTest + */ +public class JSplitPaneDragColorTest { + + // Tolerance is set inorder to negate small differences in pixel color values, + // especially in Mac machines. + private final static int COLOR_TOLERANCE = 9; + private static final Color EXPECTED_DRAG_COLOR = Color.RED; + private static JFrame frame; + private static JSplitPane pane; + private static Robot robot; + + public static void main(String[] args) throws Exception { + + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + // Skipping NimbusLookAndFeel & GTKLookAndFeel, + // as both are not supported for this feature - JDK-8075914, JDK-8075608 + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .filter(laf -> !(laf.getName().contains("GTK") + || laf.getName().contains("Nimbus"))) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + Rectangle dividerRect = getDividerRect(); + + // Mouse click and right drag split pane divider + robot.mouseMove(dividerRect.x + 5, dividerRect.y + 36); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseMove(dividerRect.x + 15, dividerRect.y + 36); + robot.mouseMove(dividerRect.x + 5, dividerRect.y + 36); + + // Get the color of one of the pixels of the splitpane divider + // after the drag has started. Ideally it should be the + // SplitPaneDivider.draggingColor set by user, otherwise the test fails + final Color actualDragColor = robot.getPixelColor(dividerRect.x + 2, + dividerRect.y + 2); + if (checkDragColor(actualDragColor)) { + System.out.println("Test passed in " + laf); + } else { + System.out.print("Expected pixel color = "); + System.out.printf("%X", EXPECTED_DRAG_COLOR.getRGB()); + System.out.print(", but actual color = "); + System.out.printf("%X", actualDragColor.getRGB()); + System.out.println(); + captureScreen(); + throw new RuntimeException("Test failed, drag color is wrong in " + + laf); + } + } finally { + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + SwingUtilities.invokeAndWait(JSplitPaneDragColorTest::disposeFrame); + } + } + } + + private static boolean checkDragColor(Color actualDragColor) { + int actualRed = actualDragColor.getRed(); + int actualGreen = actualDragColor.getGreen(); + int actualBlue = actualDragColor.getBlue(); + int expectedRed = EXPECTED_DRAG_COLOR.getRed(); + int expectedGreen = EXPECTED_DRAG_COLOR.getGreen(); + int expectedBlue = EXPECTED_DRAG_COLOR.getBlue(); + + final double tolerance = Math.sqrt( + (actualRed - expectedRed) * (actualRed - expectedRed) + + (actualGreen - expectedGreen) * (actualGreen - expectedGreen) + + (actualBlue - expectedBlue) * (actualBlue - expectedBlue)); + return (tolerance <= COLOR_TOLERANCE); + } + + private static Rectangle getDividerRect() { + final AtomicReference rect = new AtomicReference<>(); + SwingUtilities.invokeLater(() -> { + javax.swing.plaf.basic.BasicSplitPaneUI ui = + (javax.swing.plaf.basic.BasicSplitPaneUI) pane.getUI(); + + javax.swing.plaf.basic.BasicSplitPaneDivider divider = ui.getDivider(); + Point dividerLoc = divider.getLocationOnScreen(); + rect.set(new Rectangle(dividerLoc.x, dividerLoc.y, divider.getWidth(), + divider.getHeight())); + }); + robot.waitForIdle(); + return rect.get(); + } + + private static void captureScreen() { + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + try { + ImageIO.write( + robot.createScreenCapture(new Rectangle(0, 0, + screenSize.width, + screenSize.height)), + "png", + new File("screen1.png") + ); + } catch (IOException ignore) { + } + } + + private static void createUI() { + frame = new JFrame(); + UIManager.put("SplitPaneDivider.draggingColor", EXPECTED_DRAG_COLOR); + JLabel l1 = new JLabel("LEFT LABEL", JLabel.CENTER); + JLabel l2 = new JLabel("RIGHT LABEL", JLabel.CENTER); + pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, l1, l2); + frame.setSize(400, 400); + pane.setDividerSize(15); + pane.setDividerLocation(frame.getSize().width / 2); + frame.getContentPane().add(pane, BorderLayout.CENTER); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported L&F: " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} diff --git a/test/jdk/javax/swing/JTable/JTableOrientationNavTest/JTableOrientationNavTest.java b/test/jdk/javax/swing/JTable/JTableOrientationNavTest/JTableOrientationNavTest.java new file mode 100644 index 0000000000000000000000000000000000000000..653ae205993b94c188994680c7935d87a3adfe96 --- /dev/null +++ b/test/jdk/javax/swing/JTable/JTableOrientationNavTest/JTableOrientationNavTest.java @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8024624 + * @key headful + * @requires (os.family != "mac") + * @summary Tests some of JTable's key navigation + * @run main JTableOrientationNavTest + */ + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.ComponentOrientation; +import java.awt.Rectangle; +import java.awt.Robot; +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; + +import static java.awt.event.KeyEvent.VK_CONTROL; +import static java.awt.event.KeyEvent.VK_LEFT; +import static java.awt.event.KeyEvent.VK_PAGE_DOWN; +import static java.awt.event.KeyEvent.VK_PAGE_UP; +import static java.awt.event.KeyEvent.VK_RIGHT; +import static java.awt.event.KeyEvent.VK_SHIFT; + +public class JTableOrientationNavTest { + private static JFrame frame; + private static JTable table; + private static JScrollPane sp; + private static Robot robot; + private static boolean ltr = true; + + public static void main(String[] args) throws InterruptedException, InvocationTargetException { + try { + robot = new Robot(); + robot.setAutoDelay(100); + robot.setAutoWaitForIdle(true); + + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.add(createContentPane()); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + + executeTest(); + setupRTL(); + executeTest(); + + System.out.println("Passed"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + SwingUtilities.invokeAndWait(() -> frame.dispose()); + } + } + + private static TableModel getTableModel1() { + String[] columnNames = {"Column 0", "Column 1", "Column 2", + "Column 3", "Column 4"}; + String[][] data = {{"Table 00, 00", "Table 00, 01", "Table 00, 02", + "Table 00, 03", "Table 00, 04"}, + {"Table 01, 00", "Table 01, 01", "Table 01, 02", + "Table 01, 03", "Table 01, 04"}, + {"Table 02, 00", "Table 02, 01", "Table 02, 02", + "Table 02, 03", "Table 02, 04"}, + {"Table 03, 00", "Table 03, 01", "Table 03, 02", + "Table 03, 03", "Table 03, 04"}, + {"Table 04, 00", "Table 04, 01", "Table 04, 02", + "Table 04, 03", "Table 04, 04"}, + {"Table 05, 00", "Table 05, 01", "Table 05, 02", + "Table 05, 03", "Table 05, 04"}}; + + return new DefaultTableModel(data, columnNames); + } + + private static TableModel getTableModel2() { + String[] columnNames = new String[30]; + String[][] data = new String[1][30]; + + for (int i = 0; i < columnNames.length; i++) { + columnNames[i] = "Column " + i; + data[0][i] = "Data " + 1; + } + + return new DefaultTableModel(data, columnNames); + } + + private static Component createContentPane() { + table = new JTable(getTableModel1()); + table.setCellSelectionEnabled(true); + table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + JPanel panel = new JPanel(new BorderLayout()); + sp = new JScrollPane(table); + panel.add(sp); + return panel; + } + + private static void executeTest() throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(() -> { + table.setRowSelectionInterval(0, 0); + table.setColumnSelectionInterval(0, 0); + checkSelection(0, 0); + }); + + robot.keyPress(ltr ? VK_RIGHT : VK_LEFT); + robot.keyRelease(ltr ? VK_RIGHT : VK_LEFT); + + SwingUtilities.invokeAndWait(() -> checkSelection(1, 1)); + + robot.keyPress(VK_CONTROL); + robot.keyPress(ltr ? VK_RIGHT : VK_LEFT); + robot.keyRelease(ltr ? VK_RIGHT : VK_LEFT); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> { + checkSelection(2, 1); + table.setRowSelectionInterval(0, 0); + table.setColumnSelectionInterval(4, 4); + checkSelection(4, 4); + }); + + robot.keyPress(ltr ? VK_LEFT : VK_RIGHT); + robot.keyRelease(ltr ? VK_LEFT : VK_RIGHT); + + SwingUtilities.invokeAndWait(() -> checkSelection(3, 3)); + + robot.keyPress(VK_CONTROL); + robot.keyPress(ltr ? VK_LEFT : VK_RIGHT); + robot.keyRelease(ltr ? VK_LEFT : VK_RIGHT); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> { + checkSelection(2, 3); + table.setColumnSelectionInterval(2, 2); + checkSelection(2, 2); + }); + + robot.keyPress(VK_CONTROL); + robot.keyPress(VK_PAGE_UP); + robot.keyRelease(VK_PAGE_UP); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> { + checkSelection(0, 0); + table.setColumnSelectionInterval(2, 2); + checkSelection(2, 2); + }); + + robot.keyPress(VK_CONTROL); + robot.keyPress(VK_PAGE_DOWN); + robot.keyRelease(VK_PAGE_DOWN); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> { + checkSelection(4, 4); + table.setColumnSelectionInterval(2, 2); + checkSelection(2, 2); + }); + + robot.keyPress(VK_CONTROL); + robot.keyPress(VK_SHIFT); + robot.keyPress(VK_PAGE_UP); + robot.keyRelease(VK_PAGE_UP); + robot.keyRelease(VK_SHIFT); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> { + checkSelection(0, 0, 1, 2); + table.setColumnSelectionInterval(2, 2); + checkSelection(2, 2); + }); + + robot.keyPress(VK_CONTROL); + robot.keyPress(VK_SHIFT); + robot.keyPress(VK_PAGE_DOWN); + robot.keyRelease(VK_PAGE_DOWN); + robot.keyRelease(VK_SHIFT); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> { + checkSelection(4, 2, 3, 4); + table.setModel(getTableModel2()); + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + table.setRowSelectionInterval(0, 0); + table.setColumnSelectionInterval(0, 0); + table.scrollRectToVisible(new Rectangle(ltr ? 0 : table.getWidth(), 0, 1, 1)); + checkSelection(0, 0); + }); + + robot.keyPress(VK_CONTROL); + robot.keyPress(VK_PAGE_DOWN); + robot.keyRelease(VK_PAGE_DOWN); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> { + checkSelection(6, 6); + table.setColumnSelectionInterval(29, 29); + table.scrollRectToVisible(new Rectangle(ltr ? table.getWidth() : 0, 0, 1, 1)); + checkSelection(29, 29); + }); + + robot.keyPress(VK_CONTROL); + robot.keyPress(VK_PAGE_UP); + robot.keyRelease(VK_PAGE_UP); + robot.keyRelease(VK_CONTROL); + + SwingUtilities.invokeAndWait(() -> checkSelection(23, 23)); + + System.out.println("Done with ltr: " + ltr); + } + + private static void setupRTL() throws InterruptedException, InvocationTargetException { + ltr = false; + SwingUtilities.invokeAndWait(() -> { + table.setModel(getTableModel1()); + table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); + sp.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); + }); + } + + private static void checkSelection(int col, int... allCols) { + int trow = table.getSelectionModel().getLeadSelectionIndex(); + int[] trows = table.getSelectedRows(); + int tcol = table.getColumnModel().getSelectionModel().getLeadSelectionIndex(); + int[] tcols = table.getSelectedColumns(); + + if (trow != 0) { + throw new RuntimeException("Wrong lead row"); + } + + if (trows.length != 1 || trows[0] != 0) { + throw new RuntimeException("Bad row selection"); + } + + if (col != tcol) { + throw new RuntimeException("Wrong lead col"); + } + + if (allCols == null || allCols.length == 0) { + if (tcols.length != 0) { + throw new RuntimeException("Should be no cols selected"); + } + } else { + Arrays.sort(tcols); + Arrays.sort(allCols); + + for (int c : allCols) { + if (Arrays.binarySearch(tcols, c) < 0) { + throw new RuntimeException("Wrong column selection"); + } + } + + for (int c : tcols) { + if (Arrays.binarySearch(allCols, c) < 0) { + throw new RuntimeException("Wrong column selection"); + } + } + } + } + +} diff --git a/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java b/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..19b00c05d37570e6b94580c234600b48018bbd97 --- /dev/null +++ b/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * 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.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4618767 + * @summary This test confirms that typing a letter while a JTree has focus now makes the selection + * not jump to the item whose text starts with that letter if that typed letter is accompanied + * by modifier keys such as ALT or CTRL(eg: ALT+F). + * @run main JTreeSelectedElementTest + */ +public class JTreeSelectedElementTest { + + private static final int FILE_MENU = KeyEvent.VK_F; + private static JFrame frame; + private static JTree tree; + private static Robot robot; + private static CountDownLatch menuSelectedEventLatch; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + + final boolean isMac = System.getProperty("os.name") + .toLowerCase() + .contains("os x"); + + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + menuSelectedEventLatch = new CountDownLatch(1); + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + // Select the node named as 'colors' + Point pt = getNodeLocation(1); + robot.mouseMove(pt.x, pt.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + // Assertion check to verify that the selected node is 'colors' + final String elementSelBefore = getCurrentNodeName(); + if (!"colors".equals(elementSelBefore)) { + throw new RuntimeException("Test failed for " + laf + + " as the tree node selected: " + elementSelBefore + + " is not the expected one 'colors'" + ); + } + + // Now operate Menu using Mnemonics, different key combinations for different OSes. + // For most OSes it's ALT+F; on macOS it's ALT+CNTRL+F except for Nimbus LaF. + if (isMac && !laf.contains("Nimbus")) { + hitKeys(KeyEvent.VK_ALT, KeyEvent.VK_CONTROL, FILE_MENU); + } else { + hitKeys(KeyEvent.VK_ALT, FILE_MENU); + } + + // Wait until the menu got selected. + if (!menuSelectedEventLatch.await(3, TimeUnit.SECONDS)) { + throw new RuntimeException("Waited too long, but can't select menu using mnemonics for " + laf); + } + + hitKeys(KeyEvent.VK_ENTER); + + String elementSelAfter = getCurrentNodeName(); + + // As per the fix of BugID 4618767, the tree element selection should not change + if (!elementSelBefore.equals(elementSelAfter)) { + throw new RuntimeException("Test failed for " + laf + + " as tree.getLastSelectedPathComponent() before: " + elementSelBefore + + " not same as tree.getLastSelectedPathComponent() after pressing Enter: " + + elementSelAfter + ); + } + + System.out.println("Test passed for laf: " + laf); + + } finally { + SwingUtilities.invokeAndWait(JTreeSelectedElementTest::disposeFrame); + } + } + } + + private static void hitKeys(int... keys) { + for (int key : keys) { + robot.keyPress(key); + } + + for (int i = keys.length - 1; i >= 0; i--) { + robot.keyRelease(keys[i]); + } + } + + private static String getCurrentNodeName() throws Exception { + AtomicReference nodeName = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + nodeName.set(tree.getLastSelectedPathComponent().toString().trim()); + }); + return nodeName.get(); + } + + private static Point getNodeLocation(int rowCount) throws Exception { + AtomicReference treeNodeLoc = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + final Point locationOnScreen = tree.getLocationOnScreen(); + Rectangle rt = tree.getPathBounds(tree.getPathForRow(rowCount)); + locationOnScreen.translate(rt.x + rt.width / 2, rt.y + rt.height / 2); + treeNodeLoc.set(locationOnScreen); + }); + return treeNodeLoc.get(); + } + + private static void createUI() { + frame = new JFrame(); + tree = new JTree(); + JMenu menu = new JMenu("File"); + menu.setMnemonic(FILE_MENU); + JMenuItem menuItem = new JMenuItem("Dummy"); + menu.add(menuItem); + menu.addMenuListener(new MenuListener() { + @Override + public void menuSelected(MenuEvent e) { + menuSelectedEventLatch.countDown(); + } + + @Override + public void menuDeselected(MenuEvent e) { + } + + @Override + public void menuCanceled(MenuEvent e) { + } + }); + + JMenuBar menuBar = new JMenuBar(); + menuBar.add(menu); + + frame.setJMenuBar(menuBar); + frame.setContentPane(tree); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.pack(); + frame.setAlwaysOnTop(true); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported L&F: " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} diff --git a/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java b/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java index efb6a39e4790469747a29ad985b9fee55c93b08b..92b8cf282b784f1f9256c3b8774665a61d0c7100 100644 --- a/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java +++ b/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2020, 2022 THL A29 Limited, a Tencent company. All rights reserved. * 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,16 +24,36 @@ import com.sun.management.OperatingSystemMXBean; import java.lang.management.ManagementFactory; +// Usage: +// GetFreeSwapSpaceSize public class GetFreeSwapSpaceSize { public static void main(String[] args) { - System.out.println("TestGetFreeSwapSpaceSize"); + if (args.length != 4) { + throw new RuntimeException("Unexpected arguments. Expected 4, got " + args.length); + } + String memoryAlloc = args[0]; + long expectedMemory = Long.parseLong(args[1]); + String memorySwapAlloc = args[2]; + long expectedSwap = Long.parseLong(args[3]); + System.out.println("TestGetFreeSwapSpaceSize (memory=" + memoryAlloc + ", memorySwap=" + memorySwapAlloc + ")"); + if (expectedSwap != 0) { + throw new RuntimeException("Precondition of test not met: Expected swap size of 0, got: " + expectedSwap); + } OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + long osBeanTotalSwap = osBean.getTotalSwapSpaceSize(); + // Premise of this test is to test on a system where --memory and --memory-swap are set to + // the same amount via the container engine (i.e. no swap). In that case the OSBean must + // not report negative values for free swap space. Assert this precondition. + if (osBeanTotalSwap != expectedSwap) { + throw new RuntimeException("OperatingSystemMXBean.getTotalSwapSpaceSize() reported " + osBeanTotalSwap + " expected " + expectedSwap); + } + System.out.println("TestGetFreeSwapSpaceSize precondition met, osBeanTotalSwap = " + expectedSwap + ". Running test... "); for (int i = 0; i < 100; i++) { long size = osBean.getFreeSwapSpaceSize(); if (size < 0) { - System.out.println("Error: getFreeSwapSpaceSize returns " + size); - System.exit(-1); + throw new RuntimeException("Test failed! getFreeSwapSpaceSize returns " + size); } } + System.out.println("TestGetFreeSwapSpaceSize PASSED." ); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java index 319c55ab518e2be5dcbd7213966b22dcd4e94497..92f3364da10b002025e3b68a7ed6503842c1f55a 100644 --- a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java +++ b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2020, 2022 THL A29 Limited, a Tencent company. All rights reserved. * 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,7 @@ import jdk.test.lib.containers.docker.DockerTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class TestGetFreeSwapSpaceSize { - private static final String imageName = Common.imageName("memory"); + private static final String imageName = Common.imageName("osbeanSwapSpace"); public static void main(String[] args) throws Exception { if (!DockerTestUtils.canTestDocker()) { @@ -58,17 +58,18 @@ public class TestGetFreeSwapSpaceSize { } private static void testGetFreeSwapSpaceSize(String memoryAllocation, String expectedMemory, - String swapAllocation, String expectedSwap) throws Exception { + String memorySwapAllocation, String expectedSwap) throws Exception { Common.logNewTestCase("TestGetFreeSwapSpaceSize"); DockerRunOptions opts = Common.newOpts(imageName, "GetFreeSwapSpaceSize") + .addClassOptions(memoryAllocation, expectedMemory, memorySwapAllocation, expectedSwap) .addDockerOpts( "--memory", memoryAllocation, - "--memory-swap", swapAllocation + "--memory-swap", memorySwapAllocation ); OutputAnalyzer out = DockerTestUtils.dockerRunJava(opts); out.shouldHaveExitValue(0) - .shouldContain("TestGetFreeSwapSpaceSize"); + .shouldContain("TestGetFreeSwapSpaceSize PASSED."); } } diff --git a/test/jdk/jdk/jfr/event/os/TestCPUInformation.java b/test/jdk/jdk/jfr/event/os/TestCPUInformation.java index a4b5169ca4ab968ef4f71e5cb6d90c5edfe1efcb..c5166580010dfdebbacdd0234b23902c61b7f905 100644 --- a/test/jdk/jdk/jfr/event/os/TestCPUInformation.java +++ b/test/jdk/jdk/jfr/event/os/TestCPUInformation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 +52,8 @@ public class TestCPUInformation { Events.assertField(event, "hwThreads").atLeast(1); Events.assertField(event, "cores").atLeast(1); Events.assertField(event, "sockets").atLeast(1); - Events.assertField(event, "cpu").containsAny("Intel", "AMD", "Unknown x86", "ARM", "PPC", "PowerPC", "AArch64", "s390"); - Events.assertField(event, "description").containsAny("Intel", "AMD", "Unknown x86", "ARM", "PPC", "PowerPC", "AArch64", "s390"); + Events.assertField(event, "cpu").containsAny("Intel", "AMD", "Unknown x86", "ARM", "PPC", "PowerPC", "AArch64", "RISCV64", "s390"); + Events.assertField(event, "description").containsAny("Intel", "AMD", "Unknown x86", "ARM", "PPC", "PowerPC", "AArch64", "RISCV64", "s390"); } } } diff --git a/test/jdk/jdk/nio/zipfs/ZipFSOutputStreamTest.java b/test/jdk/jdk/nio/zipfs/ZipFSOutputStreamTest.java index 77f866e9fdfdff4bab60eacfd71f280e3bd3387e..8175eec070de3af949be9c5166cf864bd598e2eb 100644 --- a/test/jdk/jdk/nio/zipfs/ZipFSOutputStreamTest.java +++ b/test/jdk/jdk/nio/zipfs/ZipFSOutputStreamTest.java @@ -117,7 +117,7 @@ public class ZipFSOutputStreamTest { while ((numRead = is.read(buf)) != -1) { totalRead += numRead; // verify the content - Assert.assertEquals(Arrays.mismatch(buf, chunk), -1, + Assert.assertEquals(Arrays.mismatch(buf, 0, numRead, chunk, 0, numRead), -1, "Unexpected content in " + entryPath); } System.out.println("Read entry " + entryPath + " of bytes " + totalRead diff --git a/test/jdk/jdk/security/jarsigner/Properties.java b/test/jdk/jdk/security/jarsigner/Properties.java index 05c50c169797b235b5741e37c4c569bfe3601020..9de99759798cbae3e5aa948e72b3717a252f8072 100644 --- a/test/jdk/jdk/security/jarsigner/Properties.java +++ b/test/jdk/jdk/security/jarsigner/Properties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8242068 + * @bug 8242068 8267319 * @summary test the properties * @library /test/lib * @modules java.base/sun.security.tools.keytool @@ -50,6 +50,9 @@ import java.util.zip.ZipFile; public class Properties { + private static final String DEF_DIGEST_STR = + JarSigner.Builder.getDefaultDigestAlgorithm() + "-Digest-Manifest:"; + public static void main(String[] args) throws Exception { Files.writeString(Path.of("anything"), "anything"); @@ -82,12 +85,12 @@ public class Properties { // Has a hash for the whole manifest byte[] s0 = sign(jsb.setProperty("sectionsonly", "false")); sf = new String(DerUtils.innerDerValue(s0, "10210").getOctetString()); - Asserts.assertTrue(sf.contains("SHA-256-Digest-Manifest:")); + Asserts.assertTrue(sf.contains(DEF_DIGEST_STR)); // Has no hash for the whole manifest byte[] s1 = sign(jsb.setProperty("sectionsonly", "true")); sf = new String(DerUtils.innerDerValue(s1, "10210").getOctetString()); - Asserts.assertFalse(sf.contains("SHA-256-Digest-Manifest:")); + Asserts.assertFalse(sf.contains(DEF_DIGEST_STR)); } // Sign and returns the content of the PKCS7 signature block inside diff --git a/test/jdk/jdk/security/jarsigner/Spec.java b/test/jdk/jdk/security/jarsigner/Spec.java index b089f4af92994163b992c5d1e3880eb5e2654d32..0b41cc94be67d31dc9804f3efe1310b89cf76c10 100644 --- a/test/jdk/jdk/security/jarsigner/Spec.java +++ b/test/jdk/jdk/security/jarsigner/Spec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /** * @test - * @bug 8056174 8242068 8255536 + * @bug 8056174 8242068 8255536 8267319 * @summary Make sure JarSigner impl conforms to spec * @library /test/lib * @modules java.base/sun.security.tools.keytool @@ -178,14 +178,15 @@ public class Spec { assertTrue(js3.getProperty("altsigner").equals("MyContentSigner")); assertTrue(js3.getProperty("altsignerpath") == null); - assertTrue(JarSigner.Builder.getDefaultDigestAlgorithm().equals("SHA-256")); + assertTrue(JarSigner.Builder.getDefaultDigestAlgorithm() + .equals("SHA-384")); // Calculating large DSA and RSA keys are too slow. KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(1024); assertTrue(JarSigner.Builder .getDefaultSignatureAlgorithm(kpg.generateKeyPair().getPrivate()) - .equals("SHA256withRSA")); + .equals("SHA384withRSA")); kpg = KeyPairGenerator.getInstance("DSA"); kpg.initialize(1024); @@ -197,7 +198,7 @@ public class Spec { kpg.initialize(256); assertTrue(JarSigner.Builder .getDefaultSignatureAlgorithm(kpg.generateKeyPair().getPrivate()) - .equals("SHA256withECDSA")); + .equals("SHA384withECDSA")); kpg.initialize(384); assertTrue(JarSigner.Builder .getDefaultSignatureAlgorithm(kpg.generateKeyPair().getPrivate()) diff --git a/test/jdk/lib/testlibrary/java/lang/UCDFiles.java b/test/jdk/lib/testlibrary/java/lang/UCDFiles.java index 10c6243f6150f7780b5f80a5664f020b27aae0cf..83054c5c0fb05bd12c9b3fc7ae63b59d34b7e39c 100644 --- a/test/jdk/lib/testlibrary/java/lang/UCDFiles.java +++ b/test/jdk/lib/testlibrary/java/lang/UCDFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * 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,16 +23,15 @@ /** * Holds the file paths to the Unicode Character Database source files. - * Paths to the source files in the "make" directory are relative, and - * subject to change due to future repository structure re-org. + * Paths to the source files in the "data" directory are relative. */ import java.nio.file.Path; import java.nio.file.Paths; public class UCDFiles { - public static Path UCD_DIR = Paths.get( - System.getProperty("test.root"), "..", "..", "make", "data", "unicodedata"); + public static Path UCD_DIR = Paths.get(System.getProperty("test.root"), + "../../src/java.base/share/data/unicodedata"); public static Path BLOCKS = UCD_DIR.resolve("Blocks.txt"); diff --git a/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java b/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java index b7b4edc8c98061b1230aff09536f710e3fff722c..16fee912a7c29d9b6fbb8544f138a23aaf90a5fe 100644 --- a/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java +++ b/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,63 +21,79 @@ * questions. */ -import java.security.AccessControlException; -import java.security.Permission; -import java.security.Policy; -import java.security.ProtectionDomain; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.util.List; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +import static jdk.test.lib.Asserts.*; + /* * @test - * @bug 8042901 - * @summary Check permission for PlatformMBeanProvider Constructor + * @library /test/lib + * @build jdk.test.lib.Asserts + * @bug 8042901 8283092 + * @summary Check encapsulation of PlatformMBeanProvider Constructor * @modules java.management/sun.management.spi - * @author Shanliang Jiang - * @run main/othervm -Djava.security.manager=allow PlatformMBeanProviderConstructorCheck + * @run main PlatformMBeanProviderConstructorCheck */ public class PlatformMBeanProviderConstructorCheck { - public static void main(String[] args) throws Exception { - Policy origPolicy = Policy.getPolicy(); - SecurityManager origSM = System.getSecurityManager(); - try { - System.out.println("---PlatformMBeanProviderConstructorCheck starting..."); - Policy.setPolicy(new MyPolicy()); - System.setSecurityManager(new SecurityManager()); + /** + * jtreg invokes this test with module arguments that permit compilation + * of the MyProvider class, which extends PlatformMBeanProvider. + * First check we can invoke that class, then re-invoke ourself without + * those module arguments, and expect a failure calling MyProvider. + */ + public static void main(String[] args) throws Exception { + System.out.println("---PlatformMBeanProviderConstructorCheck:"); + boolean expectedFail = false; - System.out.println("---PlatformMBeanProviderConstructorCheck Testing without permission..."); - try { - new MyProvider(); - throw new RuntimeException("Does not get expected AccessControlException!"); - } catch (AccessControlException ace) { - System.out.println("---PlatformMBeanProviderConstructorCheck got the expected exception: " - + ace); + // Recognise argument to signify we were re-invoked, and MyProvider should fail: + if (args.length == 1) { + if (args[0].equals("--nomoduleargs")) { + expectedFail = true; + verifyNoModuleArguments(); + } else { + throw new RuntimeException("unknown argument: '" + args[0] + "'"); } - - System.out.println("---PlatformMBeanProviderConstructorCheck Testing with permission..."); - MyPolicy.allowed = true; + } + System.out.println("---PlatformMBeanProviderConstructorCheck: invoke MyProvider with expectedFail = " + expectedFail); + Throwable e = null; + try { new MyProvider(); - - System.out.println("---PlatformMBeanProviderConstructorCheck PASSED!"); - } finally { - System.setSecurityManager(origSM); - Policy.setPolicy(origPolicy); + } catch (IllegalAccessError iae) { + System.out.println("---PlatformMBeanProviderConstructorCheck got exception: " + iae); + e = iae; } - } - private static class MyPolicy extends Policy { - private static String permName = "sun.management.spi.PlatformMBeanProvider.subclass"; - private static boolean allowed = false; + if (!expectedFail) { + // This was the first invocation, should have worked OK: + assertNull(e); + System.out.println("---PlatformMBeanProviderConstructorCheck PASSED (1) (expectedFail = " + expectedFail + ")"); - @Override - public boolean implies(ProtectionDomain domain, Permission permission) { - if (permName.equals(permission.getName())) { - System.out.println("---MyPolicy-implies checks permission for " - +permName+" and returns "+allowed); + // Re-invoke this test to check failure: + System.out.println("---PlatformMBeanProviderConstructorCheck: re-invoke without --add-modules or --add-exports"); + OutputAnalyzer output = ProcessTools.executeTestJava("PlatformMBeanProviderConstructorCheck", "--nomoduleargs"); + output.reportDiagnosticSummary(); + output.shouldContain("java.lang.IllegalAccessError: superclass access check failed:"); + output.shouldContain(" module java.management does not export sun.management.spi to "); + output.shouldNotContain("MyProvider constructor."); + } else { + // This was the re-invocation without module access, should fail: + assertNotNull(e); + System.out.println("---PlatformMBeanProviderConstructorCheck PASSED (2) (expectedFail = " + expectedFail + ")"); + } + } - return allowed; - } else { - return true; + private static void verifyNoModuleArguments() { + RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean(); + for (String s : mxbean.getInputArguments()) { + if (s.startsWith("--add-modules") || s.startsWith("--add-exports")) { + System.out.println("arg: " + s); + throw new RuntimeException("argument list contains: " + s); } } } @@ -85,6 +101,7 @@ public class PlatformMBeanProviderConstructorCheck { private static class MyProvider extends sun.management.spi.PlatformMBeanProvider { @Override public List> getPlatformComponentList() { + System.out.println("MyProvider constructor."); return null; } } diff --git a/test/jdk/sun/net/www/http/HttpURLConnection/DigestAuth.java b/test/jdk/sun/net/www/http/HttpURLConnection/DigestAuth.java index 597748662c5cb692decd84c2fec214216b31f8af..15c729b4f7f9f019a63c4ae92697c70d6a52d1cb 100644 --- a/test/jdk/sun/net/www/http/HttpURLConnection/DigestAuth.java +++ b/test/jdk/sun/net/www/http/HttpURLConnection/DigestAuth.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * 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 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; + import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; @@ -34,24 +35,51 @@ import java.net.InetSocketAddress; import java.net.PasswordAuthentication; import java.net.URL; import java.net.URLConnection; +import java.net.HttpURLConnection; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.nio.charset.StandardCharsets; import java.util.List; +import java.util.Map; +import java.util.logging.ConsoleHandler; +import java.util.logging.Handler; +import java.util.logging.Level; + +import static java.util.Map.entry; /* * @test - * @bug 8138990 + * @bug 8138990 8281561 * @summary Tests for HTTP Digest auth * The impl maintains a cache for auth info, * the testcases run in a separate JVM to avoid cache hits * @modules jdk.httpserver - * @run main/othervm DigestAuth good - * @run main/othervm DigestAuth only_nonce - * @run main/othervm DigestAuth sha1 - * @run main/othervm DigestAuth no_header - * @run main/othervm DigestAuth no_nonce - * @run main/othervm DigestAuth no_qop - * @run main/othervm DigestAuth invalid_alg - * @run main/othervm DigestAuth validate_server - * @run main/othervm DigestAuth validate_server_no_qop + * @run main/othervm DigestAuth bad + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth good + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth only_nonce + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=SHA-1 DigestAuth sha1-good + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth sha1-bad + * @run main/othervm DigestAuth sha256 + * @run main/othervm DigestAuth sha512 + * @run main/othervm DigestAuth sha256-userhash + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth sha256 + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth no_header + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth no_nonce + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth no_qop + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth invalid_alg + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth validate_server + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 DigestAuth validate_server_no_qop + */ + +/* + * The sha512-256-userhash case must be run manually. It needs to run with sudo as the + * test must bind to port 80. You also need a modified JDK where + * sun.net.www.protocol.http.DigestAuthentication.getCnonce + * returns the hardcoded cnonce value below (normally it is chosen at random) + * "NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v" + * It can be run from the command line directly as follows: + * sudo java -Djdk.net.hosts.file=hosts DigestAuth sha512-256-userhash port80 + * assuming you are running in the test source directory */ public class DigestAuth { @@ -88,6 +116,28 @@ public class DigestAuth { + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " + "algorithm=\"SHA1\""; + static final String WWW_AUTH_HEADER_SHA256 = "Digest " + + "nonce=\"a69ae8a2e17c219bc6c118b673e93601616a6a" + + "4d8fde3a19996748d77ad0464b\", qop=\"auth\", " + + "opaque=\"efc62777cff802cb29252f626b041f381cd360" + + "7187115871ca25e7b51a3757e9\", algorithm=SHA-256"; + + static final String WWW_AUTH_HEADER_SHA512 = "Digest " + + "nonce=\"9aaa8d3ae53b54ce653a5d52d895afcd9c0e430" + + "a17bdf98bb34235af84fba268d31376a63e0c39079b519" + + "c14baa0429754266f35b62a47b9c8b5d3d36c638282\"," + + " qop=\"auth\", opaque=\"28cdc6bae6c5dd7ec89dbf" + + "af4d4f26b70f41ebbb83dc7af0950d6de016c40f412224" + + "676cd45ebcf889a70e65a2b055a8b5232e50281272ba7c" + + "67628cc3bb3492\", algorithm=SHA-512"; + + static final String WWW_AUTH_HEADER_SHA_256_UHASH = "Digest " + + "realm=\"testrealm@host.com\", " + + "qop=\"auth\", algorithm=SHA-256," + + "nonce=\"5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC" + + "/RVvkK\", opaque=\"HRPCssKJSGjCrkzDg8OhwpzCiGP" + + "ChXYjwrI2QmXDnsOS\", charset=UTF-8, userhash=true"; + static final String WWW_AUTH_HEADER_INVALID_ALGORITHM = "Digest " + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " + "algorithm=\"SHA123\""; @@ -106,23 +156,77 @@ public class DigestAuth { + "nc=00000001, " + "qop=auth"; + // These two must be run manually with a modified JDK + // that generates the exact cnonce given below. + static final String SHA_512_256_FIRST = "Digest " + + "realm=\"api@example.org\", " + + "qop=\"auth\", " + + "algorithm=SHA-512-256, " + + "nonce=\"5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK\", " + + "opaque=\"HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS\", " + + "charset=UTF-8, " + + "userhash=true "; + + // Below taken from corrected version of RFC 7616 + static final Map SHA_512_256_EXPECTED = + Map.ofEntries( + entry("username", "793263caabb707a56211940d90411ea4a575adeccb" + + "7e360aeb624ed06ece9b0b"), + entry("realm", "api@example.org"), + entry("uri", "/doe.json"), + entry("algorithm", "SHA-512-256"), + entry("nonce", "5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK"), + entry("nc", "00000001"), + entry("cnonce", "NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v"), + entry("qop", "auth"), + entry("response", "3798d4131c277846293534c3edc11bd8a5e4cdcbff78" + + "b05db9d95eeb1cec68a5"), + entry("opaque", "HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS"), + entry("userhash", "true")); + public static void main(String[] args) throws Exception { if (args.length == 0) { throw new RuntimeException("No testcase specified"); } String testcase = args[0]; + System.out.println("Running test: " + testcase); + boolean usePort80 = args.length > 1 && args[1].equals("port80"); // start a local HTTP server - try (LocalHttpServer server = LocalHttpServer.startServer()) { + try (LocalHttpServer server = LocalHttpServer.startServer(usePort80)) { // set authenticator AuthenticatorImpl auth = new AuthenticatorImpl(); - Authenticator.setDefault(auth); String url = String.format("http://%s/test/", server.getAuthority()); boolean success = true; switch (testcase) { + case "sha512-256-userhash": + auth = new AuthenticatorImpl("J\u00e4s\u00f8n Doe", "Secret, or not?"); + // file based name service must be used so domain + // below resolves to localhost + if (usePort80) { + url = "http://api.example.org/doe.json"; + } else { + url = "http://api.example.org:" + server.getPort() + "/doe.json"; + } + server.setWWWAuthHeader(SHA_512_256_FIRST); + server.setExpectedRequestParams(SHA_512_256_EXPECTED); + success = testAuth(url, auth, EXPECT_DIGEST); + break; + case "bad": + // server returns a good WWW-Authenticate header with MD5 + // but MD5 is disallowed by default + server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER); + success = testAuth(url, auth, EXPECT_FAILURE); + if (auth.lastRequestedPrompt == null || + !auth.lastRequestedPrompt.equals(REALM)) { + System.out.println("Unexpected realm: " + + auth.lastRequestedPrompt); + success = false; + } + break; case "good": // server returns a good WWW-Authenticate header server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER); @@ -201,11 +305,36 @@ public class DigestAuth { success = false; } break; - case "sha1": + case "sha1-good": // server returns a good WWW-Authenticate header with SHA-1 server.setWWWAuthHeader(WWW_AUTH_HEADER_SHA1); success = testAuth(url, auth, EXPECT_DIGEST); break; + case "sha1-bad": + // server returns a WWW-Authenticate header with SHA-1 + // but SHA-1 disabled + server.setWWWAuthHeader(WWW_AUTH_HEADER_SHA1); + success = testAuth(url, auth, EXPECT_FAILURE); + break; + case "sha256": + // server returns a good WWW-Authenticate header with SHA-256 + server.setWWWAuthHeader(WWW_AUTH_HEADER_SHA256); + success = testAuth(url, auth, EXPECT_DIGEST); + break; + case "sha512": + // server returns a good WWW-Authenticate header with SHA-512 + server.setWWWAuthHeader(WWW_AUTH_HEADER_SHA512); + success = testAuth(url, auth, EXPECT_DIGEST); + break; + case "sha256-userhash": + // server returns a good WWW-Authenticate header with SHA-256 + // also sets the userhash=true parameter + server.setWWWAuthHeader(WWW_AUTH_HEADER_SHA_256_UHASH); + success = testAuth(url, auth, EXPECT_DIGEST); + // make sure the userhash parameter was set correctly + // and the username itself is the correct hash + server.checkUserHash(getUserHash("SHA-256", "Mufasa", REALM)); + break; case "no_header": // server returns no WWW-Authenticate header success = testAuth(url, auth, EXPECT_FAILURE); @@ -251,7 +380,7 @@ public class DigestAuth { try { System.out.printf("Connect to %s, expected auth scheme is '%s'%n", url, expectedScheme); - load(url); + load(url, auth); if (expectedScheme == null) { System.out.println("Unexpected successful connection"); @@ -276,8 +405,9 @@ public class DigestAuth { return true; } - static void load(String url) throws IOException { - URLConnection conn = new URL(url).openConnection(); + static void load(String url, Authenticator auth) throws IOException { + HttpURLConnection conn = (HttpURLConnection)(new URL(url).openConnection()); + conn.setAuthenticator(auth); conn.setUseCaches(false); try (BufferedReader reader = new BufferedReader( new InputStreamReader(conn.getInputStream()))) { @@ -292,20 +422,47 @@ public class DigestAuth { } } + public static String getUserHash(String alg, String user, String realm) { + try { + MessageDigest md = MessageDigest.getInstance(alg); + String msg = user + ":" + realm; + //String msg = "Mufasa:testrealm@host.com"; + byte[] output = md.digest(msg.getBytes(StandardCharsets.ISO_8859_1)); + StringBuilder sb = new StringBuilder(); + for (int i=0; i>> 4); + sb.append(s2).append(s1); + } + return sb.toString(); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + private static class AuthenticatorImpl extends Authenticator { private String lastRequestedScheme; private String lastRequestedPrompt; + private final String user, pass; + + AuthenticatorImpl() { + this("Mufasa", "Circle Of Life"); + } + + AuthenticatorImpl(String user, String pass) { + this.user = user; + this.pass = pass; + } + @Override public PasswordAuthentication getPasswordAuthentication() { lastRequestedScheme = getRequestingScheme(); lastRequestedPrompt = getRequestingPrompt(); System.out.println("AuthenticatorImpl: requested " + lastRequestedScheme); - - return new PasswordAuthentication("Mufasa", - "Circle Of Life".toCharArray()); + return new PasswordAuthentication(user, pass.toCharArray()); } } @@ -316,6 +473,9 @@ public class DigestAuth { private volatile String wwwAuthHeader = null; private volatile String authInfoHeader = null; private volatile String lastRequestedNonce; + private volatile String lastRequestedUser; + private volatile String lastRequestedUserhash; + private volatile Map expectedParams; private LocalHttpServer(HttpServer server) { this.server = server; @@ -335,14 +495,49 @@ public class DigestAuth { this.wwwAuthHeader = wwwAuthHeader; } + void setExpectedRequestParams(Map params) { + this.expectedParams = params; + } + void setAuthInfoHeader(String authInfoHeader) { this.authInfoHeader = authInfoHeader; } - static LocalHttpServer startServer() throws IOException { + void checkUserHash(String expectedUser) { + boolean pass = true; + if (!expectedUser.equals(lastRequestedUser)) { + System.out.println("Username mismatch:"); + System.out.println("Expected: " + expectedUser); + System.out.println("Received: " + lastRequestedUser); + pass = false; + } + if (!lastRequestedUserhash.equalsIgnoreCase("true")) { + System.out.println("Userhash mismatch:"); + pass = false; + } + if (!pass) { + throw new RuntimeException("Test failed: checkUserHash"); + } + } + + void checkExpectedParams(String header) { + if (expectedParams == null) + return; + expectedParams.forEach((name, value) -> { + String rxValue = findParameter(header, name); + if (!rxValue.equalsIgnoreCase(value)) { + throw new RuntimeException("value mismatch " + + "name = " + name + " (" + rxValue + "/" + + value + ")"); + } + }); + } + + static LocalHttpServer startServer(boolean usePort80) throws IOException { + int port = usePort80 ? 80 : 0; InetAddress loopback = InetAddress.getLoopbackAddress(); HttpServer httpServer = HttpServer.create( - new InetSocketAddress(loopback, 0), 0); + new InetSocketAddress(loopback, port), 0); LocalHttpServer localHttpServer = new LocalHttpServer(httpServer); localHttpServer.start(); @@ -351,6 +546,7 @@ public class DigestAuth { void start() { server.createContext("/test", this); + server.createContext("/", this); server.start(); System.out.println("HttpServer: started on port " + getAuthority()); } @@ -385,7 +581,10 @@ public class DigestAuth { t.getResponseHeaders().add("Authentication-Info", authInfoHeader); } + checkExpectedParams(header); lastRequestedNonce = findParameter(header, "nonce"); + lastRequestedUser = findParameter(header, "username"); + lastRequestedUserhash = findParameter(header, "userhash"); byte[] output = "hello".getBytes(); t.sendResponseHeaders(200, output.length); t.getResponseBody().write(output); diff --git a/test/jdk/sun/net/www/http/HttpURLConnection/hosts b/test/jdk/sun/net/www/http/HttpURLConnection/hosts new file mode 100644 index 0000000000000000000000000000000000000000..e2729d2e04f9a130565d9362847b1e7372cbddda --- /dev/null +++ b/test/jdk/sun/net/www/http/HttpURLConnection/hosts @@ -0,0 +1 @@ +127.0.0.1 api.example.org diff --git a/test/jdk/sun/net/www/protocol/http/DigestTest.java b/test/jdk/sun/net/www/protocol/http/DigestTest.java index b699c3ff47621bac1abf88fd46af25cabddf0df4..5632a021123f6a5aea3ccd2891d8bebbd63d79ee 100644 --- a/test/jdk/sun/net/www/protocol/http/DigestTest.java +++ b/test/jdk/sun/net/www/protocol/http/DigestTest.java @@ -25,14 +25,18 @@ * @test * @bug 4432213 * @modules java.base/sun.net.www - * @run main/othervm -Dhttp.auth.digest.validateServer=true DigestTest - * @run main/othervm -Djava.net.preferIPv6Addresses=true + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 * -Dhttp.auth.digest.validateServer=true DigestTest - * @run main/othervm -Dhttp.auth.digest.validateServer=true - -Dtest.succeed=true DigestTest - * @run main/othervm -Djava.net.preferIPv6Addresses=true + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Djava.net.preferIPv6Addresses=true + * -Dhttp.auth.digest.validateServer=true DigestTest + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Dhttp.auth.digest.validateServer=true + * -Dtest.succeed=true DigestTest + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Djava.net.preferIPv6Addresses=true * -Dhttp.auth.digest.validateServer=true - -Dtest.succeed=true DigestTest + * -Dtest.succeed=true DigestTest * @summary Need to support Digest Authentication for Proxies */ diff --git a/test/jdk/sun/net/www/protocol/http/NoNTLM.java b/test/jdk/sun/net/www/protocol/http/NoNTLM.java index 1ae7af670bf71c5983a81c59ae9c8177217074ff..6cca7db5c4cd0ac452d4db8c051e2f5774af403f 100644 --- a/test/jdk/sun/net/www/protocol/http/NoNTLM.java +++ b/test/jdk/sun/net/www/protocol/http/NoNTLM.java @@ -27,8 +27,9 @@ * @summary Sanity check that NTLM will not be selected by the http protocol * handler when running on a profile that does not support NTLM * @modules java.base/sun.net.www.protocol.http:open - * @run main/othervm NoNTLM - * @run main/othervm -Djava.net.preferIPv6Addresses=true NoNTLM + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 NoNTLM + * @run main/othervm -Dhttp.auth.digest.reEnabledAlgorithms=MD5 + * -Djava.net.preferIPv6Addresses=true NoNTLM */ import java.io.IOException; diff --git a/test/jdk/sun/nio/cs/TestCharsetMapping.java b/test/jdk/sun/nio/cs/TestCharsetMapping.java index 63eeba1774e56009f2e4a811e04990cfc8d296d4..c7bd101aa425a91d69643a859e70982cf87adf7f 100644 --- a/test/jdk/sun/nio/cs/TestCharsetMapping.java +++ b/test/jdk/sun/nio/cs/TestCharsetMapping.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -569,7 +569,7 @@ public class TestCharsetMapping { public static void main(String args[]) throws Exception { Path dir = Paths.get(System.getProperty("test.src", ".") + - "/../../../../make/data/charsetmapping"); + "/../../../../src/java.base/share/data/charsetmapping"); if (!Files.exists(dir)) { // not inside jdk repo, no mappings, exit silently log.println("Nothing done, not in a jdk repo: "); diff --git a/test/jdk/sun/nio/cs/TestMS950.java b/test/jdk/sun/nio/cs/TestMS950.java index 6d567e077519cd0de790850de8366a2fc10f4f5a..36820f381a04f6efe6052d2d730c9fc59e05ca85 100644 --- a/test/jdk/sun/nio/cs/TestMS950.java +++ b/test/jdk/sun/nio/cs/TestMS950.java @@ -33,7 +33,7 @@ import java.nio.ByteBuffer; import java.util.Arrays; public class TestMS950 { - // Data is listed from make/data/charsetmapping/MS950.map + // Data is listed from src/java.base/share/data/charsetmapping/MS950.map private final static String[] MS950B2C = new String[] { "0xF9FA 0x256D", "0xF9FB 0x256E", diff --git a/test/jdk/sun/security/krb5/auto/HttpsCB.java b/test/jdk/sun/security/krb5/auto/HttpsCB.java index a65aa5d024117be0563b90dbd08022ce7dfe1998..1f9f0de33aca6ddf9bf44a27f915375672a0c288 100644 --- a/test/jdk/sun/security/krb5/auto/HttpsCB.java +++ b/test/jdk/sun/security/krb5/auto/HttpsCB.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8279842 + * @bug 8279842 8282293 * @modules java.base/sun.security.util * java.security.jgss/sun.security.jgss * java.security.jgss/sun.security.jgss.krb5 @@ -52,7 +52,13 @@ * @run main/othervm -Djdk.net.hosts.file=TestHosts * -Djdk.https.negotiate.cbt=domain:host.web.domain HttpsCB true true * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djdk.https.negotiate.cbt=domain:HOST.WEB.DOMAIN HttpsCB true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts * -Djdk.https.negotiate.cbt=domain:*.web.domain HttpsCB true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djdk.https.negotiate.cbt=domain:*.WEB.Domain HttpsCB true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djdk.https.negotiate.cbt=domain:*.Invalid,*.WEB.Domain HttpsCB true true */ import com.sun.net.httpserver.Headers; @@ -198,6 +204,7 @@ public class HttpsCB { conn.getInputStream())); return reader.readLine().equals(CONTENT); } catch (IOException e) { + e.printStackTrace(System.out); return false; } } diff --git a/test/jdk/sun/security/lib/CheckBlockedCerts.java b/test/jdk/sun/security/lib/CheckBlockedCerts.java index e5561bf15b82898721fde7f637473e7b723a6d99..5afbf4b610b9f58cb9f52422e1e1d3280a933391 100644 --- a/test/jdk/sun/security/lib/CheckBlockedCerts.java +++ b/test/jdk/sun/security/lib/CheckBlockedCerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ public class CheckBlockedCerts { // Assumes the full src is available File blockedCertsFile = new File(System.getProperty("test.src"), - "../../../../../make/data/blockedcertsconverter/blocked.certs.pem"); + "../../../../../src/java.base/share/data/blockedcertsconverter/blocked.certs.pem"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); try (FileInputStream fis = new FileInputStream(blockedCertsFile)) { diff --git a/test/jdk/sun/security/pkcs11/KeyGenerator/TestAES.java b/test/jdk/sun/security/pkcs11/KeyGenerator/TestAES.java new file mode 100644 index 0000000000000000000000000000000000000000..e74007a65e3f4c09faab3ef3c663ae220e54b356 --- /dev/null +++ b/test/jdk/sun/security/pkcs11/KeyGenerator/TestAES.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8267319 + * @modules java.base/sun.security.util + * jdk.crypto.cryptoki + * @summary Check AES key generator. + * @library /test/lib .. + * @run main TestAES + */ +import java.security.Provider; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidParameterException; +import java.security.NoSuchAlgorithmException; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import static sun.security.util.SecurityProviderConstants.*; + +public class TestAES extends PKCS11Test { + + private static final String ALGO = "AES"; + + public static void main(String[] args) throws Exception { + main(new TestAES(), args); + } + + @Override + public void main(Provider p) throws Exception { + System.out.println("Testing " + p.getName()); + KeyGenerator kg; + try { + kg = KeyGenerator.getInstance(ALGO, p); + } catch (NoSuchAlgorithmException nsae) { + System.out.println("Skip; no support for " + ALGO); + return; + } + + // first try w/o setting a key length and check if the generated key + // length matches + SecretKey key = kg.generateKey(); + byte[] keyValue = key.getEncoded(); + if (key.getEncoded().length != getDefAESKeySize() >> 3) { + throw new RuntimeException("Default AES key length should be " + + getDefAESKeySize()); + } + + for (int keySize : new int[] { 16, 32, 64, 128, 256, 512, 1024 }) { + boolean isValid = (keySize == 128 || keySize == 192 || + keySize == 256); + try { + kg.init(keySize); + if (!isValid) { + throw new RuntimeException(keySize + " is invalid keysize"); + } + key = kg.generateKey(); + if (key.getEncoded().length != keySize >> 3) { + throw new RuntimeException("Generated key len mismatch!"); + } + } catch (InvalidParameterException e) { + if (isValid) { + throw new RuntimeException("IPE thrown for valid keySize"); + } else { + System.out.println("Expected IPE thrown for " + keySize); + } + } + } + } +} diff --git a/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDefaultSize.java b/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDefaultSize.java new file mode 100644 index 0000000000000000000000000000000000000000..a359ff7a13c703c86b09c399c19b9304fa04b8dd --- /dev/null +++ b/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDefaultSize.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8267319 + * @summary Ensure that DSA/RSA/DH/EC KPG in PKCS11 provider uses the + * same default key length + * @library /test/lib .. + * @modules java.base/sun.security.util + * jdk.crypto.cryptoki + * @run main TestDefaultSize + */ + +import java.security.InvalidParameterException; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.Provider; +import java.security.PrivateKey; +import java.security.interfaces.*; +import javax.crypto.interfaces.DHKey; + +import static sun.security.util.SecurityProviderConstants.*; + +public class TestDefaultSize extends PKCS11Test { + + @Override + public void main(Provider p) throws Exception { + System.out.println("Testing " + p.getName()); + + String[] ALGOS = { "DSA", "RSA", "DH", "EC" }; + + for (String algo : ALGOS) { + if (p.getService("KeyPairGenerator", algo) == null) { + System.out.println("Skip, no support for KPG: " + algo); + return; + } + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(algo, p); + KeyPair kp = kpg.generateKeyPair(); + PrivateKey priv = kp.getPrivate(); + int actualSize = -1; + int expectedSize; + if (algo == "DSA") { + expectedSize = DEF_DSA_KEY_SIZE; + if (priv instanceof DSAKey) { + actualSize = ((DSAKey) priv).getParams().getP().bitLength(); + } + } else if (algo == "RSA") { + expectedSize = DEF_RSA_KEY_SIZE; + if (priv instanceof RSAKey) { + actualSize = ((RSAKey) priv).getModulus().bitLength(); + } + } else if (algo == "DH") { + expectedSize = DEF_DH_KEY_SIZE; + if (priv instanceof DHKey) { + actualSize = ((DHKey) priv).getParams().getP().bitLength(); + } + } else if (algo == "EC") { + expectedSize = DEF_EC_KEY_SIZE; + if (priv instanceof ECKey) { + actualSize = ((ECKey) priv).getParams().getCurve() + .getField().getFieldSize(); + } + } else { + throw new RuntimeException("Error: Unrecognized algo " + + algo + " or opaque private key object " + priv); + } + if (actualSize != expectedSize) { + throw new RuntimeException("key size check failed, got " + + actualSize); + } else { + System.out.println(algo + ": passed, " + actualSize); + } + } + } + + public static void main(String[] args) throws Exception { + main(new TestDefaultSize(), args); + } +} diff --git a/test/jdk/sun/security/pkcs11/nss/db/cert9.db b/test/jdk/sun/security/pkcs11/nss/db/cert9.db new file mode 100644 index 0000000000000000000000000000000000000000..a202bea21e99c8063fdce58c3fedff9c29bcc306 Binary files /dev/null and b/test/jdk/sun/security/pkcs11/nss/db/cert9.db differ diff --git a/test/jdk/sun/security/pkcs11/nss/db/key4.db b/test/jdk/sun/security/pkcs11/nss/db/key4.db new file mode 100644 index 0000000000000000000000000000000000000000..222adb32286ad793715fbbce368af63e54ba48f5 Binary files /dev/null and b/test/jdk/sun/security/pkcs11/nss/db/key4.db differ diff --git a/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java b/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4DesEdeCiphSuite.java similarity index 92% rename from test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java rename to test/jdk/sun/security/ssl/CipherSuite/NoDesRC4DesEdeCiphSuite.java index 22238d38e1d5ff05b20e8b5e9b463f258daa7760..c9861324237c16e333b9ce912d79a7ddf6ee3359 100644 --- a/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java +++ b/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4DesEdeCiphSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. * 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,9 +23,9 @@ /* * @test - * @bug 8208350 - * @summary Disable all DES cipher suites - * @run main/othervm NoDesRC4CiphSuite + * @bug 8208350 8163327 + * @summary Disable all DES, RC4, and 3DES/DesEde cipher suites + * @run main/othervm NoDesRC4DesEdeCiphSuite */ /* @@ -43,7 +43,7 @@ import java.util.List; import java.util.ArrayList; import java.util.Arrays; -public class NoDesRC4CiphSuite { +public class NoDesRC4DesEdeCiphSuite { private static final boolean DEBUG = false; @@ -80,6 +80,18 @@ public class NoDesRC4CiphSuite { "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5" }; + private static final List DESEDE_CS_LIST = Arrays.asList( + 0xC008, 0xC012, 0x0016, 0x0013, 0xC003, 0xC00D, 0x000A + ); + private static final String[] DESEDE_CS_LIST_NAMES = new String[] { + "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_RSA_WITH_3DES_EDE_CBC_SHA" + }; private static final ByteBuffer CLIOUTBUF = ByteBuffer.wrap("Client Side".getBytes()); @@ -99,6 +111,11 @@ public class NoDesRC4CiphSuite { allGood &= testEngAddDisabled(RC4_CS_LIST_NAMES, RC4_CS_LIST); allGood &= testEngOnlyDisabled(RC4_CS_LIST_NAMES); + // Disabled 3DES tests + allGood &= testDefaultCase(DESEDE_CS_LIST); + allGood &= testEngAddDisabled(DESEDE_CS_LIST_NAMES, DESEDE_CS_LIST); + allGood &= testEngOnlyDisabled(DESEDE_CS_LIST_NAMES); + if (allGood) { System.err.println("All tests passed"); } else { diff --git a/test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java b/test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java index d0a4338fee3b2d1f0299f21ce9c13725403251db..9f96511182e8117fa55837f1d9ab896ee8af4f3c 100644 --- a/test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java +++ b/test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8277474 + * @bug 8277474 8283665 * @summary jarsigner -verify should check if the algorithm parameters of * its signature algorithm use disabled or legacy algorithms * @library /test/lib @@ -56,29 +56,29 @@ public class CheckAlgParams { .shouldHaveExitValue(0); Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), - "jdk.jar.disabledAlgorithms=SHA256\n" + + "jdk.jar.disabledAlgorithms=SHA384\n" + "jdk.security.legacyAlgorithms=\n"); SecurityTools.jarsigner("-verify signeda.jar " + "-J-Djava.security.properties=" + JAVA_SECURITY_FILE + " -keystore ks -storepass changeit -verbose -debug") - .shouldMatch("Digest algorithm: SHA-256.*(disabled)") - .shouldMatch("Signature algorithm: RSASSA-PSS using PSSParameterSpec.*hashAlgorithm=SHA-256.*(disabled)") + .shouldMatch("Digest algorithm: SHA-384.*(disabled)") + .shouldMatch("Signature algorithm: RSASSA-PSS using PSSParameterSpec.*hashAlgorithm=SHA-384.*(disabled)") .shouldContain("The jar will be treated as unsigned") .shouldHaveExitValue(0); Files.deleteIfExists(Paths.get(JAVA_SECURITY_FILE)); Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), "jdk.jar.disabledAlgorithms=\n" + - "jdk.security.legacyAlgorithms=SHA256\n"); + "jdk.security.legacyAlgorithms=SHA384\n"); SecurityTools.jarsigner("-verify signeda.jar " + "-J-Djava.security.properties=" + JAVA_SECURITY_FILE + " -keystore ks -storepass changeit -verbose -debug") - .shouldMatch("Digest algorithm: SHA-256.*(weak)") - .shouldMatch("Signature algorithm: RSASSA-PSS using PSSParameterSpec.*hashAlgorithm=SHA-256.*(weak)") + .shouldMatch("Digest algorithm: SHA-384.*(weak)") + .shouldMatch("Signature algorithm: RSASSA-PSS using PSSParameterSpec.*hashAlgorithm=SHA-384.*(weak)") .shouldNotContain("The jar will be treated as unsigned") .shouldHaveExitValue(0); } diff --git a/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java b/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java index 8465f36261ba6bf4e97b3be2cfd25c6fa25a9d0b..da409612efee76672d5980f83aa49a581c1c1ded 100644 --- a/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java +++ b/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8259401 8266225 + * @bug 8259401 8266225 8267319 * @summary Check certificates in signer's cert chain to see if warning emitted * @library /test/lib */ @@ -40,6 +40,8 @@ public class CheckSignerCertChain { private static final String JAVA_SECURITY_FILE = "java.security"; + private static final String keysizeOpt = "-keysize 2048"; + static OutputAnalyzer kt(String cmd, String ks) throws Exception { return SecurityTools.keytool("-storepass changeit " + cmd + " -keystore " + ks); @@ -57,8 +59,11 @@ public class CheckSignerCertChain { System.out.println("Generating a root cert using SHA1withRSA and 1024-bit key"); kt("-genkeypair -keyalg rsa -alias ca -dname CN=CA -ext bc:c " + "-keysize 1024 -sigalg SHA1withRSA", "ks"); - kt("-genkeypair -keyalg rsa -alias ca1 -dname CN=CA1", "ks"); - kt("-genkeypair -keyalg rsa -alias e1 -dname CN=E1", "ks"); + + kt("-genkeypair -keyalg rsa -alias ca1 -dname CN=CA1 " + keysizeOpt, + "ks"); + kt("-genkeypair -keyalg rsa -alias e1 -dname CN=E1 " + keysizeOpt, + "ks"); // intermediate certificate using SHA1withRSA and 2048-bit key System.out.println("Generating an intermediate cert using SHA1withRSA and 2048-bit key"); @@ -97,8 +102,10 @@ public class CheckSignerCertChain { * Generate a non-self-signed certificate using MD5withRSA as its signature * algorithm to sign a JAR file. */ - kt("-genkeypair -keyalg rsa -alias cacert -dname CN=CACERT -ext bc:c ", "ks"); - kt("-genkeypair -keyalg rsa -alias ee -dname CN=EE -ext bc:c ", "ks"); + kt("-genkeypair -keyalg rsa -alias cacert -dname CN=CACERT -ext bc:c " + + keysizeOpt, "ks"); + kt("-genkeypair -keyalg rsa -alias ee -dname CN=EE -ext bc:c " + + keysizeOpt, "ks"); gencert("ee", "-alias cacert -ext san=dns:ee -sigalg MD5withRSA"); Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), @@ -112,7 +119,7 @@ public class CheckSignerCertChain { JAVA_SECURITY_FILE + " a.jar ee") .shouldNotContain("Signature algorithm: MD5withRSA (disabled), 2048-bit key") - .shouldContain("Signature algorithm: SHA256withRSA, 2048-bit key") + .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit key") .shouldNotContain("Invalid certificate chain: Algorithm constraints check failed on signature algorithm: MD5withRSA") .shouldHaveExitValue(0); @@ -128,7 +135,7 @@ public class CheckSignerCertChain { JAVA_SECURITY_FILE + " a.jar ee") .shouldContain("Signature algorithm: MD5withRSA (disabled), 2048-bit key") - .shouldContain("Signature algorithm: SHA256withRSA, 2048-bit key") + .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit key") .shouldContain("Invalid certificate chain: Algorithm constraints check failed on disabled algorithm: MD5 used with certificate: CN=EE") .shouldHaveExitValue(0); @@ -138,7 +145,7 @@ public class CheckSignerCertChain { SecurityTools.jarsigner("-verify -certs signeda.jar " + "-keystore caks1 -storepass changeit -verbose -debug") .shouldContain("Signature algorithm: MD5withRSA (disabled), 2048-bit key") - .shouldContain("Signature algorithm: SHA256withRSA, 2048-bit key") + .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit key") .shouldContain("Invalid certificate chain: Algorithm constraints check failed on disabled algorithm: MD5 used with certificate: CN=EE") .shouldHaveExitValue(0); } diff --git a/test/jdk/sun/security/tools/jarsigner/DefaultSigalg.java b/test/jdk/sun/security/tools/jarsigner/DefaultSigalg.java index 1d8919934d539db180b73dd15f34ac59497973b9..6880a95a50372ee54f413ab7d5cfa8998012860c 100644 --- a/test/jdk/sun/security/tools/jarsigner/DefaultSigalg.java +++ b/test/jdk/sun/security/tools/jarsigner/DefaultSigalg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 +23,8 @@ /** * @test - * @bug 8057810 - * @summary New defaults for DSA keys in jarsigner and keytool + * @bug 8057810 8267319 + * @summary New defaults for DSA, RSA, EC keys in jarsigner and keytool * @modules java.base/sun.security.pkcs * java.base/sun.security.tools.keytool * java.base/sun.security.util @@ -42,20 +42,22 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.security.KeyStore; import java.security.cert.X509Certificate; -import java.util.jar.JarFile; +import java.util.jar.*; +import java.util.Enumeration; public class DefaultSigalg { public static void main(String[] args) throws Exception { // Three test cases - String[] keyalgs = {"DSA", "RSA", "EC"}; + String[] keyalgs = {"DSA", "RSA", "EC", "RSASSA-PSS"}; // Expected default keytool sigalg - String[] sigalgs = {"SHA256withDSA", "SHA256withRSA", "SHA256withECDSA"}; + String[] sigalgs = {"SHA256withDSA", "SHA384withRSA", + "SHA384withECDSA", "RSASSA-PSS"}; // Expected keysizes - int[] keysizes = {2048, 2048, 256}; + int[] keysizes = {2048, 3072, 384, 3072}; // Expected jarsigner digest alg used in signature - String[] digestalgs = {"SHA-256", "SHA-256", "SHA-256"}; + String[] digestalgs = {"SHA-256", "SHA-384", "SHA-384", "SHA-384"}; // Create a jar file sun.tools.jar.Main m = @@ -96,7 +98,20 @@ public class DefaultSigalg { "keytool keysize for " + keyalg + " is " + keysize); } // jarsigner - String bk = "META-INF/" + keyalg + "." + keyalg; + // truncated to the first 8 chars if alias name is longer + String jeName = (keyalg.equals("RSASSA-PSS")? "RSASSA-P.RSA" : + keyalg + "." + keyalg); + String bk = "META-INF/" + jeName; + if (jf.getEntry(bk) == null) { + System.out.println("JarFile entries:"); + Enumeration entries = jf.entries(); + while (entries.hasMoreElements()) { + System.out.println("je: " + + entries.nextElement().getRealName()); + } + throw new Exception("Expected jarfile entry name " + + jeName + " not found"); + } try (InputStream is = jf.getInputStream(jf.getEntry(bk))) { String digestalg = new PKCS7(is).getSignerInfos()[0] .getDigestAlgorithmId().toString(); diff --git a/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java b/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java new file mode 100644 index 0000000000000000000000000000000000000000..353f82ad4b23953a9702074a9420fad40b2e4f2d --- /dev/null +++ b/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 8282633 8283665 + * @summary jarsigner should display the named curve to better explain why + * an EC key is disabled or will be disabled. + * @library /test/lib + */ + +import jdk.test.lib.SecurityTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.util.JarUtils; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class DisableCurveTest { + private static final String JAVA_SECURITY_FILE = "java.security"; + + public static void main(String[] args) throws Exception{ + SecurityTools.keytool("-keystore ks -storepass changeit " + + "-genkeypair -keyalg EC -keysize 256 -alias ca -dname CN=CA " + + "-ext bc:c") + .shouldHaveExitValue(0); + + JarUtils.createJarFile(Path.of("a.jar"), Path.of("."), Path.of("ks")); + + Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), + "jdk.jar.disabledAlgorithms=secp256r1\n" + + "jdk.certpath.disabledAlgorithms=secp256r1\n"); + + SecurityTools.jarsigner("-keystore ks -storepass changeit " + + "-signedjar signeda.jar -verbose " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " a.jar ca") + .shouldContain(">>> Signer") + .shouldContain("Signature algorithm: SHA384withECDSA, 256-bit EC (secp256r1) key (disabled)") + .shouldContain("Warning:") + .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk and is disabled") + .shouldHaveExitValue(0); + + SecurityTools.jarsigner("-verify signeda.jar " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " -keystore ks -storepass changeit -verbose -debug") + .shouldContain("- Signed by") + .shouldContain("Signature algorithm: SHA384withECDSA, 256-bit EC (secp256r1) key (disabled)") + .shouldContain("WARNING: The jar will be treated as unsigned") + .shouldHaveExitValue(0); + + Files.deleteIfExists(Paths.get(JAVA_SECURITY_FILE)); + Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), + "jdk.security.legacyAlgorithms=secp256r1\n"); + + SecurityTools.jarsigner("-keystore ks -storepass changeit " + + "-signedjar signeda.jar -verbose " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " a.jar ca") + .shouldContain(">>> Signer") + .shouldContain("Signature algorithm: SHA384withECDSA, 256-bit EC (secp256r1) key (weak)") + .shouldContain("Warning:") + .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk. This key size will be disabled in a future update") + .shouldHaveExitValue(0); + + SecurityTools.jarsigner("-verify signeda.jar " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " -keystore ks -storepass changeit -verbose -debug") + .shouldContain("- Signed by") + .shouldContain("Signature algorithm: SHA384withECDSA, 256-bit EC (secp256r1) key (weak)") + .shouldContain("jar verified") + .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk. This key size will be disabled in a future update") + .shouldHaveExitValue(0); + } +} diff --git a/test/jdk/sun/security/tools/jarsigner/NewSize7.java b/test/jdk/sun/security/tools/jarsigner/NewSize7.java index 8dbf15f4a388e4aef4c9a01092d139d55b23f0d5..1b75e08807a549100fc96d037ad725730587037a 100644 --- a/test/jdk/sun/security/tools/jarsigner/NewSize7.java +++ b/test/jdk/sun/security/tools/jarsigner/NewSize7.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 6561126 + * @bug 6561126 8267319 + * @modules jdk.jartool/jdk.security.jarsigner * @summary keytool should use larger default keysize for keypairs * @library /test/lib */ @@ -37,8 +38,13 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.jar.JarFile; import java.util.jar.Manifest; +import jdk.security.jarsigner.JarSigner; public class NewSize7 { + + private static final String DEF_DIGEST_ALGO = + JarSigner.Builder.getDefaultDigestAlgorithm(); + public static void main(String[] args) throws Exception { String common = "-storepass changeit -keypass changeit -keystore ks "; SecurityTools.keytool(common @@ -53,13 +59,13 @@ public class NewSize7 { jf.getEntry("META-INF/MANIFEST.MF"))) { Asserts.assertTrue(new Manifest(is).getAttributes("ns7.txt") .keySet().stream() - .anyMatch(s -> s.toString().contains("SHA-256"))); + .anyMatch(s -> s.toString().contains(DEF_DIGEST_ALGO))); } try (InputStream is = jf.getInputStream( jf.getEntry("META-INF/ME.SF"))) { Asserts.assertTrue(new Manifest(is).getAttributes("ns7.txt") .keySet().stream() - .anyMatch(s -> s.toString().contains("SHA-256"))); + .anyMatch(s -> s.toString().contains(DEF_DIGEST_ALGO))); } } } diff --git a/test/jdk/sun/security/tools/jarsigner/PreserveRawManifestEntryAndDigest.java b/test/jdk/sun/security/tools/jarsigner/PreserveRawManifestEntryAndDigest.java index 85f185ebd0c6c4c57cf76a7fe77594282d83037d..ed47231e004224c2f28d85c5991c2fcd342f10a9 100644 --- a/test/jdk/sun/security/tools/jarsigner/PreserveRawManifestEntryAndDigest.java +++ b/test/jdk/sun/security/tools/jarsigner/PreserveRawManifestEntryAndDigest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipFile; import java.util.zip.ZipEntry; +import jdk.security.jarsigner.JarSigner; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; import jdk.test.lib.SecurityTools; @@ -57,7 +58,7 @@ import static org.testng.Assert.*; /** * @test - * @bug 8217375 + * @bug 8217375 8267319 * @library /test/lib * @modules jdk.jartool/sun.security.tools.jarsigner * @run testng/timeout=1200 PreserveRawManifestEntryAndDigest @@ -87,6 +88,8 @@ public class PreserveRawManifestEntryAndDigest { static final String KEYSTORE_FILENAME = "test.jks"; static final String FILENAME_INITIAL_CONTENTS = "initial-contents"; static final String FILENAME_UPDATED_CONTENTS = "updated-contents"; + private static final String DEF_DIGEST_STR = + JarSigner.Builder.getDefaultDigestAlgorithm() + "-Digest"; /** * @see sun.security.tools.jarsigner.Main#run @@ -373,9 +376,9 @@ public class PreserveRawManifestEntryAndDigest { ZipEntry eb = zip.getEntry("META-INF/B.SF"); Manifest sfb = new Manifest(zip.getInputStream(eb)); if (assertMainAttrsDigestsUnchanged) { - String mainAttrsDigKey = - (digestalg != null ? digestalg : "SHA-256") + - "-Digest-Manifest-Main-Attributes"; + String mainAttrsDigKey = (digestalg != null ? + (digestalg + "-Digest") : DEF_DIGEST_STR) + + "-Manifest-Main-Attributes"; assertEquals(sfa.getMainAttributes().getValue(mainAttrsDigKey), sfb.getMainAttributes().getValue(mainAttrsDigKey)); } @@ -418,8 +421,9 @@ public class PreserveRawManifestEntryAndDigest { "Name: " + FILENAME_INITIAL_CONTENTS.substring(0, 1) + "\r\n" + " " + FILENAME_INITIAL_CONTENTS.substring(1, 8) + "\r\n" + " " + FILENAME_INITIAL_CONTENTS.substring(8) + "\r\n" + - "SHA-256-Digest: " + m.getAttributes(FILENAME_INITIAL_CONTENTS) - .getValue("SHA-256-Digest") + "\r\n" + + DEF_DIGEST_STR + ": " + + m.getAttributes(FILENAME_INITIAL_CONTENTS) + .getValue(DEF_DIGEST_STR) + "\r\n" + "\r\n" ).getBytes(UTF_8); }); @@ -442,7 +446,7 @@ public class PreserveRawManifestEntryAndDigest { public void arbitraryLineBreaksHeader() throws Exception { test("arbitraryLineBreaksHeader", m -> { String digest = m.getAttributes(FILENAME_INITIAL_CONTENTS) - .getValue("SHA-256-Digest"); + .getValue(DEF_DIGEST_STR); return ( Name.MANIFEST_VERSION + ": 1.0\r\n" + "Created-By: " + @@ -455,7 +459,7 @@ public class PreserveRawManifestEntryAndDigest { " line breaks.\r\n" + "\r\n" + "Name: " + FILENAME_INITIAL_CONTENTS + "\r\n" + - "SHA-256-Digest: " + digest.substring(0, 11) + "\r\n" + + DEF_DIGEST_STR + ": " + digest.substring(0, 11) + "\r\n" + " " + digest.substring(11) + "\r\n" + "\r\n" ).getBytes(UTF_8); @@ -491,7 +495,7 @@ public class PreserveRawManifestEntryAndDigest { *
  • simulate a manifest as it would have been written by a JDK before 11 * by re-positioning line breaks at 70 bytes (which makes a difference by * digests that grow headers longer than 70 characters such as SHA-512 as - * opposed to default SHA-256, long file names, or manual editing)
  • + * opposed to default SHA-384, long file names, or manual editing) *
  • add a new file to the jar
  • *
  • sign the jar with a JDK 11 or 12 with a different signer
  • *

    → @@ -787,8 +791,8 @@ public class PreserveRawManifestEntryAndDigest { // with either digest or digestWorkaround has been checked by test // before. assertEquals(abSigFilesEqual(jarFilename, sf -> sf.getMainAttributes() - .getValue("SHA-256-Digest-Manifest-Main-Attributes")), - expectUnchangedDigests); + .getValue(DEF_DIGEST_STR + "-Manifest-Main-Attributes")), + expectUnchangedDigests); } /** @@ -817,7 +821,7 @@ public class PreserveRawManifestEntryAndDigest { replaceTrailingLineBreaksManipulation(trailingSeq)); assertTrue(abSigFilesEqual(jarFilename, sf -> sf.getAttributes( - FILENAME_INITIAL_CONTENTS).getValue("SHA-256-Digest"))); + FILENAME_INITIAL_CONTENTS).getValue(DEF_DIGEST_STR))); } /** @@ -857,7 +861,7 @@ public class PreserveRawManifestEntryAndDigest { }); assertTrue(abSigFilesEqual(jarFilename, sf -> sf.getAttributes( - FILENAME_INITIAL_CONTENTS).getValue("SHA-256-Digest"))); + FILENAME_INITIAL_CONTENTS).getValue(DEF_DIGEST_STR))); } /** @@ -886,7 +890,7 @@ public class PreserveRawManifestEntryAndDigest { }); assertTrue(abSigFilesEqual(jarFilename, sf -> sf.getAttributes( - FILENAME_INITIAL_CONTENTS).getValue("SHA-256-Digest"))); + FILENAME_INITIAL_CONTENTS).getValue(DEF_DIGEST_STR))); } /** @@ -917,7 +921,7 @@ public class PreserveRawManifestEntryAndDigest { null, true, true); assertTrue(abSigFilesEqual(jarFilename, sf -> sf.getAttributes( - FILENAME_INITIAL_CONTENTS).getValue("SHA-256-Digest"))); + FILENAME_INITIAL_CONTENTS).getValue(DEF_DIGEST_STR))); } /** @@ -957,7 +961,7 @@ public class PreserveRawManifestEntryAndDigest { }); assertTrue(abSigFilesEqual(jarFilename, sf -> sf.getAttributes( - FILENAME_INITIAL_CONTENTS).getValue("SHA-256-Digest"))); + FILENAME_INITIAL_CONTENTS).getValue(DEF_DIGEST_STR))); } /** @@ -993,7 +997,7 @@ public class PreserveRawManifestEntryAndDigest { }, null, true, true); assertTrue(abSigFilesEqual(jarFilename, sf -> sf.getAttributes( - FILENAME_INITIAL_CONTENTS).getValue("SHA-256-Digest"))); + FILENAME_INITIAL_CONTENTS).getValue(DEF_DIGEST_STR))); } String manifestToString(Manifest mf) { diff --git a/test/jdk/sun/security/tools/jarsigner/SectionNameContinuedVsLineBreak.java b/test/jdk/sun/security/tools/jarsigner/SectionNameContinuedVsLineBreak.java index c2beff2c317da5e77db3597011012b3b9e25683e..4464314bf287e4ef9445e624ae9afbbc810b4ae4 100644 --- a/test/jdk/sun/security/tools/jarsigner/SectionNameContinuedVsLineBreak.java +++ b/test/jdk/sun/security/tools/jarsigner/SectionNameContinuedVsLineBreak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ import java.util.jar.Manifest; import java.util.jar.JarFile; import jdk.test.lib.util.JarUtils; import jdk.test.lib.SecurityTools; +import jdk.security.jarsigner.JarSigner; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -39,8 +40,9 @@ import static java.nio.charset.StandardCharsets.UTF_8; /** * @test - * @bug 8217375 + * @bug 8217375 8267319 * @library /test/lib + * @modules jdk.jartool/jdk.security.jarsigner * @run testng SectionNameContinuedVsLineBreak * @summary Checks some specific line break character sequences in section name * continuation line breaks. @@ -48,6 +50,8 @@ import static java.nio.charset.StandardCharsets.UTF_8; public class SectionNameContinuedVsLineBreak { static final String KEYSTORE_FILENAME = "test.jks"; + private static final String DEF_DIGEST_STR = + JarSigner.Builder.getDefaultDigestAlgorithm() + "-Digest"; @BeforeTest public void prepareCertificate() throws Exception { @@ -107,12 +111,12 @@ public class SectionNameContinuedVsLineBreak { public void testContinueNameAfterCr() throws Exception { String filename = "abc"; test("testContinueNameAfterCr", m -> { - String digest = m.getAttributes("abc").getValue("SHA-256-Digest"); + String digest = m.getAttributes("abc").getValue(DEF_DIGEST_STR); m.getEntries().remove("abc"); return (manifestToString(m) + "Name: a\r" + " bc\r\n" - + "SHA-256-Digest: " + digest + "\r\n" + + DEF_DIGEST_STR + ": " + digest + "\r\n" + "\r\n").getBytes(UTF_8); }, filename); } @@ -126,13 +130,13 @@ public class SectionNameContinuedVsLineBreak { public void testContinueNameAfterCrOnContinuationLine() throws Exception { String filename = "abc"; test("testContinueNameAfterCr", m -> { - String digest = m.getAttributes("abc").getValue("SHA-256-Digest"); + String digest = m.getAttributes("abc").getValue(DEF_DIGEST_STR); m.getEntries().remove("abc"); return (manifestToString(m) + "Name: a\r\n" + " b\r" + " c\r\n" - + "SHA-256-Digest: " + digest + "\r\n" + + DEF_DIGEST_STR + ": " + digest + "\r\n" + "\r\n").getBytes(UTF_8); }, filename); } @@ -146,12 +150,12 @@ public class SectionNameContinuedVsLineBreak { public void testEndNameWithCrOnContinuationLine() throws Exception { String filename = "abc"; test("testContinueNameAfterCr", m -> { - String digest = m.getAttributes("abc").getValue("SHA-256-Digest"); + String digest = m.getAttributes("abc").getValue(DEF_DIGEST_STR); m.getEntries().remove("abc"); return (manifestToString(m) + "Name: a\r\n" + " bc\r" - + "SHA-256-Digest: " + digest + "\r\n" + + DEF_DIGEST_STR + ": " + digest + "\r\n" + "\r\n").getBytes(UTF_8); }, filename); } diff --git a/test/jdk/sun/security/tools/jarsigner/SignedAgain.java b/test/jdk/sun/security/tools/jarsigner/SignedAgain.java index 54cf52148c6707cf9bb156aff1ff4bc8b8db70d2..584712c90cc6fa7858f348e10ffb791dbd1f7f54 100644 --- a/test/jdk/sun/security/tools/jarsigner/SignedAgain.java +++ b/test/jdk/sun/security/tools/jarsigner/SignedAgain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 8215922 + * @bug 8215922 8267319 + * @modules jdk.jartool/jdk.security.jarsigner * @summary jar spec is not precise when describing jar file re-signing * @library /test/lib */ @@ -37,10 +38,15 @@ import java.util.Base64; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; +import jdk.security.jarsigner.JarSigner; import static jdk.test.lib.SecurityTools.*; public class SignedAgain { + + private static final String DEF_DIGEST = + JarSigner.Builder.getDefaultDigestAlgorithm(); + public static void main(String[] args) throws Exception { String opt = "-storepass changeit -keystore ks"; @@ -73,20 +79,20 @@ public class SignedAgain { // Hash of manifest for 2 signed JAR files String da = Base64.getEncoder().encodeToString(MessageDigest - .getInstance("SHA-256").digest(ma.readAllBytes())); + .getInstance(DEF_DIGEST).digest(ma.readAllBytes())); String db = Base64.getEncoder().encodeToString(MessageDigest - .getInstance("SHA-256").digest(mb.readAllBytes())); + .getInstance(DEF_DIGEST).digest(mb.readAllBytes())); // They are not the same Asserts.assertNotEquals(da, db); // Digest-Manifest in A.SF matches da Asserts.assertEQ(new Manifest(sa).getMainAttributes() - .getValue("SHA-256-Digest-Manifest"), da); + .getValue(DEF_DIGEST + "-Digest-Manifest"), da); // Digest-Manifest in B.SF matches db Asserts.assertEQ(new Manifest(sb).getMainAttributes() - .getValue("SHA-256-Digest-Manifest"), db); + .getValue(DEF_DIGEST + "-Digest-Manifest"), db); } } } diff --git a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java index e6794550b9097730f39a26c21750f0594ac78d68..c4cf1ef6a985d6c4f01f86d416ffacf20415393d 100644 --- a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java +++ b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * 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,6 +47,7 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.security.KeyStoreUtils; import jdk.test.lib.security.timestamp.*; import jdk.test.lib.util.JarUtils; +import jdk.security.jarsigner.JarSigner; import sun.security.pkcs.PKCS7; import sun.security.pkcs.PKCS9Attribute; import sun.security.pkcs.SignerInfo; @@ -55,13 +56,14 @@ import sun.security.timestamp.TimestampToken; /* * @test * @bug 6543842 6543440 6939248 8009636 8024302 8163304 8169911 8180289 8172404 - * 8247960 8242068 8269039 8275887 + * 8247960 8242068 8269039 8275887 8267319 * @summary checking response of timestamp * @modules java.base/sun.security.pkcs * java.base/sun.security.timestamp * java.base/sun.security.x509 * java.base/sun.security.util * java.base/sun.security.tools.keytool + * jdk.jartool/jdk.security.jarsigner * @library /lib/testlibrary * @library /test/lib * @build jdk.test.lib.util.JarUtils @@ -80,6 +82,18 @@ public class TimestampCheck { private static final String PASSWORD = "changeit"; private static final String defaultPolicyId = "2.3.4"; private static String host = null; + private static final String getDefaultSigAlg(String keyAlg) { + switch(keyAlg) { + case "DSA": + return "SHA256withDSA"; + case "RSA": + return "SHA384withRSA"; + case "EC": + return "SHA384withECDSA"; + default: + throw new RuntimeException("Error: unsupported algo " + keyAlg); + } + } private static class Interceptor implements RespInterceptor { @@ -291,7 +305,8 @@ public class TimestampCheck { sign("policy", "-tsapolicyid", "1.2.3") .shouldHaveExitValue(0); - checkTimestamp("policy.jar", "1.2.3", "SHA-256"); + checkTimestamp("policy.jar", "1.2.3", + JarSigner.Builder.getDefaultDigestAlgorithm()); sign("diffpolicy", "-tsapolicyid", "1.2.3") .shouldContain("TSAPolicyID changed in timestamp token") @@ -378,9 +393,11 @@ public class TimestampCheck { .shouldHaveExitValue(0) .shouldContain("Signature algorithm: SHA3-256withRSA") .shouldContain("Signature algorithm: RSASSA-PSS") - .shouldContain("Signature algorithm: SHA256withECDSA") + .shouldContain("Signature algorithm: " + + getDefaultSigAlg("EC")) .shouldContain("Signature algorithm: Ed25519") - .shouldContain("Signature algorithm: SHA256withDSA"); + .shouldContain("Signature algorithm: " + + getDefaultSigAlg("DSA")); // Disabled algorithms sign("tsweak", "-digestalg", "SHA1", diff --git a/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java b/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java index 4d5b28533f5859ccd765344c6d3598a68b606ad2..9b4b3cb785f2eb999f562e26649b95cb1f58ebe0 100644 --- a/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java +++ b/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8217375 8260286 + * @bug 8217375 8260286 8267319 * @summary This test is used to verify the compatibility of jarsigner across * different JDK releases. It also can be used to check jar signing (w/ * and w/o TSA) and to verify some specific signing and digest algorithms. @@ -1192,9 +1192,9 @@ public class Compatibility { // defaults if (RSA.equals(keyAlgorithm) || DSA.equals(keyAlgorithm)) { - return 2048; + return 3072; } else if (EC.equals(keyAlgorithm)) { - return 256; + return 384; } else { throw new RuntimeException("problem determining key size"); } diff --git a/test/jdk/sun/security/tools/jarsigner/compatibility/SignTwice.java b/test/jdk/sun/security/tools/jarsigner/compatibility/SignTwice.java index e948eb6e8d3fe392cf2740a702efeea6c8be50c9..0b4d0668edc05fcb91f8eb36f84da2520e375548 100644 --- a/test/jdk/sun/security/tools/jarsigner/compatibility/SignTwice.java +++ b/test/jdk/sun/security/tools/jarsigner/compatibility/SignTwice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /** - * @bug 8217375 + * @bug 8217375 8267319 * @summary This test runs those test cases of {@link Compatibility} test nearby * which can be executed within the currently built and tested JDK and without * TSA, with only one digest algorithm and with only one key (algorithm and @@ -47,6 +47,19 @@ * -DtestJarUpdate=true * -Dstrict=true * -DkeyAlgs=EC;0 + * -DdigestAlgs=SHA-384 + * SignTwice + * @run main/othervm/timeout=600 + * -Djava.security.properties=./java.security + * -Duser.language=en + * -Duser.country=US + * -DjdkList=TEST_JDK + * -DtsaList=notsa + * -Dexpired=false + * -DtestComprehensiveJarContents=true + * -DtestJarUpdate=true + * -Dstrict=true + * -DkeyAlgs=EC;0 * -DdigestAlgs=SHA-256 * SignTwice */ diff --git a/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.java b/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.java index 46a55e4d6fbdcc7f62354b91bdd94be7a4dfb359..52ca1ead82c5afd5a0d7f7efa7c539b81279415e 100644 --- a/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.java +++ b/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8260693 + * @bug 8260693 8267319 * @summary Test for keytool -genkeypair with -signer and -signerkeypass options * @library /test/lib * @modules java.base/sun.security.util @@ -186,7 +186,7 @@ public class GenKeyPairSigner { System.out.println("Generating a DH cert with -signer option"); SecurityTools.keytool("-keystore ks -storepass changeit " + "-genkeypair -keyalg DH -alias e3 -dname CN=E3 -signer ca3") - .shouldContain("Generating 2,048 bit DH key pair and a certificate (SHA256withDSA) issued by with a validity of 90 days") + .shouldContain("Generating 3,072 bit DH key pair and a certificate (SHA256withDSA) issued by with a validity of 90 days") .shouldContain("for: CN=E3") .shouldHaveExitValue(0); @@ -200,7 +200,7 @@ public class GenKeyPairSigner { pKey = cert.getPublicKey(); keyLen = KeyUtil.getKeySize(pKey); - if (keyLen != 2048) { + if (keyLen != 3072) { throw new Exception("Key size is in error"); } @@ -212,8 +212,8 @@ public class GenKeyPairSigner { SecurityTools.keytool("-keystore ks -storepass changeit " + "-list -v") .shouldContain("Alias name: e3") - .shouldContain("Signature algorithm name: SHA256withRSA") - .shouldContain("Subject Public Key Algorithm: 2048-bit DH key") + .shouldContain("Signature algorithm name: SHA384withRSA") + .shouldContain("Subject Public Key Algorithm: 3072-bit DH key") .shouldHaveExitValue(0); } @@ -239,7 +239,7 @@ public class GenKeyPairSigner { SecurityTools.keytool("-keystore ksjks -storepass changeit -storetype jks " + "-genkeypair -keyalg DSA -keysize 1024 -alias ca1 -dname CN=CA1 " + "-keypass ca1keypass -signer ca -signerkeypass cakeypass") - .shouldContain("Generating 1,024 bit DSA key pair and a certificate (SHA256withRSA) issued by with a validity of 90 days") + .shouldContain("Generating 1,024 bit DSA key pair and a certificate (SHA384withRSA) issued by with a validity of 90 days") .shouldContain("for: CN=CA1") .shouldContain("The generated certificate #1 of 2 uses a 1024-bit DSA key which is considered a security risk") .shouldContain("The generated certificate #2 of 2 uses a 1024-bit RSA key which is considered a security risk") diff --git a/test/jdk/sun/security/tools/keytool/GenerateAll.java b/test/jdk/sun/security/tools/keytool/GenerateAll.java index a9d05813f4b0a19dad6f3eadea8d8fe93e52e516..5435372cdcffe8f748a4906ecee3bc8ff2d6283f 100644 --- a/test/jdk/sun/security/tools/keytool/GenerateAll.java +++ b/test/jdk/sun/security/tools/keytool/GenerateAll.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8242184 8242068 + * @bug 8242184 8242068 8267319 * @summary keytool and jarsigner for all algorithms * @library /test/lib * @modules java.base/sun.security.util @@ -117,11 +117,11 @@ public class GenerateAll { @DataProvider(name = "all") public Object[][] dataProvider() { return new Object[][]{ - {"rsa", "rsa", null, "RSA", SHA_256, SHA256withRSA}, + {"rsa", "rsa", null, "RSA", SHA_384, SHA384withRSA}, {"dsa", "dsa", null, "DSA", SHA_256, SHA256withDSA}, - {"r", "rsa", "rsassa-pss", "RSA", SHA_256, RSASSA_PSS}, - {"pss", "rsassa-pss", null, "RSA", SHA_256, RSASSA_PSS}, - {"ec", "ec", null, "EC", SHA_256, SHA256withECDSA}, + {"r", "rsa", "rsassa-pss", "RSA", SHA_384, RSASSA_PSS}, + {"pss", "rsassa-pss", null, "RSA", SHA_384, RSASSA_PSS}, + {"ec", "ec", null, "EC", SHA_384, SHA384withECDSA}, {"ed25519", "ed25519", null, "EC", SHA_512, Ed25519}, {"ed448", "ed448", null, "EC", SHAKE256_LEN, Ed448}, }; diff --git a/test/jdk/sun/security/tools/keytool/GroupName.java b/test/jdk/sun/security/tools/keytool/GroupName.java index 2251ca47fe95bf1473a8ce2128435247e56c8ece..938d28b6d8fb2360e7844d30c84eb7d3867d047c 100644 --- a/test/jdk/sun/security/tools/keytool/GroupName.java +++ b/test/jdk/sun/security/tools/keytool/GroupName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import java.security.interfaces.ECKey; /** * @test - * @bug 8213400 8214179 + * @bug 8213400 8214179 8267319 * @summary Support choosing group name in keytool keypair generation * @library /test/lib */ @@ -48,7 +48,7 @@ public class GroupName { gen("b", "-keyalg EC") .shouldHaveExitValue(0) .shouldNotContain("Specifying -keysize for generating EC keys is deprecated"); - checkCurveName("b", "secp256r1"); + checkCurveName("b", "secp384r1"); // default; if none specified gen("c", "-keyalg EC -keysize 256") .shouldHaveExitValue(0) @@ -67,7 +67,8 @@ public class GroupName { kt("-list -v") .shouldHaveExitValue(0) - .shouldContain("Subject Public Key Algorithm: 256-bit EC (secp256r1) key"); + .shouldContain("Subject Public Key Algorithm: 256-bit EC (secp256r1) key") + .shouldContain("Subject Public Key Algorithm: 384-bit EC (secp384r1) key"); } private static void checkCurveName(String a, String name) diff --git a/test/jdk/sun/security/tools/keytool/KeyAlg.java b/test/jdk/sun/security/tools/keytool/KeyAlg.java index 044568ca624c5e1e28d38efa2260e576cf42784c..ed5061949bf64e91584225b6bce121260413547e 100644 --- a/test/jdk/sun/security/tools/keytool/KeyAlg.java +++ b/test/jdk/sun/security/tools/keytool/KeyAlg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8029659 8214179 + * @bug 8029659 8214179 8267319 * @summary Keytool, print key algorithm of certificate or key entry * @library /test/lib */ @@ -41,9 +41,9 @@ public class KeyAlg { keytool("-printcert -file user.crt") .shouldMatch("Signature algorithm name:.*SHA1withECDSA") .shouldMatch("Subject Public Key Algorithm:.*1024.*RSA"); - keytool("-genkeypair -alias f -dname CN=f -keyalg EC") + keytool("-genkeypair -alias g -dname CN=g -keyalg EC -keysize 256") .shouldContain("Generating 256 bit EC (secp256r1) key pair"); - keytool("-genkeypair -alias g -dname CN=g -keyalg EC -keysize 384") + keytool("-genkeypair -alias f -dname CN=f -keyalg EC") .shouldContain("Generating 384 bit EC (secp384r1) key pair"); } diff --git a/test/jdk/sun/security/tools/keytool/NewSize7.java b/test/jdk/sun/security/tools/keytool/NewSize7.java index 5a7dcfa57d9d4ef8e5165b9d760bdb83fe5613ef..09c0f9a289a62f2bbed7e5c97464aaa0a81c8b18 100644 --- a/test/jdk/sun/security/tools/keytool/NewSize7.java +++ b/test/jdk/sun/security/tools/keytool/NewSize7.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,10 @@ /* * @test - * @bug 6561126 + * @bug 6561126 8267319 * @summary keytool should use larger default keysize for keypairs - * @modules java.base/sun.security.tools.keytool - * @compile -XDignore.symbol.file NewSize7.java + * @modules java.base/sun.security.util + * java.base/sun.security.tools.keytool * @run main NewSize7 */ @@ -37,6 +37,7 @@ import java.nio.file.Paths; import java.security.KeyStore; import java.security.cert.X509Certificate; import java.security.interfaces.RSAPublicKey; +import sun.security.util.SecurityProviderConstants; public class NewSize7 { public static void main(String[] args) throws Exception { @@ -52,11 +53,11 @@ public class NewSize7 { } Files.delete(Paths.get(FILE)); RSAPublicKey r = (RSAPublicKey)ks.getCertificate("a").getPublicKey(); - if (r.getModulus().bitLength() != 2048) { + if (r.getModulus().bitLength() != 3072) { throw new Exception("Bad keysize"); } X509Certificate x = (X509Certificate)ks.getCertificate("a"); - if (!x.getSigAlgName().equals("SHA256withRSA")) { + if (!x.getSigAlgName().equals("SHA384withRSA")) { throw new Exception("Bad sigalg"); } } diff --git a/test/jdk/sun/security/tools/keytool/fakegen/DefaultSignatureAlgorithm.java b/test/jdk/sun/security/tools/keytool/fakegen/DefaultSignatureAlgorithm.java index b4ae0e21c76bed7e88110c16b220c8ecf0942162..5f0822440fcdecc09bdf8a1b6cb54aeb7220cbc7 100644 --- a/test/jdk/sun/security/tools/keytool/fakegen/DefaultSignatureAlgorithm.java +++ b/test/jdk/sun/security/tools/keytool/fakegen/DefaultSignatureAlgorithm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8138766 8227059 8227595 + * @bug 8138766 8227059 8227595 8267319 * @summary New default -sigalg for keytool * @library /test/lib * @build java.base/sun.security.rsa.RSAKeyPairGenerator @@ -46,8 +46,8 @@ public class DefaultSignatureAlgorithm { static int pos = 0; public static void main(String[] args) throws Exception { - check("RSA", 1024, null, "SHA256withRSA"); - check("RSA", 3072, null, "SHA256withRSA"); + check("RSA", 1024, null, "SHA384withRSA"); + check("RSA", 3072, null, "SHA384withRSA"); check("RSA", 3073, null, "SHA384withRSA"); check("RSA", 7680, null, "SHA384withRSA"); check("RSA", 7681, null, "SHA512withRSA"); diff --git a/test/jdk/sun/security/tools/keytool/fakegen/PSS.java b/test/jdk/sun/security/tools/keytool/fakegen/PSS.java index 72f7452618943b9f9524f673a9af2bebffef57f3..9e7de9b757dc3f79d8932c8448ef4bba1adc8ebb 100644 --- a/test/jdk/sun/security/tools/keytool/fakegen/PSS.java +++ b/test/jdk/sun/security/tools/keytool/fakegen/PSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8215694 8222987 8225257 + * @bug 8215694 8222987 8225257 8267319 * @summary keytool cannot generate RSASSA-PSS certificates * @library /test/lib * @build java.base/sun.security.rsa.RSAKeyPairGenerator @@ -63,10 +63,10 @@ public class PSS { new File("ks"), "changeit".toCharArray()); check((X509Certificate)ks.getCertificate("p"), "RSASSA-PSS", - AlgorithmId.SHA256_oid); + AlgorithmId.SHA384_oid); check((X509Certificate)ks.getCertificate("a"), "RSA", - AlgorithmId.SHA256_oid); + AlgorithmId.SHA384_oid); check((X509Certificate)ks.getCertificate("b"), "RSA", AlgorithmId.SHA384_oid); diff --git a/test/jdk/sun/text/resources/LocaleData b/test/jdk/sun/text/resources/LocaleData index ba1760978251d0e3a9fc17a9782eb8e3a6f5eff2..50fa417ae6d188dbea4ca5815fbb080a6d134f97 100644 --- a/test/jdk/sun/text/resources/LocaleData +++ b/test/jdk/sun/text/resources/LocaleData @@ -6448,6 +6448,7 @@ CurrencyNames//rsd=Serbian Dinar CurrencyNames//scr=Seychellois Rupee CurrencyNames//sdd=Sudanese Dinar (1992-2007) CurrencyNames//sit=Slovenian Tolar +CurrencyNames//sle=Sierra Leonean Leone CurrencyNames//sll=Sierra Leonean Leone CurrencyNames//srd=Surinamese Dollar CurrencyNames//srg=Surinamese Guilder diff --git a/test/jdk/sun/text/resources/LocaleDataTest.java b/test/jdk/sun/text/resources/LocaleDataTest.java index 1d2ddd03a8264dcb64977991913aaafb7fb779a6..51e88d72a2bdb348449dd9b037be28f279c12623 100644 --- a/test/jdk/sun/text/resources/LocaleDataTest.java +++ b/test/jdk/sun/text/resources/LocaleDataTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ * 8145136 8145952 8164784 8037111 8081643 7037368 8178872 8185841 8190918 * 8187946 8195478 8181157 8179071 8193552 8202026 8204269 8202537 8208746 * 8209775 8221432 8227127 8230284 8231273 8233579 8234288 8250665 8255086 - * 8251317 8274658 + * 8251317 8274658 8283277 * @summary Verify locale data * @modules java.base/sun.util.resources * @modules jdk.localedata diff --git a/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java b/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java index 7b50c342a0d3c1943ca5b57b9495dbdd55db13a1..ef6405860f5b1c534789acf43e6fe2206844b3ae 100644 --- a/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java +++ b/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +47,7 @@ public class TestZoneInfo310 { String TESTDIR = System.getProperty("test.dir", "."); Path tzdir = Paths.get(System.getProperty("test.root"), - "..", "..", "make", "data", "tzdata"); + "../../src/java.base/share/data/tzdata"); String tzfiles = "africa antarctica asia australasia europe northamerica southamerica backward etcetera gmt"; Path jdk_tzdir = Paths.get(System.getProperty("test.src"), "tzdata_jdk"); String jdk_tzfiles = "jdk11_backward"; diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java index d25dba1df220967e5f2d6de6a473215b0b09897e..3d316571811499fe69b6203562affdedd6941ca4 100644 --- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java +++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java @@ -411,7 +411,7 @@ public class TestSearch extends JavadocTester { """, """ - + """, """ """, @@ -684,7 +684,7 @@ public class TestSearch extends JavadocTester { checkFiles(expectedOutput, "search.js", "jquery-ui.overrides.css", - "script-dir/jquery-3.5.1.min.js", + "script-dir/jquery-3.6.0.min.js", "script-dir/jquery-ui.min.js", "script-dir/jquery-ui.min.css", "script-dir/jquery-ui.structure.min.css", diff --git a/test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java b/test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java index 4b0dd06a2a246adc35c34432829beaf02cea552f..9923a191a57b18e2566696b3a873d252cd6cf12e 100644 --- a/test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java +++ b/test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1079,11 +1079,11 @@ public class TestSnippetTag extends SnippetTester { checkExit(Exit.ERROR); checkOutput(Output.OUT, true, """ - A.java:4: error: File not found: %s""".formatted(fileName)); + A.java:4: error: file not found on source path or snippet path: %s""".formatted(fileName)); checkOutput("pkg/A.html", true, """

    invalid @snippet -
    File not found: text.txt
    +
    file not found on source path or snippet path: text.txt
    """); checkNoCrashes(); @@ -1140,7 +1140,7 @@ public class TestSnippetTag extends SnippetTester { checkExit(Exit.ERROR); checkOutput(Output.OUT, true, """ - A.java:4: error: File not found: %s""".formatted(fileName)); + A.java:4: error: file not found on source path or snippet path: %s""".formatted(fileName)); checkNoCrashes(); } @@ -1869,7 +1869,7 @@ public class TestSnippetTag extends SnippetTester { checkExit(Exit.ERROR); checkOutput(Output.OUT, true, """ - A.java:4: error: File not found: %s""".formatted(fileName)); + A.java:4: error: file not found on source path or snippet path: %s""".formatted(fileName)); checkNoCrashes(); } diff --git a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java index a0d68d8540333f72771f2f694823337783a8b4f5..3a5ddda8261824fed9586854f581e523162446fc 100644 --- a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java +++ b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java @@ -201,7 +201,7 @@ class APITest { "help-doc.html", "index-all.html", "index.html", - "script-dir/jquery-3.5.1.min.js", + "script-dir/jquery-3.6.0.min.js", "script-dir/jquery-ui.min.js", "script-dir/jquery-ui.min.css", "script-dir/jquery-ui.structure.min.css", diff --git a/test/langtools/tools/javac/diags/examples.not-yet.txt b/test/langtools/tools/javac/diags/examples.not-yet.txt index 9f9f8f780144708d7f61108f4708b10c79cd457e..afceccad6335dff0148078647c44ce70de3aa3cf 100644 --- a/test/langtools/tools/javac/diags/examples.not-yet.txt +++ b/test/langtools/tools/javac/diags/examples.not-yet.txt @@ -57,7 +57,6 @@ compiler.misc.bad.runtime.invisible.param.annotations # bad class file compiler.misc.bad.signature # bad class file compiler.misc.bad.requires.flag # bad class file compiler.misc.bad.type.annotation.value -compiler.misc.base.membership # UNUSED compiler.misc.class.file.not.found # ClassReader compiler.misc.class.file.wrong.class compiler.misc.exception.message # uncommon completion failure based on a string diff --git a/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java b/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java index 8afdf54f40d20dcac1fc12bda8397c46d69ef091..ae4f525e4ee125497567bff46e80550e931606f3 100644 --- a/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java +++ b/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java @@ -64,7 +64,7 @@ public class CanHandleClassFilesTest { Path test = d.resolve("make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java"); if (Files.exists(test)) { createSymbols = test; - includeList = d.resolve("make/data/symbols/include.list"); + includeList = d.resolve("src/jdk.compiler/share/data/symbols/include.list"); break; } } diff --git a/test/langtools/tools/javac/sym/ElementStructureTest.java b/test/langtools/tools/javac/sym/ElementStructureTest.java index db5ae5f4582a14dd8de894ddc2544e2e18b1ece3..791785b24521ef5db20b4a858e6405aa872bfaf3 100644 --- a/test/langtools/tools/javac/sym/ElementStructureTest.java +++ b/test/langtools/tools/javac/sym/ElementStructureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,7 +104,7 @@ import toolbox.ToolBox; /**To generate the hash values for version N, invoke this class like: * - * java ElementStructureTest generate-hashes $LANGTOOLS_DIR/make/data/symbols/include.list ( N)+ + * java ElementStructureTest generate-hashes $LANGTOOLS_DIR/src/jdk.compiler/share/data/symbols/include.list ( N)+ * * Where is the file produced by make/src/classes/build/tools/symbolgenerator/Probe.java. * So, to produce hashes for 6, 7 and 8, this command can be used: @@ -113,11 +113,11 @@ import toolbox.ToolBox; * * To inspect differences between the actual and expected output for version N, invoke this class like: * - * java ElementStructureTest generate-output $LANGTOOLS_DIR/make/data/symbols/include.list ( N )+ + * java ElementStructureTest generate-output $LANGTOOLS_DIR/src/jdk.compiler/share/data/symbols/include.list ( N )+ * * For example, to get the actual and expected output for 6 in /tmp/actual and /tmp/expected, respectively: * - * java ElementStructureTest generate-output $LANGTOOLS_DIR/make/data/symbols/include.list classes-6 6 /tmp/actual /tmp/expected + * java ElementStructureTest generate-output $LANGTOOLS_DIR/src/jdk.compiler/share/data/symbols/include.list classes-6 6 /tmp/actual /tmp/expected */ public class ElementStructureTest { diff --git a/test/lib-test/jdk/test/lib/TestMutuallyExclusivePlatformPredicates.java b/test/lib-test/jdk/test/lib/TestMutuallyExclusivePlatformPredicates.java index 3ca1de653a4f7e25112833d39ea693b08d59ea43..219d3797453dfbb3c538a937b22d3197d95ccd6d 100644 --- a/test/lib-test/jdk/test/lib/TestMutuallyExclusivePlatformPredicates.java +++ b/test/lib-test/jdk/test/lib/TestMutuallyExclusivePlatformPredicates.java @@ -45,7 +45,7 @@ import java.util.Set; */ public class TestMutuallyExclusivePlatformPredicates { private static enum MethodGroup { - ARCH("isAArch64", "isARM", "isPPC", "isS390x", "isX64", "isX86"), + ARCH("isAArch64", "isARM", "isRISCV64", "isPPC", "isS390x", "isX64", "isX86"), BITNESS("is32bit", "is64bit"), OS("isAix", "isLinux", "isOSX", "isWindows"), VM_TYPE("isClient", "isServer", "isMinimal", "isZero", "isEmbedded"), diff --git a/test/lib/jdk/test/lib/Platform.java b/test/lib/jdk/test/lib/Platform.java index a8405c937226a178dabc5c60cd4a3e53ff427430..3084634018bd3cf2724247347a58a2740549e7d1 100644 --- a/test/lib/jdk/test/lib/Platform.java +++ b/test/lib/jdk/test/lib/Platform.java @@ -197,6 +197,10 @@ public class Platform { return isArch("arm.*"); } + public static boolean isRISCV64() { + return isArch("riscv64"); + } + public static boolean isPPC() { return isArch("ppc.*"); } diff --git a/test/lib/jdk/test/lib/cds/CDSOptions.java b/test/lib/jdk/test/lib/cds/CDSOptions.java index cbc11db777b1a55d1f34930c122614c0e6657d9c..a60afb90aed29b2b7c2c25e3d182af0aebc1a6e4 100644 --- a/test/lib/jdk/test/lib/cds/CDSOptions.java +++ b/test/lib/jdk/test/lib/cds/CDSOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,6 +56,11 @@ public class CDSOptions { return this; } + public CDSOptions addSuffix(ArrayList suffix) { + for (String s : suffix) this.suffix.add(s); + return this; + } + public CDSOptions addSuffix(String... suffix) { for (String s : suffix) this.suffix.add(s); return this; diff --git a/test/micro/org/openjdk/bench/java/lang/StringDecode.java b/test/micro/org/openjdk/bench/java/lang/StringDecode.java index c5609ce4e51fd14406f613d53b4f25105fcb806f..ee4f8df7c734f21eb235f1c380843c66ae5dde42 100644 --- a/test/micro/org/openjdk/bench/java/lang/StringDecode.java +++ b/test/micro/org/openjdk/bench/java/lang/StringDecode.java @@ -87,7 +87,7 @@ public class StringDecode { bh.consume(new String(asciiString, charset)); bh.consume(new String(longAsciiString, 0, 15, charset)); bh.consume(new String(asciiString, 0, 3, charset)); - bh.consume(new String(longAsciiString, 512, 512 + 7, charset)); + bh.consume(new String(longAsciiString, 512, 7, charset)); } @Benchmark @@ -103,7 +103,7 @@ public class StringDecode { bh.consume(new String(latin1String, charset)); bh.consume(new String(latin1String, 0, 15, charset)); bh.consume(new String(latin1String, 0, 3, charset)); - bh.consume(new String(longLatin1OnlyString, 512, 512 + 7, charset)); + bh.consume(new String(longLatin1OnlyString, 512, 7, charset)); } @Benchmark diff --git a/test/micro/org/openjdk/bench/java/time/GetYearBench.java b/test/micro/org/openjdk/bench/java/time/GetYearBench.java new file mode 100644 index 0000000000000000000000000000000000000000..59d3b84a29793e4b273842925d9d1851d0dbb309 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/time/GetYearBench.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 org.openjdk.bench.java.time; + +import java.time.Duration; +import java.time.Instant; +import java.time.ZonedDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; + +import java.util.Locale; +import java.util.Random; +import java.util.TimeZone; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; + +/** + * Examine ability to perform escape analysis on expressions + * such as {@code Instant.ofEpochMilli(value).atZone(ZoneOffset.UTC).getYear()} + */ +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Warmup(iterations = 5, time = 2, timeUnit = TimeUnit.SECONDS) +@Measurement(iterations = 5, time = 2, timeUnit = TimeUnit.SECONDS) +@Fork(3) +@State(Scope.Benchmark) +public class GetYearBench { + + private TimeZone UTC = TimeZone.getTimeZone("UTC"); + + private TimeZone LONDON = TimeZone.getTimeZone("Europe/London"); + + private long[] INSTANT_MILLIS; + + private int[] YEARS; + + @Setup + public void createInstants() { + // Various instants during the same day + final Instant loInstant = Instant.EPOCH.plus(Duration.ofDays(365*50)); // 2020-01-01 + final Instant hiInstant = loInstant.plus(Duration.ofDays(1)); + final long maxOffsetNanos = Duration.between(loInstant, hiInstant).toNanos(); + final Random random = new Random(0); + INSTANT_MILLIS = IntStream + .range(0, 1_000) + .mapToObj(ignored -> { + final long offsetNanos = (long) Math.floor(random.nextDouble() * maxOffsetNanos); + return loInstant.plus(offsetNanos, ChronoUnit.NANOS); + }) + .mapToLong(instant -> instant.toEpochMilli()) + .toArray(); + YEARS = new int[INSTANT_MILLIS.length]; + } + + @Benchmark + public int[] getYearFromMillisZoneOffset() { + for (int i = 0; i < YEARS.length; i++) { + YEARS[i] = Instant.ofEpochMilli(INSTANT_MILLIS[i]).atZone(ZoneOffset.UTC).getYear(); + } + return YEARS; + } + + @Benchmark + public int[] getYearFromMillisZoneRegionUTC() { + for (int i = 0; i < YEARS.length; i++) { + YEARS[i] = Instant.ofEpochMilli(INSTANT_MILLIS[i]).atZone(UTC.toZoneId()).getYear(); + } + return YEARS; + } + + @Benchmark + public int[] getYearFromMillisZoneRegion() { + for (int i = 0; i < YEARS.length; i++) { + YEARS[i] = Instant.ofEpochMilli(INSTANT_MILLIS[i]).atZone(LONDON.toZoneId()).getYear(); + } + return YEARS; + } + + @Benchmark + public int[] getYearFromMillisZoneRegionNormalized() { + for (int i = 0; i < YEARS.length; i++) { + YEARS[i] = Instant.ofEpochMilli(INSTANT_MILLIS[i]).atZone(UTC.toZoneId().normalized()).getYear(); + } + return YEARS; + } +} diff --git a/test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java b/test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java new file mode 100644 index 0000000000000000000000000000000000000000..02b10d7ddf71e177a593312e25b7389648f3117f --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * 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 org.openjdk.bench.vm.compiler; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.Blackhole; + +import java.util.concurrent.TimeUnit; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Fork(value = 1, jvmArgsAppend = {"-XX:LoopUnrollLimit=1"}) +@State(Scope.Thread) +public class LeaInstruction { + static final int ITERATION = 1000; + + int x, y; + + @Benchmark + public void IS_D_int(Blackhole bh) { + int x = this.x; + for (int i = 0; i < ITERATION; i++) { + x = x * 4 + 10; + } + bh.consume(x); + } + + @Benchmark + public void B_I_D_int(Blackhole bh) { + int x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y + 10; + y = x + y + 20; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_int(Blackhole bh) { + int x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4; + y = x + y * 8; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_D_int(Blackhole bh) { + int x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4 + 10; + y = x + y * 8 + 20; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void IS_D_long(Blackhole bh) { + long x = this.x; + for (int i = 0; i < ITERATION; i++) { + x = x * 4 + 10; + } + bh.consume(x); + } + + @Benchmark + public void B_I_D_long(Blackhole bh) { + long x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y + 10; + y = x + y + 20; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_long(Blackhole bh) { + long x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4; + y = x + y * 8; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_D_long(Blackhole bh) { + long x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4 + 10; + y = x + y * 8 + 20; + } + bh.consume(x); + bh.consume(y); + } +} diff --git a/test/micro/org/openjdk/bench/vm/gc/MicroLargePages.java b/test/micro/org/openjdk/bench/vm/gc/MicroLargePages.java new file mode 100644 index 0000000000000000000000000000000000000000..67702cfe607473536bf08316733aed234f2891a1 --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/gc/MicroLargePages.java @@ -0,0 +1,62 @@ +// +// Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +// 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 org.openjdk.bench.vm.gc; + +import java.util.Arrays; +import java.util.concurrent.TimeUnit; +import org.openjdk.jmh.annotations.*; + +@OutputTimeUnit(TimeUnit.MINUTES) +@State(Scope.Thread) +@Fork(jvmArgsAppend = {"-Xmx256m", "-XX:+UseLargePages", "-XX:LargePageSizeInBytes=1g", "-Xlog:pagesize"}, value = 5) + +public class MicroLargePages { + + @Param({"2097152"}) + public int ARRAYSIZE; + + @Param({"1", "2", "4"}) + public int NUM; + + public long[][] INP; + public long[][] OUT; + + @Setup(Level.Trial) + public void BmSetup() { + INP = new long[NUM][ARRAYSIZE]; + OUT = new long[NUM][ARRAYSIZE]; + for (int i = 0; i < NUM; i++) { + Arrays.fill(INP[i], 10); + } + } + + @Benchmark + public void micro_HOP_DIST_4KB() { + for (int i = 0; i < NUM; i += 1) { + for (int j = 0; j < ARRAYSIZE; j += 512) { + OUT[i][j] = INP[i][j]; + } + } + } +}