From 5ac345714ffdc82574172d0d4c8b83d7ed0245e2 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 31 Oct 2016 11:43:07 +0100 Subject: [PATCH 001/166] 8166837: [TESTBUG] Fix tests on Linux/s390x Reviewed-by: kvn, simonis --- test/lib/jdk/test/lib/Platform.java | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/lib/jdk/test/lib/Platform.java b/test/lib/jdk/test/lib/Platform.java index f648bfb670b..3f924371c43 100644 --- a/test/lib/jdk/test/lib/Platform.java +++ b/test/lib/jdk/test/lib/Platform.java @@ -160,9 +160,8 @@ public class Platform { return vmVersion; } - // Returns true for sparc and sparcv9. - public static boolean isSparc() { - return isArch("sparc.*"); + public static boolean isAArch64() { + return isArch("aarch64"); } public static boolean isARM() { @@ -173,9 +172,14 @@ public class Platform { return isArch("ppc.*"); } - public static boolean isX86() { - // On Linux it's 'i386', Windows 'x86' without '_64' suffix. - return isArch("(i386)|(x86(?!_64))"); + // Returns true for IBM z System running linux. + public static boolean isS390x() { + return isArch("s390.*") || isArch("s/390.*") || isArch("zArch_64"); + } + + // Returns true for sparc and sparcv9. + public static boolean isSparc() { + return isArch("sparc.*"); } public static boolean isX64() { @@ -183,8 +187,9 @@ public class Platform { return isArch("(amd64)|(x86_64)"); } - public static boolean isAArch64() { - return isArch("aarch64"); + public static boolean isX86() { + // On Linux it's 'i386', Windows 'x86' without '_64' suffix. + return isArch("(i386)|(x86(?!_64))"); } public static String getOsArch() { @@ -200,6 +205,7 @@ public class Platform { if (isAix()) { return false; // SA not implemented. } else if (isLinux()) { + if (isS390x()) { return false; } // SA not implemented. return canPtraceAttachLinux(); } else if (isOSX()) { return canAttachOSX(); From 04eb6a6783d18a7ed75acbe8f56054fc246d965d Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 31 Oct 2016 14:13:03 +0100 Subject: [PATCH 002/166] 8166837: [TESTBUG] Fix tests on Linux/s390x Reviewed-by: simonis --- jdk/test/java/awt/JAWT/JAWT.sh | 2 +- jdk/test/sun/tools/jhsdb/BasicLauncherTest.java | 5 ++--- jdk/test/sun/tools/jhsdb/HeapDumpTest.java | 5 ++--- jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/jdk/test/java/awt/JAWT/JAWT.sh b/jdk/test/java/awt/JAWT/JAWT.sh index ab511d8a71e..d01ff022a42 100644 --- a/jdk/test/java/awt/JAWT/JAWT.sh +++ b/jdk/test/java/awt/JAWT/JAWT.sh @@ -122,7 +122,7 @@ esac # Skip unsupported platforms case `uname -m` in - arm* | ppc* ) + arm* | ppc* | s390* ) echo "Test passed. Not supported on current architecture." exit 0 ;; diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java index 998e1b2eed2..9285044b358 100644 --- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java +++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java @@ -44,7 +44,7 @@ import jdk.testlibrary.Utils; import jdk.testlibrary.OutputAnalyzer; import jdk.testlibrary.ProcessTools; import jdk.test.lib.apps.LingeredApp; -import jdk.testlibrary.Platform; +import jdk.test.lib.Platform; public class BasicLauncherTest { @@ -230,8 +230,7 @@ public class BasicLauncherTest { Arrays.asList(toolArgs)); } - public static void main(String[] args) - throws IOException { + public static void main(String[] args) throws Exception { if (!Platform.shouldSAAttach()) { // Silently skip the test if we don't have enough permissions to attach diff --git a/jdk/test/sun/tools/jhsdb/HeapDumpTest.java b/jdk/test/sun/tools/jhsdb/HeapDumpTest.java index 59772a3c421..bc1d6553885 100644 --- a/jdk/test/sun/tools/jhsdb/HeapDumpTest.java +++ b/jdk/test/sun/tools/jhsdb/HeapDumpTest.java @@ -41,7 +41,7 @@ import jdk.testlibrary.JDKToolLauncher; import jdk.testlibrary.OutputAnalyzer; import jdk.testlibrary.ProcessTools; import jdk.test.lib.apps.LingeredApp; -import jdk.testlibrary.Platform; +import jdk.test.lib.Platform; public class HeapDumpTest { @@ -109,8 +109,7 @@ public class HeapDumpTest { dump.delete(); } - public static void main(String[] args) - throws IOException { + public static void main(String[] args) throws Exception { if (!Platform.shouldSAAttach()) { // Silently skip the test if we don't have enough permissions to attach diff --git a/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java index 1f88fd325b1..75437fa4ed3 100644 --- a/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java +++ b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java @@ -30,7 +30,7 @@ import java.util.Map; import jdk.test.lib.apps.LingeredApp; import jdk.testlibrary.Utils; -import jdk.testlibrary.Platform; +import jdk.test.lib.Platform; /* * @test From 145cb85e75a24e00e249a3d81db72e60b072f56e Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Mon, 7 Nov 2016 16:14:18 -0800 Subject: [PATCH 003/166] 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null Adjust com/sun/jdi/MethodImpl.java for null argument Reviewed-by: dcubed, dsamersoff --- .../classes/com/sun/tools/jdi/MethodImpl.java | 10 ++- jdk/test/com/sun/jdi/EvalArraysAsList.sh | 85 +++++++++++++++++++ 2 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 jdk/test/com/sun/jdi/EvalArraysAsList.sh diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java index b5cd9c67abd..2cd645345c7 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -315,10 +315,14 @@ public abstract class MethodImpl extends TypeComponentImpl return; } Value nthArgValue = arguments.get(paramCount - 1); - if (nthArgValue == null) { + if (nthArgValue == null && argCount == paramCount) { + // We have one varargs parameter and it is null + // so we don't have to do anything. return; } - Type nthArgType = nthArgValue.type(); + // If the first varargs parameter is null, then don't + // access its type since it can't be an array. + Type nthArgType = (nthArgValue == null) ? null : nthArgValue.type(); if (nthArgType instanceof ArrayTypeImpl) { if (argCount == paramCount && ((ArrayTypeImpl)nthArgType).isAssignableTo(lastParamType)) { diff --git a/jdk/test/com/sun/jdi/EvalArraysAsList.sh b/jdk/test/com/sun/jdi/EvalArraysAsList.sh new file mode 100644 index 00000000000..fa5cd93c53a --- /dev/null +++ b/jdk/test/com/sun/jdi/EvalArraysAsList.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# +# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @bug 8160024 +# @summary jdb returns invalid argument count if first parameter to Arrays.asList is null +# +# @run shell/timeout=300 EvalArraysAsList.sh +# +# The test checks if evaluation of the expression java.util.Arrays.asList(null, "a") +# works normally and does not throw an IllegalArgumentException. + +classname=EvalArraysAsList + +createJavaFile() +{ + cat < $classname.java.1 +public class $classname { + public static void main(String[] args) { + java.util.List l = java.util.Arrays.asList(null, "a"); + System.out.println("java.util.Arrays.asList(null, \"a\") returns: " + l); + return; // @1 breakpoint + } +} +EOF +} + +# drive jdb by sending cmds to it and examining its output +dojdbCmds() +{ + setBkpts @1 + runToBkpt @1 + + cmd eval "java.util.Arrays.asList(null, null)" + jdbFailIfPresent "IllegalArgumentException" 3 + + cmd eval "java.util.Arrays.asList(null, \"a\")" + jdbFailIfPresent "IllegalArgumentException" 3 + + cmd eval "java.util.Arrays.asList(\"a\", null)" + jdbFailIfPresent "IllegalArgumentException" 3 +} + + +mysetup() +{ + if [ -z "$TESTSRC" ] ; then + TESTSRC=. + fi + + for ii in . $TESTSRC $TESTSRC/.. ; do + if [ -r "$ii/ShellScaffold.sh" ] ; then + . $ii/ShellScaffold.sh + break + fi + done +} + +# You could replace this next line with the contents +# of ShellScaffold.sh and this script will run just the same. +mysetup + +runit +pass From 34af3661d3fe5d2037d2a6407ea23e349b822c55 Mon Sep 17 00:00:00 2001 From: Ujwal Vangapally Date: Mon, 14 Nov 2016 12:05:26 +0530 Subject: [PATCH 004/166] 8168141: javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java: No notif received! Changed the time limit of 2 seconds for getting notification to default jtreg timeout. Reviewed-by: rehn, dholmes --- .../notif/EmptyDomainNotificationTest.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java b/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java index ebc0ab239d6..7301c4faa0b 100644 --- a/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java +++ b/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -103,20 +103,13 @@ public class EmptyDomainNotificationTest { mbsc.invoke(mbean, "emitNotification", null, null); System.out.println("EmptyDomainNotificationTest-main: waiting notif..."); - final long stopTime = System.currentTimeMillis() + 2000; synchronized(li) { - long toWait = stopTime - System.currentTimeMillis(); - - while (li.received < 1 && toWait > 0) { - li.wait(toWait); - - toWait = stopTime - System.currentTimeMillis(); + while (li.received < 1) { + li.wait(); } } - if (li.received < 1) { - throw new RuntimeException("No notif received!"); - } else if (li.received > 1) { + if (li.received != 1) { throw new RuntimeException("Wait one notif but got: "+li.received); } From f5794aaadbf627913d691b9ff5bf5d054c987057 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 15 Nov 2016 08:58:29 -0800 Subject: [PATCH 005/166] 8153208: TIFFImageReadParam: should "contains()" check be appropriate for addAllowedTagSet() method? Do not add a duplicate TIFFTagSet instance and update the spec accordingly. Reviewed-by: prr --- .../javax/imageio/plugins/tiff/TIFFImageReadParam.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java index 1b8821aef1c..e6af9dfe887 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java @@ -50,7 +50,8 @@ import javax.imageio.ImageReadParam; */ public final class TIFFImageReadParam extends ImageReadParam { - private List allowedTagSets = new ArrayList(4); + private final List allowedTagSets = + new ArrayList(4); /** * Constructs a {@code TIFFImageReadParam}. Tags defined by @@ -72,7 +73,8 @@ public final class TIFFImageReadParam extends ImageReadParam { /** * Adds a {@code TIFFTagSet} object to the list of allowed - * tag sets. + * tag sets. Attempting to add a duplicate object to the list + * has no effect. * * @param tagSet a {@code TIFFTagSet}. * @@ -83,7 +85,9 @@ public final class TIFFImageReadParam extends ImageReadParam { if (tagSet == null) { throw new IllegalArgumentException("tagSet == null!"); } - allowedTagSets.add(tagSet); + if (!allowedTagSets.contains(tagSet)) { + allowedTagSets.add(tagSet); + } } /** From 15c92b98a3d49cbdced9e11834542c54f39c6504 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Wed, 16 Nov 2016 11:49:52 -0800 Subject: [PATCH 006/166] 8168759: Incorrect vertical positioning of diacritics Reviewed-by: serb --- .../share/native/libfontmanager/HBShaper.c | 2 +- .../font/TextLayout/ArabicDiacriticTest.java | 95 +++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java diff --git a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c index 95a92f221ad..41cf1864178 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c +++ b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c @@ -140,7 +140,7 @@ jboolean storeGVData(JNIEnv* env, indices[storei] = baseIndex + cluster; glyphs[storei] = (unsigned int)(glyphInfo[i].codepoint | slot); positions[storei*2] = startX + x + glyphPos[i].x_offset * scale; - positions[(storei*2)+1] = startY + y + glyphPos[i].y_offset * scale; + positions[(storei*2)+1] = startY + y - glyphPos[i].y_offset * scale; x += glyphPos[i].x_advance * scale; y += glyphPos[i].y_advance * scale; storei++; diff --git a/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java b/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java new file mode 100644 index 00000000000..e74edf8b8ed --- /dev/null +++ b/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + */ + +/* @test + * @summary verify Arab Diacritic Positioning + * @bug 8168759 + */ + +import java.awt.Font; +import java.awt.GridLayout; +import java.awt.Rectangle; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; +import java.util.Locale; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + +public class ArabicDiacriticTest { + + static final String SAMPLE = + "\u0627\u0644\u0639\u064e\u0631\u064e\u0628\u0650\u064a\u064e\u0651\u0629"; + + static final String STR1 = "\u0644\u0639\u064e\u0629"; + static final String STR2 = "\u0644\u0639\u0629"; + + static JFrame frame; + static final String FONT = "DejaVu Sans"; + + public static void main(String args[]) throws Exception { + showText(); // for a human + measureText(); // for the test harness + Thread.sleep(5000); + frame.dispose(); + } + + static void showText() { + SwingUtilities.invokeLater(() -> { + frame = new JFrame(); + JLabel label = new JLabel(SAMPLE); + Font font = new Font(FONT, Font.PLAIN, 36); + label.setFont(font); + frame.setLayout(new GridLayout(3,1)); + frame.add(label); + label = new JLabel(STR1); + label.setFont(font); + frame.add(label); + label = new JLabel(STR2); + label.setFont(font); + frame.add(label); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + } + + static void measureText() { + Font font = new Font(FONT, Font.PLAIN, 36); + if (!font.getFamily(Locale.ENGLISH).equals(FONT)) { + return; + } + FontRenderContext frc = new FontRenderContext(null, false, false); + TextLayout tl1 = new TextLayout(STR1, font, frc); + TextLayout tl2 = new TextLayout(STR2, font, frc); + Rectangle r1 = tl1.getPixelBounds(frc, 0f, 0f); + Rectangle r2 = tl2.getPixelBounds(frc, 0f, 0f); + if (r1.height > r2.height) { + System.out.println(font); + System.out.println(r1); + System.out.println(r2); + throw new RuntimeException("BAD BOUNDS"); + } + } +} From e266d93b8928fbeca59813214db0ba5238c92db0 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Wed, 16 Nov 2016 14:27:23 -0800 Subject: [PATCH 007/166] 8167182: Exported elements referring to inaccessible types in jdk.accessibility Reviewed-by: serb, ssadetsky --- make/CompileJavaModules.gmk | 2 -- 1 file changed, 2 deletions(-) diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index c222a400c85..0d3ede60f4b 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -344,8 +344,6 @@ jdk.charsets_COPY := .dat ################################################################################ -jdk.accessibility_ADD_JAVAC_FLAGS := -Xlint:-exports - ################################################################################ jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*,-jdk.internal.*' \ From 67657286e45a35a11f54e94a0de2f0408d8904e7 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Wed, 16 Nov 2016 14:27:39 -0800 Subject: [PATCH 008/166] 8167182: Exported elements referring to inaccessible types in jdk.accessibility Reviewed-by: serb, ssadetsky --- .../accessibility/util/AWTEventMonitor.java | 71 +++++++++---------- .../util/AccessibilityEventMonitor.java | 4 +- .../accessibility/util/SwingEventMonitor.java | 4 +- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java index cd3cf14164e..297779d39c8 100644 --- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java +++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,10 +25,8 @@ package com.sun.java.accessibility.util; -import java.util.*; import java.awt.*; import java.awt.event.*; -import javax.accessibility.*; import javax.swing.*; import javax.swing.event.*; import sun.awt.AWTPermissions; @@ -55,7 +53,7 @@ public class AWTEventMonitor { * @deprecated This field is unused; to get the component with focus use the * getComponentWithFocus method. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected Component componentWithFocus = null; static private Component componentWithFocus_private = null; @@ -69,7 +67,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected ComponentListener componentListener = null; static private ComponentListener componentListener_private = null; @@ -82,7 +80,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected ContainerListener containerListener = null; static private ContainerListener containerListener_private = null; @@ -95,7 +93,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected FocusListener focusListener = null; static private FocusListener focusListener_private = null; @@ -108,7 +106,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected KeyListener keyListener = null; static private KeyListener keyListener_private = null; @@ -121,7 +119,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected MouseListener mouseListener = null; static private MouseListener mouseListener_private = null; @@ -134,7 +132,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected MouseMotionListener mouseMotionListener = null; static private MouseMotionListener mouseMotionListener_private = null; @@ -147,7 +145,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected WindowListener windowListener = null; static private WindowListener windowListener_private = null; @@ -162,7 +160,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected ActionListener actionListener = null; static private ActionListener actionListener_private = null; @@ -175,7 +173,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected AdjustmentListener adjustmentListener = null; static private AdjustmentListener adjustmentListener_private = null; @@ -188,7 +186,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected ItemListener itemListener = null; static private ItemListener itemListener_private = null; @@ -201,7 +199,7 @@ public class AWTEventMonitor { * * @deprecated This field is unused. */ - @Deprecated + @Deprecated(since="8", forRemoval=true) static protected TextListener textListener = null; static private TextListener textListener_private = null; @@ -212,13 +210,8 @@ public class AWTEventMonitor { * This listener calls the other registered listeners when an event * occurs. By doing things this way, the actual number of listeners * installed on a component instance is drastically reduced. - * - * @deprecated This field is unused. */ - @Deprecated - static protected AWTEventsListener awtListener = new AWTEventsListener(); - - static private final AWTEventsListener awtListener_private = new AWTEventsListener(); + static private final AWTEventsListener awtListener = new AWTEventsListener(); /** * Returns the component that currently has keyboard focus. The return @@ -253,7 +246,7 @@ public class AWTEventMonitor { static public void addComponentListener(ComponentListener l) { if (componentListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.COMPONENT); + awtListener.installListeners(EventID.COMPONENT); } componentListener_private = AWTEventMulticaster.add(componentListener_private, l); } @@ -268,7 +261,7 @@ public class AWTEventMonitor { static public void removeComponentListener(ComponentListener l) { componentListener_private = AWTEventMulticaster.remove(componentListener_private, l); if (componentListener_private == null) { - awtListener_private.removeListeners(EventID.COMPONENT); + awtListener.removeListeners(EventID.COMPONENT); } } @@ -335,7 +328,7 @@ public class AWTEventMonitor { static public void addKeyListener(KeyListener l) { if (keyListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.KEY); + awtListener.installListeners(EventID.KEY); } keyListener_private = AWTEventMulticaster.add(keyListener_private, l); } @@ -350,7 +343,7 @@ public class AWTEventMonitor { static public void removeKeyListener(KeyListener l) { keyListener_private = AWTEventMulticaster.remove(keyListener_private, l); if (keyListener_private == null) { - awtListener_private.removeListeners(EventID.KEY); + awtListener.removeListeners(EventID.KEY); } } @@ -367,7 +360,7 @@ public class AWTEventMonitor { static public void addMouseListener(MouseListener l) { if (mouseListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.MOUSE); + awtListener.installListeners(EventID.MOUSE); } mouseListener_private = AWTEventMulticaster.add(mouseListener_private, l); } @@ -382,7 +375,7 @@ public class AWTEventMonitor { static public void removeMouseListener(MouseListener l) { mouseListener_private = AWTEventMulticaster.remove(mouseListener_private, l); if (mouseListener_private == null) { - awtListener_private.removeListeners(EventID.MOUSE); + awtListener.removeListeners(EventID.MOUSE); } } @@ -399,7 +392,7 @@ public class AWTEventMonitor { static public void addMouseMotionListener(MouseMotionListener l) { if (mouseMotionListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.MOTION); + awtListener.installListeners(EventID.MOTION); } mouseMotionListener_private = AWTEventMulticaster.add(mouseMotionListener_private, l); } @@ -414,7 +407,7 @@ public class AWTEventMonitor { static public void removeMouseMotionListener(MouseMotionListener l) { mouseMotionListener_private = AWTEventMulticaster.remove(mouseMotionListener_private, l); if (mouseMotionListener_private == null) { - awtListener_private.removeListeners(EventID.MOTION); + awtListener.removeListeners(EventID.MOTION); } } @@ -431,7 +424,7 @@ public class AWTEventMonitor { static public void addWindowListener(WindowListener l) { if (windowListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.WINDOW); + awtListener.installListeners(EventID.WINDOW); } windowListener_private = AWTEventMulticaster.add(windowListener_private, l); } @@ -446,7 +439,7 @@ public class AWTEventMonitor { static public void removeWindowListener(WindowListener l) { windowListener_private = AWTEventMulticaster.remove(windowListener_private, l); if (windowListener_private == null) { - awtListener_private.removeListeners(EventID.WINDOW); + awtListener.removeListeners(EventID.WINDOW); } } @@ -463,7 +456,7 @@ public class AWTEventMonitor { static public void addActionListener(ActionListener l) { if (actionListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.ACTION); + awtListener.installListeners(EventID.ACTION); } actionListener_private = AWTEventMulticaster.add(actionListener_private, l); } @@ -478,7 +471,7 @@ public class AWTEventMonitor { static public void removeActionListener(ActionListener l) { actionListener_private = AWTEventMulticaster.remove(actionListener_private, l); if (actionListener_private == null) { - awtListener_private.removeListeners(EventID.ACTION); + awtListener.removeListeners(EventID.ACTION); } } @@ -496,7 +489,7 @@ public class AWTEventMonitor { static public void addAdjustmentListener(AdjustmentListener l) { if (adjustmentListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.ADJUSTMENT); + awtListener.installListeners(EventID.ADJUSTMENT); } adjustmentListener_private = AWTEventMulticaster.add(adjustmentListener_private, l); } @@ -511,7 +504,7 @@ public class AWTEventMonitor { static public void removeAdjustmentListener(AdjustmentListener l) { adjustmentListener_private = AWTEventMulticaster.remove(adjustmentListener_private, l); if (adjustmentListener_private == null) { - awtListener_private.removeListeners(EventID.ADJUSTMENT); + awtListener.removeListeners(EventID.ADJUSTMENT); } } @@ -528,7 +521,7 @@ public class AWTEventMonitor { static public void addItemListener(ItemListener l) { if (itemListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.ITEM); + awtListener.installListeners(EventID.ITEM); } itemListener_private = AWTEventMulticaster.add(itemListener_private, l); } @@ -543,7 +536,7 @@ public class AWTEventMonitor { static public void removeItemListener(ItemListener l) { itemListener_private = AWTEventMulticaster.remove(itemListener_private, l); if (itemListener_private == null) { - awtListener_private.removeListeners(EventID.ITEM); + awtListener.removeListeners(EventID.ITEM); } } @@ -560,7 +553,7 @@ public class AWTEventMonitor { static public void addTextListener(TextListener l) { if (textListener_private == null) { checkInstallPermission(); - awtListener_private.installListeners(EventID.TEXT); + awtListener.installListeners(EventID.TEXT); } textListener_private = AWTEventMulticaster.add(textListener_private, l); } @@ -575,7 +568,7 @@ public class AWTEventMonitor { static public void removeTextListener(TextListener l) { textListener_private = AWTEventMulticaster.remove(textListener_private, l); if (textListener_private == null) { - awtListener_private.removeListeners(EventID.TEXT); + awtListener.removeListeners(EventID.TEXT); } } diff --git a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java index 603ba035ae7..e26718d15b5 100644 --- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java +++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ public class AccessibilityEventMonitor { * occurs. By doing things this way, the actual number of listeners * installed on a component instance is drastically reduced. */ - static protected final AccessibilityEventListener accessibilityListener = + static private final AccessibilityEventListener accessibilityListener = new AccessibilityEventListener(); /** diff --git a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java index bbb0fcb18b3..c5dcda4df3e 100644 --- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java +++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,7 +71,7 @@ public class SwingEventMonitor extends AWTEventMonitor { * occurs. By doing things this way, the actual number of listeners * installed on a component instance is drastically reduced. */ - static protected final SwingEventListener swingListener = new SwingEventListener(); + static private final SwingEventListener swingListener = new SwingEventListener(); /** * Adds the specified listener to receive all {@link EventID#ANCESTOR ANCESTOR} From 26282a374ced7a937c066a1a3a63875c10f4a917 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Thu, 17 Nov 2016 02:31:04 +0300 Subject: [PATCH 009/166] 8169202: [macos] Font substitution does not work for supplementary characters Reviewed-by: serb, prr --- .../native/libawt_lwawt/font/CGGlyphImages.m | 16 ++-- .../libawt_lwawt/font/CoreTextSupport.h | 2 + .../libawt_lwawt/font/CoreTextSupport.m | 32 +++++-- .../font/Fallback/SurrogatesFallbackTest.java | 88 +++++++++++++++++++ 4 files changed, 124 insertions(+), 14 deletions(-) create mode 100644 jdk/test/java/awt/font/Fallback/SurrogatesFallbackTest.java diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m index 79cdf5bf7a3..1d9269fc57f 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m @@ -591,7 +591,7 @@ CGGI_CreateImageForGlyph static inline GlyphInfo * CGGI_CreateImageForUnicode (CGGI_GlyphCanvas *canvas, const AWTStrike *strike, - const CGGI_RenderingMode *mode, const UniChar uniChar) + const CGGI_RenderingMode *mode, const UnicodeScalarValue uniChar) { // save the state of the world CGContextSaveGState(canvas->context); @@ -668,7 +668,7 @@ CGGI_FillImagesForGlyphsWithSizedCanvas(CGGI_GlyphCanvas *canvas, const AWTStrike *strike, const CGGI_RenderingMode *mode, jlong glyphInfos[], - const UniChar uniChars[], + const UnicodeScalarValue uniChars[], const CGGlyph glyphs[], const CFIndex len) { @@ -720,7 +720,7 @@ static NSString *threadLocalLCDCanvasKey = static inline void CGGI_FillImagesForGlyphs(jlong *glyphInfos, const AWTStrike *strike, const CGGI_RenderingMode *mode, - const UniChar uniChars[], const CGGlyph glyphs[], + const UnicodeScalarValue uniChars[], const CGGlyph glyphs[], const size_t maxWidth, const size_t maxHeight, const CFIndex len) { @@ -767,7 +767,7 @@ CGGI_FillImagesForGlyphs(jlong *glyphInfos, const AWTStrike *strike, static inline void CGGI_CreateGlyphInfos(jlong *glyphInfos, const AWTStrike *strike, const CGGI_RenderingMode *mode, - const UniChar uniChars[], const CGGlyph glyphs[], + const UnicodeScalarValue uniChars[], const CGGlyph glyphs[], CGSize advances[], CGRect bboxes[], const CFIndex len) { AWTFont *font = strike->fAWTFont; @@ -817,7 +817,7 @@ CGGI_CreateGlyphsAndScanForComplexities(jlong *glyphInfos, const AWTStrike *strike, const CGGI_RenderingMode *mode, jint rawGlyphCodes[], - UniChar uniChars[], CGGlyph glyphs[], + UnicodeScalarValue uniChars[], CGGlyph glyphs[], CGSize advances[], CGRect bboxes[], const CFIndex len) { @@ -860,7 +860,7 @@ CGGlyphImages_GetGlyphImagePtrs(jlong glyphInfos[], CGRect bboxes[len]; CGSize advances[len]; CGGlyph glyphs[len]; - UniChar uniChars[len]; + UnicodeScalarValue uniChars[len]; CGGI_CreateGlyphsAndScanForComplexities(glyphInfos, strike, &mode, rawGlyphCodes, uniChars, glyphs, @@ -871,7 +871,7 @@ CGGlyphImages_GetGlyphImagePtrs(jlong glyphInfos[], // just do one malloc, and carve it up for all the buffers void *buffer = malloc(sizeof(CGRect) * sizeof(CGSize) * - sizeof(CGGlyph) * sizeof(UniChar) * len); + sizeof(CGGlyph) * sizeof(UnicodeScalarValue) * len); if (buffer == NULL) { [[NSException exceptionWithName:NSMallocException reason:@"Failed to allocate memory for the temporary glyph strike and measurement buffers." userInfo:nil] raise]; @@ -880,7 +880,7 @@ CGGlyphImages_GetGlyphImagePtrs(jlong glyphInfos[], CGRect *bboxes = (CGRect *)(buffer); CGSize *advances = (CGSize *)(bboxes + sizeof(CGRect) * len); CGGlyph *glyphs = (CGGlyph *)(advances + sizeof(CGGlyph) * len); - UniChar *uniChars = (UniChar *)(glyphs + sizeof(UniChar) * len); + UnicodeScalarValue *uniChars = (UnicodeScalarValue *)(glyphs + sizeof(UnicodeScalarValue) * len); CGGI_CreateGlyphsAndScanForComplexities(glyphInfos, strike, &mode, rawGlyphCodes, uniChars, glyphs, diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.h index a0ede94846c..cbd3dc5923b 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.h +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.h @@ -32,7 +32,9 @@ #pragma mark --- CoreText Support --- #define HI_SURROGATE_START 0xD800 +#define HI_SURROGATE_END 0xDBFF #define LO_SURROGATE_START 0xDC00 +#define LO_SURROGATE_END 0xDFFF /* * Transform Unicode characters into glyphs. diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.m index 1bcd9f55102..5663b3084ac 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.m @@ -103,24 +103,34 @@ void CTS_GetGlyphsAsIntsForCharacters size_t i; for (i = 0; i < count; i++) { + UniChar unicode = unicodes[i]; + UniChar nextUnicode = (i+1) < count ? unicodes[i+1] : 0; + bool surrogatePair = unicode >= HI_SURROGATE_START && unicode <= HI_SURROGATE_END + && nextUnicode >= LO_SURROGATE_START && nextUnicode <= LO_SURROGATE_END; + CGGlyph glyph = glyphs[i]; if (glyph > 0) { glyphsAsInts[i] = glyph; + if (surrogatePair) i++; continue; } - UniChar unicode = unicodes[i]; - const CTFontRef fallback = JRSFontCreateFallbackFontForCharacters((CTFontRef)font->fFont, &unicode, 1); + const CTFontRef fallback = JRSFontCreateFallbackFontForCharacters((CTFontRef)font->fFont, &unicodes[i], + surrogatePair ? 2 : 1); if (fallback) { - CTFontGetGlyphsForCharacters(fallback, &unicode, &glyph, 1); + CTFontGetGlyphsForCharacters(fallback, &unicodes[i], &glyphs[i], surrogatePair ? 2 : 1); + glyph = glyphs[i]; CFRelease(fallback); } if (glyph > 0) { - glyphsAsInts[i] = -unicode; // set the glyph code to the negative unicode value + int codePoint = surrogatePair ? (((int)(unicode - HI_SURROGATE_START)) << 10) + + nextUnicode - LO_SURROGATE_START + 0x10000 : unicode; + glyphsAsInts[i] = -codePoint; // set the glyph code to the negative unicode value } else { glyphsAsInts[i] = 0; // CoreText couldn't find a glyph for this character either } + if (surrogatePair) i++; } } @@ -158,8 +168,18 @@ CTFontRef CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode return (CTFontRef)font->fFont; } - UTF16Char character = -glyphCode; - return CTS_CopyCTFallbackFontAndGlyphForUnicode(font, &character, glyphRef, 1); + int codePoint = -glyphCode; + if (codePoint >= 0x10000) { + UTF16Char chars[2]; + CGGlyph glyphs[2]; + CTS_BreakupUnicodeIntoSurrogatePairs(codePoint, chars); + CTFontRef result = CTS_CopyCTFallbackFontAndGlyphForUnicode(font, chars, glyphs, 2); + *glyphRef = glyphs[0]; + return result; + } else { + UTF16Char character = codePoint; + return CTS_CopyCTFallbackFontAndGlyphForUnicode(font, &character, glyphRef, 1); + } } // Breakup a 32 bit unicode value into the component surrogate pairs diff --git a/jdk/test/java/awt/font/Fallback/SurrogatesFallbackTest.java b/jdk/test/java/awt/font/Fallback/SurrogatesFallbackTest.java new file mode 100644 index 00000000000..9a87243d898 --- /dev/null +++ b/jdk/test/java/awt/font/Fallback/SurrogatesFallbackTest.java @@ -0,0 +1,88 @@ +/* + * Copyright 2016 JetBrains s.r.o. + * 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 8169202 + * @summary verify font fallback for surrogate pairs on macOS + * @requires os.family == "mac" + */ + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.font.GlyphVector; +import java.awt.image.BufferedImage; +import java.util.function.Consumer; + +public class SurrogatesFallbackTest { + private static final int CHARACTER = 0x1d400; // MATHEMATICAL BOLD CAPITAL A + private static final Font FONT = new Font("Menlo", // expected to fallback to STIXGeneral for the character above + Font.PLAIN, + 12); + private static final int IMAGE_WIDTH = 20; + private static final int IMAGE_HEIGHT = 20; + private static final int GLYPH_X = 5; + private static final int GLYPH_Y = 15; + + public static void main(String[] args) { + BufferedImage noGlyph = createImage(g -> {}); + BufferedImage missingGlyph = createImage(g -> { + GlyphVector gv = FONT.createGlyphVector(g.getFontRenderContext(), new int[]{FONT.getMissingGlyphCode()}); + g.drawGlyphVector(gv, GLYPH_X, GLYPH_Y); + }); + BufferedImage surrogateCharGlyph = createImage(g -> { + g.setFont(FONT); + g.drawString(new String(Character.toChars(CHARACTER)), GLYPH_X, GLYPH_Y); + }); + + if (imagesAreEqual(surrogateCharGlyph, noGlyph)) { + throw new RuntimeException("Character was not rendered"); + } + if (imagesAreEqual(surrogateCharGlyph, missingGlyph)) { + throw new RuntimeException("Character is rendered as missing"); + } + } + + private static BufferedImage createImage(Consumer drawing) { + BufferedImage image = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + Graphics2D g = image.createGraphics(); + g.setColor(Color.white); + g.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); + g.setColor(Color.black); + drawing.accept(g); + g.dispose(); + return image; + } + + private static boolean imagesAreEqual(BufferedImage i1, BufferedImage i2) { + if (i1.getWidth() != i2.getWidth() || i1.getHeight() != i2.getHeight()) return false; + for (int i = 0; i < i1.getWidth(); i++) { + for (int j = 0; j < i1.getHeight(); j++) { + if (i1.getRGB(i, j) != i2.getRGB(i, j)) { + return false; + } + } + } + return true; + } +} + From 6d895b494d8f52c90bd182e339e1c3192c4f5692 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 17 Nov 2016 11:48:37 +0530 Subject: [PATCH 010/166] 8168657: [PIT] Still, on Windows test always fails: java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java Reviewed-by: serb, rchamyal --- .../unix/UnixMultiResolutionSplashTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java b/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java index 26c4f728599..a4c026b7931 100644 --- a/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java +++ b/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java @@ -44,9 +44,11 @@ import java.util.Map; import javax.imageio.ImageIO; /** - * @test @bug 8145174 8151787 + * @test + * @bug 8145174 8151787 8168657 * @summary HiDPI splash screen support on Linux * @modules java.desktop/sun.java2d + * @requires (os.family == "linux") * @run main UnixMultiResolutionSplashTest */ public class UnixMultiResolutionSplashTest { From bd215e318bde236660b6d79934d613b34fd32139 Mon Sep 17 00:00:00 2001 From: Ambarish Rapte Date: Thu, 17 Nov 2016 11:57:56 +0530 Subject: [PATCH 011/166] 8169840: [TESTBUG] DisposeDialogNotActivateOwnerTest: Test clashes with another test with a similar name Reviewed-by: serb, aghaisas --- .../DisposeDialogNotActivateOwnerTest.html | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.html diff --git a/jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.html b/jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.html deleted file mode 100644 index 28ae8dfea74..00000000000 --- a/jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - -DisposeDialogNotActivateOwnerTest - - - -

DisposeDialogNotActivateOwnerTest
Bug ID: 6386592

- -

See the dialog box (usually in upper left corner) for instructions

- - - - From d1743ce9482ff244fc23e1053c66d04dfb2991af Mon Sep 17 00:00:00 2001 From: Ambarish Rapte Date: Thu, 17 Nov 2016 14:14:40 +0530 Subject: [PATCH 012/166] 6614519: [Doc] Description java.awt.dnd.DragSourceContext.getCursor() should be clarified Reviewed-by: serb, ssadetsky --- .../share/classes/java/awt/dnd/DragSourceContext.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java index 7d858548ddb..63ceb3f1706 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java +++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java @@ -279,7 +279,7 @@ public class DragSourceContext } /** - * Sets the cursor for this drag operation to the specified + * Sets the custom cursor for this drag operation to the specified * {@code Cursor}. If the specified {@code Cursor} * is {@code null}, the default drag cursor behavior is * activated for this drag operation, otherwise it is deactivated. @@ -298,9 +298,11 @@ public class DragSourceContext } /** - * Returns the current drag {@code Cursor}. + * Returns the current custom drag {@code Cursor}. * - * @return the current drag {@code Cursor} + * @return the current custom drag {@code Cursor}, if it was set + * otherwise returns {@code null}. + * @see #setCursor */ public Cursor getCursor() { return cursor; } From b5aa3c60c0dbb26cd6a9f583666bcc1d7e6e5298 Mon Sep 17 00:00:00 2001 From: Rahul Raghavan Date: Thu, 17 Nov 2016 01:17:26 -0800 Subject: [PATCH 013/166] 8159035: com/sun/crypto/provider/Cipher/CTS/CTSMode.java test crashed due to unhandled case of cipher length value as 0 Handled 0 length input case in Java wrapper method Reviewed-by: alanb, ascarpino, kvn, sherman, thartmann --- .../com/sun/crypto/provider/CipherBlockChaining.java | 10 ++++++---- .../classes/com/sun/crypto/provider/CounterMode.java | 10 ++++++---- .../java.base/share/classes/sun/nio/cs/ISO_8859_1.java | 7 +++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherBlockChaining.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherBlockChaining.java index f903754fb48..4e93d6fe03a 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherBlockChaining.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherBlockChaining.java @@ -142,6 +142,9 @@ class CipherBlockChaining extends FeedbackCipher { */ int encrypt(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset) { + if (plainLen <= 0) { + return plainLen; + } cryptBlockSizeCheck(plainLen); cryptNullAndBoundsCheck(plain, plainOffset, plainLen); cryptNullAndBoundsCheck(cipher, cipherOffset, plainLen); @@ -190,6 +193,9 @@ class CipherBlockChaining extends FeedbackCipher { */ int decrypt(byte[] cipher, int cipherOffset, int cipherLen, byte[] plain, int plainOffset) { + if (cipherLen <= 0) { + return cipherLen; + } cryptBlockSizeCheck(cipherLen); cryptNullAndBoundsCheck(cipher, cipherOffset, cipherLen); cryptNullAndBoundsCheck(plain, plainOffset, cipherLen); @@ -220,10 +226,6 @@ class CipherBlockChaining extends FeedbackCipher { } private static void cryptNullAndBoundsCheck(byte[] array, int offset, int len) { - if (len <= 0) { - return; // not an error because cryptImpl/decryptImpl won't execute if len <= 0 - } - Objects.requireNonNull(array); if (offset < 0 || offset >= array.length) { diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java index da6c10a7956..a1c33ae1593 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java @@ -172,10 +172,12 @@ final class CounterMode extends FeedbackCipher { * are encrypted on demand. */ private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) { - - Objects.checkFromIndexSize(inOff, len, in.length); - Objects.checkFromIndexSize(outOff, len, out.length); - return implCrypt(in, inOff, len, out, outOff); + if (len == 0) { + return 0; + } + Objects.checkFromIndexSize(inOff, len, in.length); + Objects.checkFromIndexSize(outOff, len, out.length); + return implCrypt(in, inOff, len, out, outOff); } // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic. diff --git a/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java b/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java index b5d93a8f677..f1dadedaf53 100644 --- a/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java +++ b/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java @@ -157,6 +157,9 @@ class ISO_8859_1 // Method possible replaced with a compiler intrinsic. private static int encodeISOArray(char[] sa, int sp, byte[] da, int dp, int len) { + if (len <= 0) { + return 0; + } encodeISOArrayCheck(sa, sp, da, dp, len); return implEncodeISOArray(sa, sp, da, dp, len); } @@ -177,10 +180,6 @@ class ISO_8859_1 private static void encodeISOArrayCheck(char[] sa, int sp, byte[] da, int dp, int len) { - if (len <= 0) { - return; // not an error because encodeISOArrayImpl won't execute if len <= 0 - } - Objects.requireNonNull(sa); Objects.requireNonNull(da); From 44f0e6e48205e7f10f1481a460a1fdfe015126f3 Mon Sep 17 00:00:00 2001 From: Harsha Wardhana B Date: Mon, 21 Nov 2016 12:13:39 +0530 Subject: [PATCH 014/166] 8169575: com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java failing with jtreg tip Reviewed-by: rriggs, fparain --- .../DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java index 368731e9d85..748e49a0915 100644 --- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java +++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -226,9 +226,10 @@ public class DcmdMBeanPermissionsTest { sm.grantPermission(new RuntimePermission("createClassLoader")); sm.grantPermission(new ReflectPermission("suppressAccessChecks")); sm.grantPermission(new java.util.logging.LoggingPermission("control", "")); - sm.grantPermission(new java.lang.RuntimePermission("exitVM.97")); + sm.grantPermission(new java.lang.RuntimePermission("exitVM.*")); sm.grantPermission(new java.lang.RuntimePermission("modifyThreadGroup")); sm.grantPermission(new java.lang.RuntimePermission("modifyThread")); + sm.grantPermission(new java.security.SecurityPermission("getProperty.jdk.jar.disabledAlgorithms")); for(MBeanOperationInfo opInfo : info.getOperations()) { Permission opPermission = new MBeanPermission(info.getClassName(), opInfo.getName(), From 9ebdadb0f06b82cd5c11910b7c6bf696fd23e9bd Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Mon, 21 Nov 2016 17:46:48 +0300 Subject: [PATCH 015/166] 8169719: WrappedPlainView.modelToView() should return Rectangle2D Reviewed-by: prr, serb, ssadetsky --- .../share/classes/javax/swing/text/WrappedPlainView.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java b/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java index 6bb02264dd3..dde3437adf4 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java @@ -26,6 +26,7 @@ package javax.swing.text; import java.awt.*; import java.awt.font.FontRenderContext; +import java.awt.geom.Rectangle2D; import java.lang.ref.SoftReference; import java.security.AccessController; import java.security.PrivilegedAction; @@ -750,7 +751,6 @@ public class WrappedPlainView extends BoxView implements TabExpander { * valid location in the associated document * @see View#modelToView */ - @SuppressWarnings("deprecation") public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException { Rectangle alloc = a.getBounds(); @@ -777,9 +777,11 @@ public class WrappedPlainView extends BoxView implements TabExpander { if (pos > p0) { Segment segment = SegmentCache.getSharedSegment(); loadText(segment, p0, pos); - alloc.x += Utilities.getTabbedTextWidth(segment, metrics, - alloc.x, WrappedPlainView.this, p0); + float x = alloc.x; + x += Utilities.getTabbedTextWidth(segment, metrics, x, + WrappedPlainView.this, p0); SegmentCache.releaseSharedSegment(segment); + return new Rectangle2D.Float(x, alloc.y, alloc.width, alloc.height); } return alloc; } From c71d7e10e6ae84a6eb4333350a5a928d7e18e71e Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Mon, 21 Nov 2016 15:04:37 -0800 Subject: [PATCH 016/166] 8170142: Broken links in TIFF metadata format and usage notes Change href attributes to the correct destinations Reviewed-by: prr --- .../javax/imageio/metadata/doc-files/tiff_metadata.html | 6 +++--- .../javax/imageio/plugins/tiff/BaselineTIFFTagSet.java | 2 +- .../classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java | 2 +- .../classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java | 5 +---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html index 2fc49cfec0f..045a1025f08 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html +++ b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html @@ -534,7 +534,7 @@ Technical Note #2 ZLib "Deflate/Inflate" compression (see note following this table) - + Adobe Photoshop® TIFF Technical Notes (PDF) @@ -545,9 +545,9 @@ Adobe Photoshop® TIFF Technical Notes (PDF) Deflate "Zip-in-TIFF" compression (see note following this table) - + ZLIB Compressed Data Format Specification, - + DEFLATE Compressed Data Format Specification diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java index 8c9ce8eaffa..d6181990e3f 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java @@ -224,7 +224,7 @@ public final class BaselineTIFFTagSet extends TIFFTagSet { * A value to be used with the "Compression" tag. * * @see #TAG_COMPRESSION - * @see DEFLATE specification + * @see DEFLATE specification * @see TIFF Specification Supplement 2 */ public static final int COMPRESSION_DEFLATE = 32946; diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java index 3ecfe500673..07888435588 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java @@ -29,7 +29,7 @@ import java.util.List; /** * A class representing the extra tags found in a - * TIFF-F (RFC 2036) file. + * TIFF-F (RFC 2036) file. * * @since 9 */ diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java index 4f77c2926bf..18962ed3816 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java @@ -30,10 +30,7 @@ import java.util.List; /** * A class representing the tags found in a GeoTIFF IFD. GeoTIFF is a * standard for annotating georeferenced or geocoded raster imagery. - * The GeoTIFF specification may be found at - * {@code http://www.remotesensing.org/geotiff/spec/geotiffhome.html} - * . This class does not handle the GeoKeys referenced + * This class does not handle the GeoKeys referenced * from a GeoKeyDirectoryTag as those are not TIFF tags per se. * *

The definitions of the data types referenced by the field From ba274b43ecc68801e20c2c8354fc501d85645364 Mon Sep 17 00:00:00 2001 From: Avik Niyogi Date: Wed, 23 Nov 2016 14:28:14 +0530 Subject: [PATCH 017/166] 8138771: java.awt.image.AbstractMultiResolutionImage needs customized spec for methods of Image which it implements Reviewed-by: flar, alexsch --- .../image/AbstractMultiResolutionImage.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java index 9d190a92e2c..89c43879ac3 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java @@ -64,27 +64,71 @@ import java.awt.Image; public abstract class AbstractMultiResolutionImage extends java.awt.Image implements MultiResolutionImage { + /** + * This method simply delegates to the same method on the base image and + * it is equivalent to: {@code getBaseImage().getWidth(observer)}. + * + * @return the width of the base image, or -1 if the width is not yet known + * @see #getBaseImage() + * + * @since 9 + */ @Override public int getWidth(ImageObserver observer) { return getBaseImage().getWidth(observer); } + /** + * This method simply delegates to the same method on the base image and + * it is equivalent to: {@code getBaseImage().getHeight(observer)}. + * + * @return the height of the base image, or -1 if the height is not yet known + * @see #getBaseImage() + * + * @since 9 + */ @Override public int getHeight(ImageObserver observer) { return getBaseImage().getHeight(observer); } + /** + * This method simply delegates to the same method on the base image and + * it is equivalent to: {@code getBaseImage().getSource()}. + * + * @return the image producer that produces the pixels for the base image + * @see #getBaseImage() + * + * @since 9 + */ @Override public ImageProducer getSource() { return getBaseImage().getSource(); } + /** + * As per the contract of the base {@code Image#getGraphics()} method, + * this implementation will always throw {@code UnsupportedOperationException} + * since only off-screen images can return a {@code Graphics} object. + * + * @return throws {@code UnsupportedOperationException} + * @throws UnsupportedOperationException this method is not supported + */ @Override public Graphics getGraphics() { throw new UnsupportedOperationException("getGraphics() not supported" + " on Multi-Resolution Images"); } + /** + * This method simply delegates to the same method on the base image and + * it is equivalent to: {@code getBaseImage().getProperty(name, observer)}. + * + * @return the value of the named property in the base image + * @see #getBaseImage() + * + * @since 9 + */ @Override public Object getProperty(String name, ImageObserver observer) { return getBaseImage().getProperty(name, observer); From 7c98a302526442f6cd0ac5dc7ca6f7c0b679681f Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Thu, 24 Nov 2016 15:27:33 +0100 Subject: [PATCH 018/166] 8170284: Move fine granular hotspot make targets to top level Reviewed-by: tbell --- common/autoconf/bootcycle-spec.gmk.in | 3 - common/autoconf/buildjdk-spec.gmk.in | 2 +- common/autoconf/flags.m4 | 25 ++++--- common/autoconf/generated-configure.sh | 99 ++++++++++++-------------- common/autoconf/hotspot.m4 | 15 ++++ common/autoconf/source-dirs.m4 | 22 +----- common/autoconf/spec.gmk.in | 3 +- make/Help.gmk | 6 ++ make/Main.gmk | 64 ++++++++++++++--- 9 files changed, 139 insertions(+), 100 deletions(-) diff --git a/common/autoconf/bootcycle-spec.gmk.in b/common/autoconf/bootcycle-spec.gmk.in index e26450ae3fc..adde830e382 100644 --- a/common/autoconf/bootcycle-spec.gmk.in +++ b/common/autoconf/bootcycle-spec.gmk.in @@ -50,9 +50,6 @@ BOOT_JDK := $(JDK_IMAGE_DIR) # The bootcycle build has a different output directory OLD_BUILD_OUTPUT:=@BUILD_OUTPUT@ BUILD_OUTPUT:=$(OLD_BUILD_OUTPUT)/bootcycle-build -# The HOTSPOT_DIST dir is not defined relative to BUILD_OUTPUT in spec.gmk. Must not -# use space in this patsubst to avoid leading space in HOTSPOT_DIST. -HOTSPOT_DIST:=$(patsubst $(OLD_BUILD_OUTPUT)%,$(BUILD_OUTPUT)%,$(HOTSPOT_DIST)) SJAVAC_SERVER_DIR:=$(patsubst $(OLD_BUILD_OUTPUT)%, $(BUILD_OUTPUT)%, $(SJAVAC_SERVER_DIR)) JAVA_CMD:=$(BOOT_JDK)/bin/java diff --git a/common/autoconf/buildjdk-spec.gmk.in b/common/autoconf/buildjdk-spec.gmk.in index dba07605a22..f38635f3822 100644 --- a/common/autoconf/buildjdk-spec.gmk.in +++ b/common/autoconf/buildjdk-spec.gmk.in @@ -44,7 +44,6 @@ SYSROOT_LDFLAGS := @BUILD_SYSROOT_LDFLAGS@ # These directories should not be moved to BUILDJDK_OUTPUTDIR HOTSPOT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_OUTPUTDIR)) -HOTSPOT_DIST := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_DIST)) SUPPORT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(SUPPORT_OUTPUTDIR)) JDK_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(JDK_OUTPUTDIR)) IMAGES_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(IMAGES_OUTPUTDIR)) @@ -156,3 +155,4 @@ JVM_VARIANT_KERNEL := false JVM_VARIANT_ZERO := false JVM_VARIANT_ZEROSHARK := false JVM_VARIANT_CORE := false +JVM_VARIANT_MAIN := server diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index eb912119e70..5fe8696b481 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -1160,19 +1160,18 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER], -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)" if test "x$1" = "xTARGET"; then - # On some platforms (mac) the linker warns about non existing -L dirs. - # Add server first if available. Linking aginst client does not always produce the same results. - # Only add client/minimal dir if client/minimal is being built. - # Default to server for other variants. - if HOTSPOT_CHECK_JVM_VARIANT(server); then - $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server" - elif HOTSPOT_CHECK_JVM_VARIANT(client); then - $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client" - elif HOTSPOT_CHECK_JVM_VARIANT(minimal); then - $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal" - else - $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server" - fi + # On some platforms (mac) the linker warns about non existing -L dirs. + # For any of the variants server, client or minimal, the dir matches the + # variant name. The "main" variant should be used for linking. For the + # rest, the dir is just server. + if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) \ + || HOTSPOT_CHECK_JVM_VARIANT(minimal); then + $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \ + -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/$JVM_VARIANT_MAIN" + else + $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \ + -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server" + fi elif test "x$1" = "xBUILD"; then # When building a buildjdk, it's always only the server variant $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \ diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 131556f50ad..c7a5bb9de6a 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -872,8 +872,6 @@ IMPORT_MODULES_CONF IMPORT_MODULES_LIBS IMPORT_MODULES_CMDS IMPORT_MODULES_CLASSES -BUILD_HOTSPOT -HOTSPOT_DIST BUILD_OUTPUT JDK_TOPDIR NASHORN_TOPDIR @@ -966,6 +964,7 @@ CONF_NAME SPEC SDKROOT XCODEBUILD +JVM_VARIANT_MAIN VALID_JVM_VARIANTS JVM_VARIANTS DEBUG_LEVEL @@ -2098,9 +2097,8 @@ Optional Packages: compatibility and is ignored --with-override-jdk Deprecated. Option is kept for backwards compatibility and is ignored - --with-import-hotspot import hotspot binaries from this jdk image or - hotspot build dist dir instead of building from - source + --with-import_hotspot Deprecated. Option is kept for backwards + compatibility and is ignored --with-import-modules import a set of prebuilt modules either as a zip file or an exploded directory --with-toolchain-type the toolchain type (or family) to use, use '--help' @@ -5093,7 +5091,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1478524503 +DATE_WHEN_GENERATED=1479997584 ############################################################################### # @@ -16755,6 +16753,21 @@ $as_echo "$as_me: Unknown variant(s) specified: $INVALID_VARIANTS" >&6;} as_fn_error $? "You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS." "$LINENO" 5 fi + # The "main" variant is the one used by other libs to link against during the + # build. + if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then + MAIN_VARIANT_PRIO_ORDER="server client minimal" + for variant in $MAIN_VARIANT_PRIO_ORDER; do + if [[ " $JVM_VARIANTS " =~ " $variant " ]] ; then + JVM_VARIANT_MAIN="$variant" + break + fi + done + else + JVM_VARIANT_MAIN="$JVM_VARIANTS" + fi + + @@ -30996,33 +31009,17 @@ fi BUILD_OUTPUT="$OUTPUT_ROOT" - - HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist" - BUILD_HOTSPOT=true + JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk" -# Check whether --with-import-hotspot was given. +# Check whether --with-import_hotspot was given. if test "${with_import_hotspot+set}" = set; then : - withval=$with_import_hotspot; + withval=$with_import_hotspot; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-import_hotspot is deprecated and will be ignored." >&5 +$as_echo "$as_me: WARNING: Option --with-import_hotspot is deprecated and will be ignored." >&2;} fi - if test "x$with_import_hotspot" != x; then - CURDIR="$PWD" - cd "$with_import_hotspot" - HOTSPOT_DIST="`pwd`" - cd "$CURDIR" - if ! (test -d $HOTSPOT_DIST/lib && test -d $HOTSPOT_DIST/jre/lib); then - as_fn_error $? "You have to import hotspot from a full jdk image or hotspot build dist dir!" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if hotspot should be imported" >&5 -$as_echo_n "checking if hotspot should be imported... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes from $HOTSPOT_DIST" >&5 -$as_echo "yes from $HOTSPOT_DIST" >&6; } - BUILD_HOTSPOT=false - fi - JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk" @@ -50431,19 +50428,18 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)" if test "xTARGET" = "xTARGET"; then - # On some platforms (mac) the linker warns about non existing -L dirs. - # Add server first if available. Linking aginst client does not always produce the same results. - # Only add client/minimal dir if client/minimal is being built. - # Default to server for other variants. - if [[ " $JVM_VARIANTS " =~ " server " ]] ; then - JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server" - elif [[ " $JVM_VARIANTS " =~ " client " ]] ; then - JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client" - elif [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then - JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal" - else - JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server" - fi + # On some platforms (mac) the linker warns about non existing -L dirs. + # For any of the variants server, client or minimal, the dir matches the + # variant name. The "main" variant should be used for linking. For the + # rest, the dir is just server. + if [[ " $JVM_VARIANTS " =~ " server " ]] || [[ " $JVM_VARIANTS " =~ " client " ]] \ + || [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then + JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \ + -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/$JVM_VARIANT_MAIN" + else + JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \ + -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server" + fi elif test "xTARGET" = "xBUILD"; then # When building a buildjdk, it's always only the server variant JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \ @@ -51255,19 +51251,18 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)" if test "xBUILD" = "xTARGET"; then - # On some platforms (mac) the linker warns about non existing -L dirs. - # Add server first if available. Linking aginst client does not always produce the same results. - # Only add client/minimal dir if client/minimal is being built. - # Default to server for other variants. - if [[ " $JVM_VARIANTS " =~ " server " ]] ; then - OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server" - elif [[ " $JVM_VARIANTS " =~ " client " ]] ; then - OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/client" - elif [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then - OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/minimal" - else - OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server" - fi + # On some platforms (mac) the linker warns about non existing -L dirs. + # For any of the variants server, client or minimal, the dir matches the + # variant name. The "main" variant should be used for linking. For the + # rest, the dir is just server. + if [[ " $JVM_VARIANTS " =~ " server " ]] || [[ " $JVM_VARIANTS " =~ " client " ]] \ + || [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then + OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \ + -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/$JVM_VARIANT_MAIN" + else + OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \ + -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server" + fi elif test "xBUILD" = "xBUILD"; then # When building a buildjdk, it's always only the server variant OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \ diff --git a/common/autoconf/hotspot.m4 b/common/autoconf/hotspot.m4 index cda292e3f87..e44a47ad084 100644 --- a/common/autoconf/hotspot.m4 +++ b/common/autoconf/hotspot.m4 @@ -111,8 +111,23 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.]) fi + # The "main" variant is the one used by other libs to link against during the + # build. + if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then + MAIN_VARIANT_PRIO_ORDER="server client minimal" + for variant in $MAIN_VARIANT_PRIO_ORDER; do + if HOTSPOT_CHECK_JVM_VARIANT($variant); then + JVM_VARIANT_MAIN="$variant" + break + fi + done + else + JVM_VARIANT_MAIN="$JVM_VARIANTS" + fi + AC_SUBST(JVM_VARIANTS) AC_SUBST(VALID_JVM_VARIANTS) + AC_SUBST(JVM_VARIANT_MAIN) if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then # zero behaves as a platform and rewrites these values. This is really weird. :( diff --git a/common/autoconf/source-dirs.m4 b/common/autoconf/source-dirs.m4 index 940707e81a0..fae398fb404 100644 --- a/common/autoconf/source-dirs.m4 +++ b/common/autoconf/source-dirs.m4 @@ -62,27 +62,9 @@ AC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS], [ BUILD_OUTPUT="$OUTPUT_ROOT" AC_SUBST(BUILD_OUTPUT) - - HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist" - BUILD_HOTSPOT=true - AC_SUBST(HOTSPOT_DIST) - AC_SUBST(BUILD_HOTSPOT) - AC_ARG_WITH(import-hotspot, [AS_HELP_STRING([--with-import-hotspot], - [import hotspot binaries from this jdk image or hotspot build dist dir instead of building from source])]) - if test "x$with_import_hotspot" != x; then - CURDIR="$PWD" - cd "$with_import_hotspot" - HOTSPOT_DIST="`pwd`" - cd "$CURDIR" - if ! (test -d $HOTSPOT_DIST/lib && test -d $HOTSPOT_DIST/jre/lib); then - AC_MSG_ERROR([You have to import hotspot from a full jdk image or hotspot build dist dir!]) - fi - AC_MSG_CHECKING([if hotspot should be imported]) - AC_MSG_RESULT([yes from $HOTSPOT_DIST]) - BUILD_HOTSPOT=false - fi - JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk" + + BASIC_DEPRECATED_ARG_WITH(import_hotspot) ]) ################################################################################ diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index e2d7be936f6..c7ae75b9070 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -220,6 +220,7 @@ JDK_VARIANT:=@JDK_VARIANT@ # Which JVM variants to build (space-separated list) JVM_VARIANTS := @JVM_VARIANTS@ +JVM_VARIANT_MAIN := @JVM_VARIANT_MAIN@ # Lists of features per variant. Only relevant for the variants listed in # JVM_VARIANTS. @@ -273,8 +274,6 @@ JAVADOC_OUTPUTDIR = $(DOCS_IMAGE_DIR) CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@ BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk -HOTSPOT_DIST=@HOTSPOT_DIST@ - BUILD_HOTSPOT=@BUILD_HOTSPOT@ BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@ diff --git a/make/Help.gmk b/make/Help.gmk index 45a5820c52e..bd10fa2ccb7 100644 --- a/make/Help.gmk +++ b/make/Help.gmk @@ -66,6 +66,12 @@ help: $(info $(_) make clean-- # Remove all build results related to a certain) $(info $(_) # module and phase) $(info ) + $(info Targets for Hotspot) + $(info $(_) make hotspot # Build all of hotspot) + $(info $(_) make hotspot- # Build just the specified jvm variant) + $(info $(_) make hotspot-gensrc # Only build the gensrc part of hotspot) + $(info $(_) make hotspot-- # Build the specified phase for the specified module) + $(info ) $(info Targets for specific modules) $(info $(_) make # Build and everything it depends on) $(info $(_) make - # Compile the specified phase for the specified module) diff --git a/make/Main.gmk b/make/Main.gmk index 60c705d011d..b070dd743f1 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -236,15 +236,35 @@ ALL_TARGETS += $(LAUNCHER_TARGETS) ################################################################################ # Build hotspot target -ifeq ($(BUILD_HOTSPOT),true) - hotspot: - +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildHotspot.gmk) -endif +HOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS)) +HOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS)) +HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS)) + +define DeclareHotspotGensrcRecipe + hotspot-$1-gensrc: + $$(call LogInfo, Building JVM variant '$1' with features '$(JVM_FEATURES_$1)') + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f gensrc/GenerateSources.gmk \ + JVM_VARIANT=$1) +endef + +$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v))) + +define DeclareHotspotLibsRecipe + hotspot-$1-libs: + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f lib/CompileLibraries.gmk \ + JVM_VARIANT=$1) +endef + +$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v))) + +hotspot-jsig: + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f lib/CompileLibjsig.gmk) hotspot-ide-project: +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) -ALL_TARGETS += hotspot hotspot-ide-project +ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \ + $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project ################################################################################ # Build demos and samples targets @@ -547,11 +567,18 @@ else $(JAVA_TARGETS): interim-langtools + # Declare dependencies between hotspot-* targets + $(foreach v, $(JVM_VARIANTS), \ + $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \ + $(eval hotspot-$v-libs: hotspot-$v-gensrc) \ + ) + hotspot-ide-project: hotspot exploded-image generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs - $(LIBS_TARGETS): hotspot + # Building one JVM variant is enough to start building the other libs + $(LIBS_TARGETS): hotspot-$(JVM_VARIANT_MAIN)-libs $(LAUNCHER_TARGETS): java.base-libs @@ -617,6 +644,9 @@ else $(addsuffix -jmod, $(call FindAllUpgradeableModules)), $(JMOD_TARGETS)) endif + # Building java.base-jmod requires all of hotspot to be built. + java.base-jmod: hotspot + # Declare dependencies from -jmod to all other module targets # When creating a BUILDJDK, the java compilation has already been done by the # normal build and copied in. @@ -702,7 +732,7 @@ else docs-javadoc: $(GENSRC_TARGETS) rmic # The gensrc step for jdk.jdi creates an html file that is used by docs-copy. - docs-copy: hotspot jdk.jdi-gensrc + docs-copy: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc docs-zip: docs-javadoc docs-copy @@ -725,7 +755,8 @@ else test-image-failure-handler: build-test-failure-handler - build-test-hotspot-jtreg-native: buildtools-jdk hotspot + build-test-hotspot-jtreg-native: buildtools-jdk \ + hotspot-$(JVM_VARIANT_MAIN)-libs build-test-jdk-jtreg-native: buildtools-jdk @@ -759,6 +790,16 @@ endif buildtools: buildtools-langtools interim-langtools interim-rmic \ buildtools-jdk +hotspot: $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig + +hotspot-libs: hotspot-jsig + +# Create targets hotspot-libs and hotspot-gensrc. +$(foreach v, $(JVM_VARIANTS), \ + $(eval hotspot-libs: hotspot-$v-libs) \ + $(eval hotspot-gensrc: hotspot-$v-gensrc) \ +) + gensrc: $(GENSRC_TARGETS) gendata: $(GENDATA_TARGETS) @@ -788,6 +829,10 @@ $(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic)) $(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs)) $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers)) $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy)) + +# Building java.base includes building all of hotspot. +java.base: hotspot + demos: demos-jdk samples: samples-jdk @@ -843,7 +888,8 @@ all-images: product-images test-image docs-image # all-bundles packages all our deliverables as tar.gz bundles. all-bundles: product-bundles test-bundles docs-bundles -ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \ +ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \ + copy java rmic libs launchers jmods \ jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples \ exploded-image-base exploded-image \ create-buildjdk mac-bundles product-images docs-image test-image all-images \ From 1d62b594447307e123f1bdbffce4e8e5c174067c Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 23 Nov 2016 12:25:21 +0300 Subject: [PATCH 019/166] 8170228: register closed @requires property setter Reviewed-by: vlivanov, dfazunen --- test/jtreg-ext/requires/VMProps.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index 5c088b6008a..ab44e466ad4 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -25,6 +25,7 @@ package requires; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -62,7 +63,7 @@ public class VMProps implements Callable> { map.put("vm.debug", vmDebug()); vmGC(map); // vm.gc.X = true/false - dump(map); + VMProps.dump(map); return map; } @@ -180,7 +181,7 @@ public class VMProps implements Callable> { * * @param map */ - protected void dump(Map map) { + protected static void dump(Map map) { String dumpFileName = System.getProperty("vmprops.dump"); if (dumpFileName == null) { return; @@ -188,7 +189,7 @@ public class VMProps implements Callable> { List lines = new ArrayList<>(); map.forEach((k, v) -> lines.add(k + ":" + v)); try { - Files.write(Paths.get(dumpFileName), lines); + Files.write(Paths.get(dumpFileName), lines, StandardOpenOption.APPEND); } catch (IOException e) { throw new RuntimeException("Failed to dump properties into '" + dumpFileName + "'", e); From 9d87230fccfa54c409643c67c3cd2fbb2cfb15d0 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Wed, 23 Nov 2016 18:48:02 +0300 Subject: [PATCH 020/166] 8140525: AwtFrame::WmShowWindow() may steal focus Reviewed-by: serb, ssadetsky --- .../java.desktop/windows/native/libawt/windows/awt_Frame.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp index 6c8d65a47c7..9bc6366d17b 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp @@ -484,7 +484,10 @@ MsgRouting AwtFrame::WmShowWindow(BOOL show, UINT status) if (fgProcessID != ::GetCurrentProcessId()) { AwtWindow* window = (AwtWindow*)GetComponent(GetHWnd()); - if (window != NULL && window->IsFocusableWindow() && window->IsAutoRequestFocus() && + if (window != NULL && + window->IsFocusableWindow() && + window->IsAutoRequestFocus() && + !::IsWindowVisible(GetHWnd()) && // the window is really showing !::IsWindow(GetModalBlocker(GetHWnd()))) { // When the Java process is not allowed to set the foreground window From f04a27dbdcc70479f9945f64939b108ebe03e00f Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 24 Nov 2016 11:58:52 +0530 Subject: [PATCH 021/166] 8048702: Deprecate obsolete classes in javax/swing/plaf/metal/MetalFileChooserUI.java Reviewed-by: serb, alexsch --- .../classes/javax/swing/plaf/metal/MetalFileChooserUI.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java index 91132582193..32db72db408 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java @@ -571,7 +571,9 @@ public class MetalFileChooserUI extends BasicFileChooserUI { /** * Obsolete class, not used in this version. + * @deprecated As of JDK version 9. Obsolete class. */ + @Deprecated(since = "9") protected class SingleClickListener extends MouseAdapter { /** * Constructs an instance of {@code SingleClickListener}. @@ -584,7 +586,9 @@ public class MetalFileChooserUI extends BasicFileChooserUI { /** * Obsolete class, not used in this version. + * @deprecated As of JDK version 9. Obsolete class. */ + @Deprecated(since = "9") @SuppressWarnings("serial") // Superclass is not serializable across versions protected class FileRenderer extends DefaultListCellRenderer { } From fdedfbc0f35d2b275db6c181a92eb451565f0334 Mon Sep 17 00:00:00 2001 From: Harsha Wardhana B Date: Thu, 24 Nov 2016 12:04:44 +0530 Subject: [PATCH 022/166] 8141591: javax/management/remote/mandatory/threads/ExecutorTest.java fails intermittently Reviewed-by: dfuchs --- .../remote/internal/ClientNotifForwarder.java | 36 ++++- .../threads/ExecutorShutdownTest.java | 148 ++++++++++++++++++ 2 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 jdk/test/javax/management/remote/mandatory/threads/ExecutorShutdownTest.java diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java index e0860f8e1f0..f2014eee794 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,9 @@ import javax.management.remote.TargetedNotification; import com.sun.jmx.remote.util.ClassLogger; import com.sun.jmx.remote.util.EnvHelp; +import java.lang.reflect.UndeclaredThrowableException; import java.rmi.UnmarshalException; +import java.util.concurrent.RejectedExecutionException; public abstract class ClientNotifForwarder { @@ -559,10 +561,38 @@ public abstract class ClientNotifForwarder { } } } else { - executor.execute(this); + try { + executor.execute(this); + } catch (Exception e) { + if (isRejectedExecutionException(e)) { + // We reached here because the executor was shutdown. + // If executor was supplied by client, then it was shutdown + // abruptly or JMXConnector was shutdown along with executor + // while this thread was suspended at L564. + if (!(executor instanceof LinearExecutor)) { + // Spawn new executor that will do cleanup if JMXConnector is closed + // or keep notif system running otherwise + executor = new LinearExecutor(); + executor.execute(this); + } + } else { + throw e; + } + } } } + private boolean isRejectedExecutionException(Exception e) { + Throwable cause = e; + while (cause != null) { + if (cause instanceof RejectedExecutionException) { + return true; + } + cause = cause.getCause(); + } + return false; + } + void dispatchNotification(TargetedNotification tn, Integer myListenerID, Map listeners) { @@ -866,7 +896,7 @@ public abstract class ClientNotifForwarder { // ------------------------------------------------- private final ClassLoader defaultClassLoader; - private final Executor executor; + private Executor executor; private final Map infoList = new HashMap(); diff --git a/jdk/test/javax/management/remote/mandatory/threads/ExecutorShutdownTest.java b/jdk/test/javax/management/remote/mandatory/threads/ExecutorShutdownTest.java new file mode 100644 index 00000000000..003780cc474 --- /dev/null +++ b/jdk/test/javax/management/remote/mandatory/threads/ExecutorShutdownTest.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @bug 8141591 + * @summary Tests if notifications are received after executor is shutdown + * @author Harsha Wardhana B + * @modules java.management + * @run clean ExecutorShutdownTest + * @run build ExecutorShutdownTest + * @run main ExecutorShutdownTest + */ +import java.util.*; +import java.util.concurrent.*; +import javax.management.*; +import javax.management.remote.*; + +/* + When you create a JMXConnector client, you can supply a + "fetch-notifications Executor", which is a + java.util.concurrent.Executor that will be used each time the + connector client wants to call RMIConnection.fetchNotifications. + If such executor is not supplies, the connector client will fallback + on default LinearExecutor. This test checks if user supplied executor + is shutdown abruptly, LinearExecutor is used to handle notifications. + */ +public class ExecutorShutdownTest { + + private static final String EXECUTOR_PROPERTY + = "jmx.remote.x.fetch.notifications.executor"; + private static final String NOTIF_TYPE = "test.type"; + + public static void main(String[] args) throws Exception { + + // Start JMXConnector Server + JMXServiceURL url = new JMXServiceURL("rmi", null, 0); + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + ObjectName emitName = new ObjectName("blah:type=Emitter"); + mbs.registerMBean(new Emitter(), emitName); + JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, + null, + mbs); + cs.start(); + + // Create executor to provide to JMXConnector client + ExecutorService executor = Executors.newCachedThreadPool(); + Map env = new HashMap<>(); + env.put(EXECUTOR_PROPERTY, executor); + JMXServiceURL addr = cs.getAddress(); + + try (JMXConnector cc = JMXConnectorFactory.connect(addr, env)) { + MBeanServerConnection mbsc = cc.getMBeanServerConnection(); + EmitterMBean emitter = (EmitterMBean) MBeanServerInvocationHandler.newProxyInstance(mbsc, + emitName, + EmitterMBean.class, + false); + SemaphoreListener listener = new SemaphoreListener(); + NotificationFilterSupport filter = new NotificationFilterSupport(); + filter.enableType(NOTIF_TYPE); + mbsc.addNotificationListener(emitName, listener, filter, null); + + final int NOTIF_COUNT = 3; + for (int i = 0; i < NOTIF_COUNT; i++) { + emitter.emit(); + listener.await(); + } + Thread.sleep(1); + listener.checkUnavailable(); + System.out.println("Got notifications with client provided executor"); + + // After shutting down executor, notifications are handled by linear executor + executor.shutdown(); + for (int i = 0; i < NOTIF_COUNT; i++) { + emitter.emit(); + listener.await(); + } + Thread.sleep(1); + listener.checkUnavailable(); + System.out.println("Got notifications with linear executor"); + } + cs.stop(); + System.out.println("TEST PASSED !!!"); + } + + /* Simple MBean that sends a notification every time we ask it to. */ + public static interface EmitterMBean { + + public void emit(); + } + + public static class Emitter + extends NotificationBroadcasterSupport implements EmitterMBean { + + public void emit() { + sendNotification(new Notification(NOTIF_TYPE, this, seq++)); + } + + private long seq = 1; + } + + /* Simple NotificationListener that allows you to wait until a + notification has been received. Since it uses a semaphore, you + can wait either before or after the notification has in fact + been received and it will work in either case. */ + private static class SemaphoreListener implements NotificationListener { + + void await() throws InterruptedException { + semaphore.acquire(); + } + + /* Ensure no extra notifications were received. If we can acquire + the semaphore, that means its release() method was called more + times than its acquire() method, which means there were too + many notifications. */ + void checkUnavailable() throws Exception { + if (semaphore.tryAcquire()) { + throw new Exception("Got extra notifications!"); + } + } + + public void handleNotification(Notification n, Object h) { + semaphore.release(); + } + + private final Semaphore semaphore = new Semaphore(0); + } +} From b61b0b8c006df152f014dfcd9d9800638ec371ae Mon Sep 17 00:00:00 2001 From: Avik Niyogi Date: Thu, 24 Nov 2016 14:11:32 +0530 Subject: [PATCH 023/166] 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java Reviewed-by: psadhukhan, serb --- .../JRadioButton/8033699/bug8033699.java | 76 ++++++++++++++----- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java b/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java index 4b95dc92bb3..a9ad28e7504 100644 --- a/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java +++ b/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java @@ -26,22 +26,31 @@ * @key headful * @library ../../regtesthelpers * @build Util - * @bug 8033699 8154043 + * @bug 8033699 8154043 8167160 * @summary Incorrect radio button behavior when pressing tab key - * @author Vivi An * @run main bug8033699 */ - -import javax.swing.*; -import javax.swing.event.*; -import java.awt.event.*; -import java.awt.*; +import java.awt.KeyboardFocusManager; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; public class bug8033699 { - private static Robot robot; + private static JFrame mainFrame; + private static Robot robot; private static JButton btnStart; - private static ButtonGroup btnGrp; private static JButton btnEnd; private static JButton btnMiddle; private static JRadioButton radioBtn1; @@ -51,7 +60,9 @@ public class bug8033699 { public static void main(String args[]) throws Throwable { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { + changeLAF(); createAndShowGUI(); } }); @@ -84,11 +95,30 @@ public class bug8033699 { // down key circle back to first button in grouped radio button runTest8(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + mainFrame.dispose(); + } + }); + } + + private static void changeLAF() { + String currentLAF = UIManager.getLookAndFeel().toString(); + System.out.println(currentLAF); + currentLAF = currentLAF.toLowerCase(); + if (currentLAF.contains("aqua") || currentLAF.contains("nimbus")) { + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception ex) { + ex.printStackTrace(); + } + } } private static void createAndShowGUI() { - JFrame mainFrame = new JFrame("Bug 8033699 - 8 Tests for Grouped/Non Group Radio Buttons"); - + mainFrame = new JFrame("Bug 8033699 - 8 Tests for Grouped/Non Group Radio Buttons"); btnStart = new JButton("Start"); btnEnd = new JButton("End"); btnMiddle = new JButton("Middle"); @@ -132,12 +162,13 @@ public class bug8033699 { } // Radio button Group as a single component when traversing through tab key - private static void runTest1() throws Exception{ + private static void runTest1() throws Exception { hitKey(robot, KeyEvent.VK_TAB); hitKey(robot, KeyEvent.VK_TAB); hitKey(robot, KeyEvent.VK_TAB); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) { System.out.println("Radio Button Group Go To Next Component through Tab Key failed"); @@ -148,9 +179,10 @@ public class bug8033699 { } // Non-Grouped Radio button as a single component when traversing through tab key - private static void runTest2() throws Exception{ + private static void runTest2() throws Exception { hitKey(robot, KeyEvent.VK_TAB); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnEnd) { System.out.println("Non Grouped Radio Button Go To Next Component through Tab Key failed"); @@ -161,11 +193,12 @@ public class bug8033699 { } // Non-Grouped Radio button and Group Radio button as a single component when traversing through shift-tab key - private static void runTest3() throws Exception{ + private static void runTest3() throws Exception { hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB); hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB); hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) { System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed"); @@ -176,10 +209,11 @@ public class bug8033699 { } // Using arrow key to move focus in radio button group - private static void runTest4() throws Exception{ + private static void runTest4() throws Exception { hitKey(robot, KeyEvent.VK_DOWN); hitKey(robot, KeyEvent.VK_RIGHT); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) { System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed"); @@ -189,10 +223,11 @@ public class bug8033699 { }); } - private static void runTest5() throws Exception{ + private static void runTest5() throws Exception { hitKey(robot, KeyEvent.VK_UP); hitKey(robot, KeyEvent.VK_LEFT); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) { System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed"); @@ -202,10 +237,11 @@ public class bug8033699 { }); } - private static void runTest6() throws Exception{ + private static void runTest6() throws Exception { hitKey(robot, KeyEvent.VK_UP); hitKey(robot, KeyEvent.VK_UP); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) { System.out.println("Radio button Group Circle Back To First Button Test"); @@ -215,9 +251,10 @@ public class bug8033699 { }); } - private static void runTest7() throws Exception{ + private static void runTest7() throws Exception { hitKey(robot, KeyEvent.VK_TAB); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnMiddle) { System.out.println("Separate Component added in button group layout"); @@ -227,9 +264,10 @@ public class bug8033699 { }); } - private static void runTest8() throws Exception{ + private static void runTest8() throws Exception { hitKey(robot, KeyEvent.VK_TAB); SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) { System.out.println("Separate Component added in button group layout"); From d63b1299f76526ac2b65c0128cda43805326bd14 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 25 Nov 2016 11:55:33 +0300 Subject: [PATCH 024/166] 8170226: Implement setting jtreg @requires property vm.jvmci Reviewed-by: kvn --- test/jtreg-ext/requires/VMProps.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index ab44e466ad4..06299e7ecd5 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -61,6 +61,7 @@ public class VMProps implements Callable> { map.put("vm.flightRecorder", vmFlightRecorder()); map.put("vm.simpleArch", vmArch()); map.put("vm.debug", vmDebug()); + map.put("vm.jvmci", vmJvmci()); vmGC(map); // vm.gc.X = true/false VMProps.dump(map); @@ -156,6 +157,14 @@ public class VMProps implements Callable> { return "" + System.getProperty("jdk.debug").contains("debug"); } + /** + * @return true if VM supports JVMCI and false otherwise + */ + protected String vmJvmci() { + // builds with jvmci have this flag + return "" + (WB.getBooleanVMFlag("EnableJVMCI") != null); + } + /** * For all existing GC sets vm.gc.X property. * Example vm.gc.G1=true means: From 893ec916559516ffe8b5dd139463c77a00b74bf8 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Mon, 28 Nov 2016 10:36:40 +0300 Subject: [PATCH 025/166] 8168135: The issue JDK-8164462 seems not fixed in b140 Reviewed-by: serb --- .../unix/classes/sun/awt/X11/XContentWindow.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java index 85e578b4052..74444b8d2d6 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -123,15 +123,26 @@ public final class XContentWindow extends XWindow { // Change in the size of the content window means, well, change of the size // Change in the location of the content window means change in insets boolean needHandleResize = !(newBounds.equals(getBounds())); + boolean needPaint = width <= 0 || height <= 0; reshape(newBounds); if (needHandleResize) { insLog.fine("Sending RESIZED"); handleResize(newBounds); } + if (needPaint) { + postPaintEvent(target, 0, 0, newBounds.width, newBounds.height); + } } finally { XToolkit.awtUnlock(); } - validateSurface(); + } + + @Override + public void handleExposeEvent(XEvent xev) { + if (width <= 0 || height <= 0) { + return; + } + super.handleExposeEvent(xev); } // NOTE: This method may be called by privileged threads. From 547092cf8d16d7045f651c8008ce7a778b20a5e4 Mon Sep 17 00:00:00 2001 From: Maksim Khramov Date: Mon, 28 Nov 2016 14:36:46 +0300 Subject: [PATCH 026/166] 8167284: [TESTBUG] [PIT] possible regression: javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java Reviewed-by: ssadetsky, yan --- .../FocusTraversal/FocusTraversal.java | 43 +++++-------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java b/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java index 4c773c0f7b1..9ab19f7b245 100644 --- a/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java +++ b/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java @@ -42,7 +42,6 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.KeyStroke; -import javax.swing.LookAndFeel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; @@ -133,41 +132,19 @@ public class FocusTraversal { } private static void runTestCase() throws Exception { - LookAndFeel lookAndFeel = UIManager.getLookAndFeel(); focusOn(a); - if (isExcludedLookAndFeel(lookAndFeel)) { - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - robot.waitForIdle(); - isFocusOwner(b, "forward"); - robot.keyPress(KeyEvent.VK_SHIFT); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_SHIFT); - robot.waitForIdle(); - isFocusOwner(a, "backward"); - } else { + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + robot.waitForIdle(); + isFocusOwner(next, "forward"); + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_SHIFT); + robot.waitForIdle(); + isFocusOwner(a, "backward"); - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - robot.waitForIdle(); - isFocusOwner(next, "forward"); - robot.keyPress(KeyEvent.VK_SHIFT); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_SHIFT); - robot.waitForIdle(); - isFocusOwner(d, "backward"); - } - - } - - private static boolean isExcludedLookAndFeel(LookAndFeel lookAndFeel) { - - return lookAndFeel.toString().toLowerCase().contains("aqua") - || lookAndFeel.toString().toLowerCase().contains("nimbus") - || lookAndFeel.toString().toLowerCase().contains("gtk"); } private static void focusOn(Component component) From 1ac940c263c5b33c2b0cd5cb17c8aece32fc687f Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 29 Nov 2016 09:54:16 -0800 Subject: [PATCH 027/166] 8167103: Intermittent font loading failure on macOS with JFXPanel application Reviewed-by: serb, psadhukhan --- .../macosx/classes/sun/font/CFontManager.java | 18 +++++++++++++--- .../macosx/native/libawt_lwawt/font/AWTFont.m | 21 +++++++------------ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java index 0c505b28576..45f48328717 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java +++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java @@ -141,12 +141,24 @@ public final class CFontManager extends SunFontManager { } } - protected void registerFontsInDir(String dirName, boolean useJavaRasterizer, int fontRank, boolean defer, boolean resolveSymLinks) { - loadNativeDirFonts(dirName); + protected void registerFontsInDir(final String dirName, boolean useJavaRasterizer, + int fontRank, boolean defer, boolean resolveSymLinks) { + + String[] files = AccessController.doPrivileged((PrivilegedAction) () -> { + return new File(dirName).list(getTrueTypeFilter()); + }); + + if (files == null) { + return; + } else { + for (String f : files) { + loadNativeDirFonts(dirName+File.separator+f); + } + } super.registerFontsInDir(dirName, useJavaRasterizer, fontRank, defer, resolveSymLinks); } - private native void loadNativeDirFonts(String dirName); + private native void loadNativeDirFonts(String fontPath); private native void loadNativeFonts(); void registerFont(String fontName, String fontFamilyName) { diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m index d374e5a1241..bca21021347 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m @@ -404,19 +404,14 @@ Java_sun_font_CFontManager_loadNativeDirFonts { JNF_COCOA_ENTER(env); - NSString *nsFilePath = JNFJavaToNSString(env, filename); - - FSRef iFile; - OSStatus status = CreateFSRef(&iFile, nsFilePath); - - if (status == noErr) { - ATSFontContainerRef oContainer; - status = ATSFontActivateFromFileReference(&iFile, kATSFontContextLocal, - kATSFontFormatUnspecified, - NULL, kNilOptions, - &oContainer); - } - + NSString *path = JNFJavaToNSString(env, filename); + NSURL *url = [NSURL fileURLWithPath:(NSString *)path]; + bool res = CTFontManagerRegisterFontsForURL((CFURLRef)url, kCTFontManagerScopeProcess, nil); +#ifdef DEBUG + NSLog(@"path is : %@", (NSString*)path); + NSLog(@"url is : %@", (NSString*)url); + printf("res is %d\n", res); +#endif JNF_COCOA_EXIT(env); } From 1a34c7a1aeadfad663a50598448487ed08e8f0a5 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 29 Nov 2016 15:15:20 -0800 Subject: [PATCH 028/166] 8170428: Move src.zip to JDK/lib/src.zip Reviewed-by: jjg --- .../share/classes/jdk/jshell/SourceCodeAnalysisImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java index 7254f2030d0..53a1ee991d1 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java @@ -1273,7 +1273,7 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis { } List result = new ArrayList<>(); Path home = Paths.get(System.getProperty("java.home")); - Path srcZip = home.resolve("src.zip"); + Path srcZip = home.resolve("lib").resolve("src.zip"); if (!Files.isReadable(srcZip)) srcZip = home.getParent().resolve("src.zip"); if (Files.isReadable(srcZip)) { From 0043906c46a3b4ced203f2053c94b456b3d4d34d Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 29 Nov 2016 15:20:30 -0800 Subject: [PATCH 029/166] 8170428: Move src.zip to JDK/lib/src.zip Reviewed-by: prr, billyh, pbhat --- make/Images.gmk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/Images.gmk b/make/Images.gmk index 47fcd8f3323..a20b930c249 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -354,11 +354,11 @@ JDK_TARGETS += $(JDK_DOC_TARGETS) ################################################################################ # src.zip -$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip +$(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)) $(install-file) -JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip +JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip ################################################################################ # /demo dir From 1d0671e8dc428eb08d02d7d8572cd31e237ccfee Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Wed, 30 Nov 2016 10:47:57 +0300 Subject: [PATCH 030/166] 8160087: Change IOOBE to warning in the scenarios when it had not being thrown before the JDK-8078514 Reviewed-by: azvegint, alexsch --- .../classes/javax/swing/DefaultRowSorter.java | 31 +++-- .../DefaultRowSorterIOOBEtest.java | 119 ++++++++++++++++++ 2 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 jdk/test/javax/swing/JTable/SorterIOOBEtest/DefaultRowSorterIOOBEtest.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java b/jdk/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java index 5bc2f0687a9..542e1cb3c16 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java @@ -182,6 +182,8 @@ public abstract class DefaultRowSorter extends RowSorter { */ private int modelRowCount; + // Whether to print warning about JDK-8160087 + private static boolean warning8160087 = true; /** * Creates an empty DefaultRowSorter. @@ -489,10 +491,7 @@ public abstract class DefaultRowSorter extends RowSorter { */ public int convertRowIndexToView(int index) { if (modelToView == null) { - if (index < 0 || index >= modelRowCount) { - throw new IndexOutOfBoundsException("Invalid index"); - } - return index; + return convertUnsortedUnfiltered(index); } return modelToView[index]; } @@ -504,14 +503,30 @@ public abstract class DefaultRowSorter extends RowSorter { */ public int convertRowIndexToModel(int index) { if (viewToModel == null) { - if (index < 0 || index >= modelRowCount) { - throw new IndexOutOfBoundsException("Invalid index"); - } - return index; + return convertUnsortedUnfiltered(index); } return viewToModel[index].modelIndex; } + private int convertUnsortedUnfiltered(int index) { + if (index < 0 || index >= modelRowCount) { + if(index >= modelRowCount && + index < getModelWrapper().getRowCount()) { + // 8160087 + if(warning8160087) { + warning8160087 = false; + System.err.println("WARNING: row index is bigger than " + + "sorter's row count. Most likely this is a wrong " + + "sorter usage."); + } + } else { + throw new IndexOutOfBoundsException("Invalid index"); + } + } + return index; + } + + private boolean isUnsorted() { List keys = getSortKeys(); int keySize = keys.size(); diff --git a/jdk/test/javax/swing/JTable/SorterIOOBEtest/DefaultRowSorterIOOBEtest.java b/jdk/test/javax/swing/JTable/SorterIOOBEtest/DefaultRowSorterIOOBEtest.java new file mode 100644 index 00000000000..fec08479521 --- /dev/null +++ b/jdk/test/javax/swing/JTable/SorterIOOBEtest/DefaultRowSorterIOOBEtest.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8160087 + * @summary Change IOOBE to warning in the scenarios when it had not being + * thrown before the JDK-8078514 + * @run main/othervm DefaultRowSorterIOOBEtest + */ + +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.List; + +public class DefaultRowSorterIOOBEtest extends TableRowSorter { + static List rows = new ArrayList<>(); + + static TableModel tableModel = new AbstractTableModel() { + + @Override + public int getRowCount() { + return rows.size(); + } + + @Override + public int getColumnCount() { + return 1; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + return rows.get(rowIndex); + } + }; + + public static void main(String[] args) { + DefaultRowSorter sorter = + new DefaultRowSorter<>() { + { + setModelWrapper(new SorterModelWrapper()); + } + }; + + PrintStream err = System.err; + ByteArrayOutputStream bos = new ByteArrayOutputStream(10000) { + @Override + public synchronized void write(byte[] b, int off, int len) { + super.write(b, off, len); + err.print(new String(b, off, len)); + } + }; + System.setErr(new PrintStream(bos)); + + rows.add("New"); + + sorter.convertRowIndexToView(0); + sorter.convertRowIndexToModel(0); + + String out = new String(bos.toByteArray()); + if(out.indexOf("WARNING:") < 0) { + throw new RuntimeException("No warnings found"); + } + } + + static class SorterModelWrapper extends + DefaultRowSorter.ModelWrapper { + + @Override + public TableModel getModel() { + return tableModel; + } + + @Override + public int getColumnCount() { + return tableModel.getColumnCount(); + } + + @Override + public int getRowCount() { + return tableModel.getRowCount(); + } + + @Override + public Object getValueAt(int row, int column) { + return tableModel.getValueAt(row, column); + } + + @Override + public Integer getIdentifier(int row) { + return row; + } + } +} From b1fd8970438f2b926da6ae9aa37d9d2f6db41542 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 1 Dec 2016 10:51:36 +0530 Subject: [PATCH 031/166] 7190578: Nimbus: css test for 4936917 fails Reviewed-by: serb, aghaisas --- .../text/html/StyleSheet/bug4936917.java | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 jdk/test/javax/swing/text/html/StyleSheet/bug4936917.java diff --git a/jdk/test/javax/swing/text/html/StyleSheet/bug4936917.java b/jdk/test/javax/swing/text/html/StyleSheet/bug4936917.java new file mode 100644 index 00000000000..10fe6e867bc --- /dev/null +++ b/jdk/test/javax/swing/text/html/StyleSheet/bug4936917.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* @test + @bug 4936917 7190578 + @summary Tests if background is correctly painted when has css margins + @author Denis Sharypov + @library ../../../regtesthelpers + @run main bug4936917 +*/ + + + +import java.awt.Color; +import java.awt.Point; +import java.awt.Robot; +import java.util.Timer; +import javax.swing.JComponent; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + + +public class bug4936917 { + + private boolean passed = false; + private Timer timer; + private JEditorPane editorPane; + private static JFrame f; + private volatile Point p = null; + + private String text = + "" + + " some text "; + + public void init() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + editorPane = new JEditorPane("text/html", ""); + editorPane.setEditable(false); + editorPane.setMargin(new java.awt.Insets(0, 0, 0, 0)); + editorPane.setText(text); + + f = new JFrame(); + f.getContentPane().add(editorPane); + f.setSize(600, 400); + f.setVisible(true); + } + }); + blockTillDisplayed(editorPane); + Robot robot = new Robot(); + robot.waitForIdle(); + + int x0 = p.x + 15 ; + int y = p.y + 15; + int match = 0; + int nonmatch = 0; + + passed = true; + for (int x = x0; x < x0 + 10; x++) { + System.out.println("color ("+x+"," + y +")=" + robot.getPixelColor(x,y)); + if (!robot.getPixelColor(x, y).equals(new Color(0xcc, 0xcc, 0xcc))) { + nonmatch++; + } else match++; + } + if (nonmatch > match) { + passed = false; + } + } + + void blockTillDisplayed(JComponent comp) throws Exception { + while (p == null) { + try { + SwingUtilities.invokeAndWait(() -> { + p = comp.getLocationOnScreen(); + }); + } catch (IllegalStateException e) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + } + + public void destroy() throws Exception { + SwingUtilities.invokeAndWait(()->f.dispose()); + if(!passed) { + throw new RuntimeException("Test failed."); + } + } + + + public static void main(String args[]) throws Exception { + bug4936917 test = new bug4936917(); + test.init(); + test.destroy(); + } +} From 0fb83f04d479e964f53e44921363422d7fff04d4 Mon Sep 17 00:00:00 2001 From: Dmitry Markov Date: Fri, 2 Dec 2016 12:45:52 +0300 Subject: [PATCH 032/166] 8169589: [macosx] Activating a JDialog puts to back another dialog Reviewed-by: aivanov, serb --- .../sun/lwawt/macosx/CPlatformWindow.java | 80 +++++++++++++----- .../share/classes/java/awt/Window.java | 4 + .../share/classes/sun/awt/AWTAccessor.java | 6 ++ .../DialogAboveFrameTest.java | 81 +++++++++++++++++++ 4 files changed, 153 insertions(+), 18 deletions(-) create mode 100644 jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index d93b4bbcf21..1750516a84f 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -33,11 +33,14 @@ import java.awt.Dialog.ModalityType; import java.awt.event.*; import java.beans.*; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Arrays; import javax.swing.*; import sun.awt.*; import sun.awt.AWTAccessor.ComponentAccessor; +import sun.awt.AWTAccessor.WindowAccessor; import sun.java2d.SurfaceData; import sun.java2d.opengl.CGLSurfaceData; import sun.lwawt.*; @@ -1063,29 +1066,70 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo return true; } + private boolean isOneOfOwnersOrSelf(CPlatformWindow window) { + while (window != null) { + if (this == window) { + return true; + } + window = window.owner; + } + return false; + } + + private CPlatformWindow getRootOwner() { + CPlatformWindow rootOwner = this; + while (rootOwner.owner != null) { + rootOwner = rootOwner.owner; + } + return rootOwner; + } + private void orderAboveSiblings() { - if (owner == null) { - return; + // Recursively pop up the windows from the very bottom, (i.e. root owner) so that + // the windows are ordered above their nearest owner; ancestors of the window, + // which is going to become 'main window', are placed above their siblings. + CPlatformWindow rootOwner = getRootOwner(); + if (rootOwner.isVisible()) { + CWrapper.NSWindow.orderFront(rootOwner.getNSWindowPtr()); } + final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); + orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target)); + } - // NOTE: the logic will fail if we have a hierarchy like: - // visible root owner - // invisible owner - // visible dialog - // However, this is an unlikely scenario for real life apps - if (owner.isVisible()) { - // Recursively pop up the windows from the very bottom so that only - // the very top-most one becomes the main window - owner.orderAboveSiblings(); + private void orderAboveSiblingsImpl(Window[] windows) { + ArrayList childWindows = new ArrayList(); - // Order the window to front of the stack of child windows - final long nsWindowSelfPtr = getNSWindowPtr(); - final long nsWindowOwnerPtr = owner.getNSWindowPtr(); - CWrapper.NSWindow.orderFront(nsWindowOwnerPtr); - CWrapper.NSWindow.orderWindow(nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove, nsWindowOwnerPtr); + final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor(); + final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); + + // Go through the list of windows and perform ordering. + for (Window w : windows) { + final Object p = componentAccessor.getPeer(w); + if (p instanceof LWWindowPeer) { + CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); + if (pw != null && pw.isVisible()) { + // If the window is one of ancestors of 'main window' or is going to become main by itself, + // the window should be ordered above its siblings; otherwise the window is just ordered + // above its nearest parent. + if (pw.isOneOfOwnersOrSelf(this)) { + CWrapper.NSWindow.orderFront(pw.getNSWindowPtr()); + } else { + CWrapper.NSWindow.orderWindow(pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove, + pw.owner.getNSWindowPtr()); + } + pw.applyWindowLevel(w); + } + } + // Retrieve the child windows for each window from the list and store them for future use. + // Note: we collect data about child windows even for invisible owners, since they may have + // visible children. + childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w))); + } + // If some windows, which have just been ordered, have any child windows, let's start new iteration + // and order these child windows. + if (!childWindows.isEmpty()) { + orderAboveSiblingsImpl(childWindows.toArray(new Window[0])); } - - applyWindowLevel(target); } protected void applyWindowLevel(Window target) { diff --git a/jdk/src/java.desktop/share/classes/java/awt/Window.java b/jdk/src/java.desktop/share/classes/java/awt/Window.java index ed7d63ae154..8d122be3522 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Window.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java @@ -4122,6 +4122,10 @@ public class Window extends Container implements Accessible { public void setTrayIconWindow(Window w, boolean isTrayIconWindow) { w.isTrayIconWindow = isTrayIconWindow; } + + public Window[] getOwnedWindows(Window w) { + return w.getOwnedWindows_NoClientCode(); + } }); // WindowAccessor } // static diff --git a/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java b/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java index b20d8d62367..29a435c96b9 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java @@ -360,6 +360,12 @@ public final class AWTAccessor { * Marks the specified window as an utility window for TrayIcon. */ void setTrayIconWindow(Window w, boolean isTrayIconWindow); + + /** + * Return an array containing all the windows this + * window currently owns. + */ + Window[] getOwnedWindows(Window w); } /** diff --git a/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java b/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java new file mode 100644 index 00000000000..6db02253f42 --- /dev/null +++ b/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8169589 + * @summary Activating a dialog puts to back another dialog owned by the same frame + * @author Dmitry Markov + * @library ../../regtesthelpers + * @build Util + * @run main DialogAboveFrameTest + */ + +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; + +import test.java.awt.regtesthelpers.Util; + +public class DialogAboveFrameTest { + public static void main(String[] args) { + Robot robot = Util.createRobot(); + + Frame frame = new Frame("Frame"); + frame.setBackground(Color.BLUE); + frame.setBounds(200, 50, 300, 300); + frame.setVisible(true); + + Dialog dialog1 = new Dialog(frame, "Dialog 1", false); + dialog1.setBackground(Color.RED); + dialog1.setBounds(100, 100, 200, 200); + dialog1.setVisible(true); + + Dialog dialog2 = new Dialog(frame, "Dialog 2", false); + dialog2.setBackground(Color.GREEN); + dialog2.setBounds(400, 100, 200, 200); + dialog2.setVisible(true); + + Util.waitForIdle(robot); + + Util.clickOnComp(dialog2, robot); + Util.waitForIdle(robot); + + Point point = dialog1.getLocationOnScreen(); + int x = point.x + (int)(dialog1.getWidth() * 0.9); + int y = point.y + (int)(dialog1.getHeight() * 0.9); + + try { + if (!robot.getPixelColor(x, y).equals(dialog1.getBackground())) { + throw new RuntimeException("Test FAILED: Dialog is behind the frame"); + } + } finally { + frame.dispose(); + dialog1.dispose(); + dialog2.dispose(); + } + } +} + From 0bf29180647aca64fe3d9935b419efeb3685dc2c Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Fri, 2 Dec 2016 15:22:35 +0530 Subject: [PATCH 033/166] 8169879: [TEST_BUG] javax/swing/text/GlyphPainter2/6427244/bug6427244.java - compilation failed Reviewed-by: psadhukhan, aghaisas --- .../GlyphPainter2/6427244/bug6427244.java | 71 ++++++++++++++----- 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/jdk/test/javax/swing/text/GlyphPainter2/6427244/bug6427244.java b/jdk/test/javax/swing/text/GlyphPainter2/6427244/bug6427244.java index f6f571aa05e..25066dafe42 100644 --- a/jdk/test/javax/swing/text/GlyphPainter2/6427244/bug6427244.java +++ b/jdk/test/javax/swing/text/GlyphPainter2/6427244/bug6427244.java @@ -23,7 +23,7 @@ */ /* @test - @bug 6427244 8144240 8166003 + @bug 6427244 8144240 8166003 8169879 @summary Test that pressing HOME correctly moves caret in I18N document. @author Sergey Groznyh @library ../../../regtesthelpers @@ -69,10 +69,12 @@ public class bug6427244 { bug6427244 t = new bug6427244(); for (String space: SPACES) { t.init(space); - t.runAllTests(); + t.testCaretPosition(); } System.out.println("OK"); + // Dispose the test interface upon completion + t.destroyTestInterface(); } void init(final String space) { @@ -113,29 +115,65 @@ public class bug6427244 { } } - void blockTillDisplayed(JComponent comp) { - if(comp != null) { - while (!comp.isVisible()) { - try { + void destroyTestInterface() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + // Dispose the frame + jf.dispose(); + } + }); + } catch (Exception ex) { + // No-op + } + } + + void blockTillDisplayed(JComponent comp) throws Exception { + while (comp != null && isCompVisible == false) { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + isCompVisible = comp.isVisible(); + } + }); + + if (isCompVisible == false) { + // A short wait for component to be visible Thread.sleep(1000); - } catch (InterruptedException ie) { - /* No-op */ } + } catch (InterruptedException ex) { + // No-op. Thread resumed from sleep + } catch (Exception ex) { + throw new RuntimeException(ex); } } } public void testCaretPosition() { - Point p = tp.getLocationOnScreen(); - // the right-top corner position - p.x += (dim.width - 5); - p.y += 5; - ROBOT.mouseMove(p.x, p.y); + final Point p[] = new Point[1]; + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + p[0] = tp.getLocationOnScreen(); + + // the right-top corner position + p[0].x += (dim.width - 5); + p[0].y += 5; + } + }); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + ROBOT.mouseMove(p[0].x, p[0].y); ROBOT.clickMouse(); ROBOT.hitKey(KeyEvent.VK_HOME); ROBOT.waitForIdle(); // this will fail if caret moves out of the 1st line. if (getCaretOrdinate() != 0) { + // Dispose the test interface upon completion + destroyTestInterface(); throw new RuntimeException("Test Failed."); } } @@ -162,7 +200,8 @@ public class bug6427244 { return y[0]; } - JFrame jf; - JTextPane tp; - Dimension dim; + private JFrame jf; + private JTextPane tp; + private Dimension dim; + private volatile boolean isCompVisible = false; } From 96fc05b6726cb530d314340e03737a8fa56c2c46 Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Tue, 13 Dec 2016 12:35:59 -0800 Subject: [PATCH 034/166] 8169389: Use a bitmap to control StackTraceElement::toString format and save footprint Reviewed-by: dfuchs, mchung --- .../classes/java/lang/StackTraceElement.java | 155 +++++++++--------- .../lang/StackTraceElement/ModuleFrames.java | 26 ++- 2 files changed, 98 insertions(+), 83 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java index 04ba817a553..98536259a92 100644 --- a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java +++ b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java @@ -30,7 +30,6 @@ import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.VM; import jdk.internal.module.ModuleHashes; -import java.lang.module.ModuleDescriptor.Version; import java.lang.reflect.Layer; import java.lang.reflect.Module; import java.util.HashSet; @@ -51,12 +50,13 @@ import java.util.Set; * @author Josh Bloch */ public final class StackTraceElement implements java.io.Serializable { - // This field is set to the compacted String representation used - // by StackTraceElement::toString and stored in serial form. + + // For Throwables and StackWalker, the VM initially sets this field to a + // reference to the declaring Class. The Class reference is used to + // construct the 'format' bitmap, and then is cleared. // - // This field is of Object type. VM initially sets this field to - // the Class object of the declaring class to build the compacted string. - private Object classOrLoaderModuleClassName; + // For STEs constructed using the public constructors, this field is not used. + private transient Class declaringClassObject; // Normally initialized by VM private String classLoaderName; @@ -66,6 +66,7 @@ public final class StackTraceElement implements java.io.Serializable { private String methodName; private String fileName; private int lineNumber; + private byte format = 0; // Default to show all /** * Creates a stack trace element representing the specified execution @@ -256,9 +257,10 @@ public final class StackTraceElement implements java.io.Serializable { } /** - * Returns a string representation of this stack trace element. The - * format of this string depends on the implementation, but the following - * examples may be regarded as typical: + * Returns a string representation of this stack trace element. + * + * @apiNote The format of this string depends on the implementation, but the + * following examples may be regarded as typical: *