From 5223193974383cc57f7d1b5a32715f41e00ef620 Mon Sep 17 00:00:00 2001 From: Rajan Halade Date: Thu, 2 Jun 2016 12:25:17 -0700 Subject: [PATCH 01/10] 8158560: Mark java/rmi/transport/dgcDeadLock/DGCDeadLock.java as intermittently faiing Reviewed-by: smarks --- jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java index fc7ae3cd818..07ff7e8368b 100644 --- a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java +++ b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java @@ -23,6 +23,7 @@ /* @test * @bug 4118056 + * @key intermittent * * @summary synopsis: Distributed Garbage Collection Deadlock * @author Laird Dornin From 5f8d8da22bd95dd1b9435c7adf92f4234d95b986 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 2 Jun 2016 20:33:35 +0000 Subject: [PATCH 02/10] Added tag jdk-9+121 for changeset 2435017e82ff --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 7ac8e6be416..c2d931e50a9 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -363,3 +363,4 @@ baeb5edb38939cdb78ae0ac6f4fd368465cbf188 jdk-9+116 e1eba5cfa5cc8c66d524396a05323dc93568730a jdk-9+118 bad3f8a33db271a6143ba6eac0c8bd5bbd942417 jdk-9+119 b9a518bf72516954e57ac2f6e3ef21e13008f1cd jdk-9+120 +ee29aaab5889555ea56e4c0ed690aabb7613529d jdk-9+121 From 98e2f679cf4d8ce2e280f49d3dd6ff55f9cad231 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Thu, 2 Jun 2016 14:03:50 -0700 Subject: [PATCH 03/10] 8158482: regex UNICODE_CHARACTER_CLASS flag cannot be disabled with an embedded flag expression Reviewed-by: bpb --- .../classes/java/util/regex/Pattern.java | 1 + jdk/test/java/util/regex/RegExTest.java | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java index f94f2145a2f..91ce6bc9732 100644 --- a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java +++ b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java @@ -3194,6 +3194,7 @@ loop: for(int x=0, offset=0; x Date: Thu, 2 Jun 2016 16:39:14 -0700 Subject: [PATCH 04/10] 8157892: StackFrame::getFileName returns null when a source file exists for native methods 8157977: getByteCodeIndex method from StackFrame does not return negative number when StackFrame is a native frame Reviewed-by: dfuchs, bchristi --- .../classes/java/lang/StackFrameInfo.java | 12 ++-- .../java/lang/StackWalker/NativeMethod.java | 72 +++++++++++++++++++ 2 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 jdk/test/java/lang/StackWalker/NativeMethod.java diff --git a/jdk/src/java.base/share/classes/java/lang/StackFrameInfo.java b/jdk/src/java.base/share/classes/java/lang/StackFrameInfo.java index 376b91e09ea..e731685dbb8 100644 --- a/jdk/src/java.base/share/classes/java/lang/StackFrameInfo.java +++ b/jdk/src/java.base/share/classes/java/lang/StackFrameInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -29,8 +29,6 @@ import jdk.internal.misc.SharedSecrets; import static java.lang.StackWalker.Option.*; import java.lang.StackWalker.StackFrame; -import java.util.Optional; -import java.util.OptionalInt; class StackFrameInfo implements StackFrame { private final static JavaLangInvokeAccess JLIA = @@ -82,19 +80,21 @@ class StackFrameInfo implements StackFrame { @Override public int getByteCodeIndex() { + // bci not available for native methods + if (isNativeMethod()) + return -1; + return bci; } @Override public String getFileName() { - if (isNativeMethod()) - return null; - return toStackTraceElement().getFileName(); } @Override public int getLineNumber() { + // line number not available for native methods if (isNativeMethod()) return -2; diff --git a/jdk/test/java/lang/StackWalker/NativeMethod.java b/jdk/test/java/lang/StackWalker/NativeMethod.java new file mode 100644 index 00000000000..d6849649254 --- /dev/null +++ b/jdk/test/java/lang/StackWalker/NativeMethod.java @@ -0,0 +1,72 @@ +/* + * 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 8157892 8157977 + * @summary Verify file name, line number and bci of native methods + * @run main NativeMethod + */ + +import java.lang.StackWalker.Option; +import java.lang.StackWalker.StackFrame; +import java.lang.reflect.Method; +import java.util.List; +import java.util.stream.Collectors; + +public class NativeMethod { + public static void main(String... args) throws Exception { + new NativeMethod().test(); + } + + private final StackWalker walker; + NativeMethod() { + this.walker = StackWalker.getInstance(Option.SHOW_REFLECT_FRAMES); + } + + void test() throws Exception { + // invoke via reflection that includes native methods + Method m = NativeMethod.class.getDeclaredMethod("walk"); + m.invoke(this); + } + + void walk() { + List nativeFrames = walker.walk(s -> + s.filter(StackFrame::isNativeMethod) + .collect(Collectors.toList()) + ); + + assertTrue(nativeFrames.size() > 0, "native frame not found"); + for (StackFrame f : nativeFrames) { + assertTrue(f.getFileName() != null, "source file expected to be found"); + assertTrue(f.getLineNumber() < 0, "line number expected to be unavailable"); + assertTrue(f.getByteCodeIndex() < 0, "bci expected to be unavailable"); + } + + } + + private static void assertTrue(boolean value, String msg) { + if (value != true) + throw new AssertionError(msg); + } +} From 05e9b6b110783edd48ad23980235e408ac698f5f Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Fri, 3 Jun 2016 13:45:30 +0100 Subject: [PATCH 05/10] 8158525: Update a few java/net tests to use the loopback address instead of the host address Reviewed-by: rriggs --- .../net/CookieHandler/CookieManagerTest.java | 37 ++++++++++++++----- .../HttpURLConnection/UnmodifiableMaps.java | 8 ++-- .../HandleContentTypeWithAttrs.java | 7 ++-- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/jdk/test/java/net/CookieHandler/CookieManagerTest.java b/jdk/test/java/net/CookieHandler/CookieManagerTest.java index ac4dc503c44..077a087c123 100644 --- a/jdk/test/java/net/CookieHandler/CookieManagerTest.java +++ b/jdk/test/java/net/CookieHandler/CookieManagerTest.java @@ -25,6 +25,7 @@ * @test * @summary Unit test for java.net.CookieManager * @bug 6244040 7150552 7051862 + * @modules jdk.httpserver * @run main/othervm -ea CookieManagerTest * @author Edward Wang */ @@ -32,12 +33,31 @@ import com.sun.net.httpserver.*; import java.io.IOException; import java.net.*; +import static java.net.Proxy.NO_PROXY; public class CookieManagerTest { static CookieTransactionHandler httpTrans; static HttpServer server; + static final String hostAddress = getAddr(); + + /** Returns an IP literal suitable for use by the test. */ + static String getAddr() { + try { + InetAddress lh = InetAddress.getLocalHost(); + System.out.println("Trying: " + lh); + if (lh.isReachable(5_000)) { + System.out.println("Using: " + lh); + return lh.getHostAddress(); + } + } catch (IOException x) { + System.out.println("Debug: caught:" + x); + } + System.out.println("Using: \"127.0.0.1\""); + return "127.0.0.1"; + } + public static void main(String[] args) throws Exception { startHttpServer(); makeHttpCall(); @@ -78,8 +98,8 @@ public class CookieManagerTest { public static void makeHttpCall() throws IOException { try { - System.out.println("http server listenining on: " - + server.getAddress().getPort()); + int port = server.getAddress().getPort(); + System.out.println("http server listenining on: " + port); // install CookieManager to use CookieHandler.setDefault(new CookieManager()); @@ -92,11 +112,12 @@ public class CookieManagerTest { ((CookieManager)CookieHandler.getDefault()) .getCookieStore().removeAll(); URL url = new URL("http" , - InetAddress.getLocalHost().getHostAddress(), + hostAddress, server.getAddress().getPort(), CookieTransactionHandler.testCases[i][0] .serverPath); - HttpURLConnection uc = (HttpURLConnection)url.openConnection(); + System.out.println("Requesting " + url); + HttpURLConnection uc = (HttpURLConnection)url.openConnection(NO_PROXY); uc.getResponseCode(); uc.disconnect(); } @@ -116,8 +137,6 @@ class CookieTransactionHandler implements HttpHandler { // to send http request public static final int testCount = 6; - private String localHostAddr = "127.0.0.1"; - @Override public void handle(HttpExchange exchange) throws IOException { if (testDone < testCases[testcaseDone].length) { @@ -188,10 +207,8 @@ class CookieTransactionHandler implements HttpHandler { testCases = new CookieTestCase[testCount][]; testPolicies = new CookiePolicy[testCount]; - try { - localHostAddr = InetAddress.getLocalHost().getHostAddress(); - } catch (Exception ignored) { - }; + String localHostAddr = CookieManagerTest.hostAddress; + int count = 0; // an http session with Netscape cookies exchanged diff --git a/jdk/test/java/net/HttpURLConnection/UnmodifiableMaps.java b/jdk/test/java/net/HttpURLConnection/UnmodifiableMaps.java index 40205c893ae..c8c6e1b54f6 100644 --- a/jdk/test/java/net/HttpURLConnection/UnmodifiableMaps.java +++ b/jdk/test/java/net/HttpURLConnection/UnmodifiableMaps.java @@ -24,11 +24,11 @@ /** * @test * @bug 7128648 + * @modules jdk.httpserver * @summary HttpURLConnection.getHeaderFields should return an unmodifiable Map */ import java.io.IOException; -import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.URI; import java.net.HttpURLConnection; @@ -40,6 +40,7 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.Headers; +import static java.net.Proxy.NO_PROXY; public class UnmodifiableMaps { @@ -47,8 +48,7 @@ public class UnmodifiableMaps { HttpServer server = startHttpServer(); try { InetSocketAddress address = server.getAddress(); - URI uri = new URI("http://" + InetAddress.getLocalHost().getHostAddress() - + ":" + address.getPort() + "/foo"); + URI uri = new URI("http://localhost:" + address.getPort() + "/foo"); doClient(uri); } finally { server.stop(0); @@ -56,7 +56,7 @@ public class UnmodifiableMaps { } void doClient(URI uri) throws Exception { - HttpURLConnection uc = (HttpURLConnection) uri.toURL().openConnection(); + HttpURLConnection uc = (HttpURLConnection) uri.toURL().openConnection(NO_PROXY); // Test1: getRequestProperties is unmodifiable System.out.println("Check getRequestProperties"); diff --git a/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java b/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java index fd1430bf00d..fe1f40471b2 100644 --- a/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java +++ b/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java @@ -32,6 +32,7 @@ import java.net.*; import java.io.*; import sun.net.www.content.text.*; import sun.net.www.MessageHeader; +import static java.net.Proxy.NO_PROXY; public class HandleContentTypeWithAttrs { @@ -39,13 +40,11 @@ public class HandleContentTypeWithAttrs { public HandleContentTypeWithAttrs (int port) throws Exception { - String localHostName = InetAddress.getLocalHost().getHostName(); - // Request echo.html from myHttpServer. // In the header of the response, we make // the content type have some attributes. - url = new URL("http://" + localHostName + ":" + port + "/echo.html"); - URLConnection urlConn = url.openConnection(); + url = new URL("http://localhost:" + port + "/echo.html"); + URLConnection urlConn = url.openConnection(NO_PROXY); // the method getContent() calls the method // getContentHandler(). With the fix, the method From b1c5f2dfdd61a6be4bded0272023fd08eee03275 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Fri, 3 Jun 2016 16:28:53 +0100 Subject: [PATCH 06/10] 8158651: ConcurrentModification exceptions in httpclient Reviewed-by: rriggs --- .../share/classes/java/net/http/Http2Connection.java | 2 +- .../share/classes/java/net/http/Stream.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jdk/src/java.httpclient/share/classes/java/net/http/Http2Connection.java b/jdk/src/java.httpclient/share/classes/java/net/http/Http2Connection.java index 94ddc9b2bdb..780322f4b44 100644 --- a/jdk/src/java.httpclient/share/classes/java/net/http/Http2Connection.java +++ b/jdk/src/java.httpclient/share/classes/java/net/http/Http2Connection.java @@ -367,7 +367,7 @@ class Http2Connection implements BufferHandler { Log.logError(t); closed = true; client2.deleteConnection(this); - Collection c = streams.values(); + List c = new LinkedList<>(streams.values()); for (Stream s : c) { s.cancelImpl(t); } diff --git a/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java b/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java index 51d71092fac..201aea650e3 100644 --- a/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java +++ b/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.net.URI; import java.nio.ByteBuffer; import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; @@ -537,7 +538,7 @@ class Stream extends ExchangeImpl { * getResponseAsync() */ - final List> response_cfs = new LinkedList<>(); + final List> response_cfs = new ArrayList<>(5); @Override CompletableFuture getResponseAsync(Void v) { @@ -565,17 +566,16 @@ class Stream extends ExchangeImpl { void completeResponse(HttpResponse r) { HttpResponseImpl resp = (HttpResponseImpl)r; synchronized (response_cfs) { - for (CompletableFuture cf : response_cfs) { + int cfs_len = response_cfs.size(); + for (int i=0; i cf = response_cfs.get(i); if (!cf.isDone()) { cf.complete(resp); response_cfs.remove(cf); - //responseHeaders = new HttpHeadersImpl(); // for any following header blocks return; - } else - System.err.println("Stream: " + this + " ALREADY DONE"); + } } response_cfs.add(CompletableFuture.completedFuture(resp)); - //responseHeaders = new HttpHeadersImpl(); // for any following header blocks } } From 10a92943ae9a5aee084f2625531ab929b254d8c0 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Fri, 3 Jun 2016 12:26:45 -0700 Subject: [PATCH 07/10] 8158604: test/java/util/ResourceBundle/modules/appbasic missing @test Reviewed-by: alanb, okutsu --- .../spi/AbstractResourceBundleProvider.java | 31 +++++++++ .../java/util/spi/ResourceBundleProvider.java | 28 +++++--- .../modules/appbasic/appbasic.sh | 68 +++++++++++++++++++ .../test/resources/asia/MyResourcesAsia.java | 34 ++++++---- .../jdk/test/resources/eu/MyResourcesEU.java | 37 ++++++---- .../test/jdk/test/resources/MyControl.java | 59 ---------------- .../resources/MyResourcesProviderImpl.java | 17 ++--- 7 files changed, 175 insertions(+), 99 deletions(-) create mode 100644 jdk/test/java/util/ResourceBundle/modules/appbasic/appbasic.sh delete mode 100644 jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyControl.java diff --git a/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java b/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java index 1a6ee655be5..ba4cbdca200 100644 --- a/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java +++ b/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java @@ -40,6 +40,36 @@ import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION; * {@code AbstractResourceBundleProvider} is an abstract class for helping * implement the {@link ResourceBundleProvider} interface. * + *

+ * Resource bundles can be packaged in a named module separated from + * the caller module loading the resource bundle, i.e. the module + * calling {@link ResourceBundle#getBundle(String)}. For the caller module + * to load a resource bundle "{@code com.example.app.MyResources}" + * from another module and a service interface named + * "{@code com.example.app.MyResourcesProvider}", + * the bundle provider module can provide the implementation class + * as follows: + * + *


+ * import com.example.app.MyResourcesProvider;
+ * class MyResourcesProviderImpl extends AbstractResourceBundleProvider
+ *     implements MyResourcesProvider
+ * {
+ *     {@code @Override
+ *     public ResourceBundle getBundle(String baseName, Locale locale) {
+ *         // this module only provides bundles in french
+ *         if (locale.equals(Locale.FRENCH)) {
+ *              return super.getBundle(baseName, locale);
+ *         }
+ *         return null;
+ *     }
+ * }}
+ * + * @see + * Resource Bundles in Named Modules + * @see + * ResourceBundleProvider Service Providers + * * @since 9 */ public abstract class AbstractResourceBundleProvider implements ResourceBundleProvider { @@ -125,6 +155,7 @@ public abstract class AbstractResourceBundleProvider implements ResourceBundlePr Module module = this.getClass().getModule(); String bundleName = toBundleName(baseName, locale); ResourceBundle bundle = null; + for (String format : formats) { try { if (FORMAT_CLASS.equals(format)) { diff --git a/jdk/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java b/jdk/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java index 714ae625f08..0074ae32090 100644 --- a/jdk/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java +++ b/jdk/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -30,13 +30,21 @@ import java.util.ResourceBundle; /** * {@code ResourceBundleProvider} is a provider interface that is used for - * loading resource bundles. Implementation classes of this interface are loaded - * with {@link java.util.ServiceLoader ServiceLoader} during a call to the + * loading resource bundles for named modules. Implementation classes of + * this interface are loaded with {@link java.util.ServiceLoader ServiceLoader} + * during a call to the * {@link ResourceBundle#getBundle(String, Locale, ClassLoader) * ResourceBundle.getBundle} method. The provider service type is determined by - * {@code basename+"Provider"}. For example, if the base name is - * "com.example.app.MyResources", {@code com.example.app.MyResourcesProvider} - * will be the provider service type. + * {@code basename+"Provider"}. + * + *

+ * For example, if the base name is "com.example.app.MyResources", + * {@code com.example.app.MyResourcesProvider} will be the provider service type: + *

{@code
+ * public interface MyResourcesProvider extends ResourceBundleProvider {
+ * }
+ * }
+ * *

* This providers's {@link #getBundle(String, Locale) getBundle} method is called * through the resource bundle loading process instead of {@link @@ -44,13 +52,17 @@ import java.util.ResourceBundle; * ResourceBundle.Control.newBundle()}. Refer to {@link ResourceBundle} for * details. * + * @see + * Resource Bundles in Named Modules + * @see + * ResourceBundleProvider Service Providers * @since 9 */ public interface ResourceBundleProvider { /** * Returns a {@code ResourceBundle} for the given bundle name and locale. - * This method returns null if there is no {@code ResourceBundle} found - * for the given parameters. + * This method returns {@code null} if there is no {@code ResourceBundle} + * found for the given parameters. * * * @param baseName diff --git a/jdk/test/java/util/ResourceBundle/modules/appbasic/appbasic.sh b/jdk/test/java/util/ResourceBundle/modules/appbasic/appbasic.sh new file mode 100644 index 00000000000..a22b825318a --- /dev/null +++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/appbasic.sh @@ -0,0 +1,68 @@ +# +# Copyright (c) 2015, 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 8044767 +# @summary Basic test for ResourceBundle with modules; named module "test" +# contains resource bundles for root and en, and separate named modules +# "eubundles" and "asiabundles" contain other resource bundles. + +set -e + +if [ -z "$TESTJAVA" ]; then + if [ $# -lt 1 ]; then exit 1; fi + TESTJAVA="$1"; shift + COMPILEJAVA="${TESTJAVA}" + TESTSRC="`pwd`" + TESTCLASSES="`pwd`" +fi + +JAVAC="$COMPILEJAVA/bin/javac" +JAVA="$TESTJAVA/bin/java" + + +for I in eu asia +do + B=${I}bundles + mkdir -p mods/$B + CLASSES="`find $TESTSRC/src/$B -name '*.java'`" + if [ "x$CLASSES" != x ]; then + $JAVAC -g -d mods -modulesourcepath $TESTSRC/src -cp mods/test $CLASSES + fi + PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`" + if [ "x$PROPS" != x ]; then + for P in $PROPS + do + D=`dirname $P` + mkdir -p mods/$B/$D + cp $TESTSRC/src/$B/$P mods/$B/$D/ + done + fi +done + +mkdir -p mods/test +$JAVAC -g -d mods -modulesourcepath $TESTSRC/src `find $TESTSRC/src/test -name "*.java"` + +$JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de + +exit $? diff --git a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java index 059e109d74e..eb14465c841 100644 --- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java +++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,23 +23,33 @@ package jdk.test.resources.asia; -import java.io.IOException; import java.util.Locale; import java.util.ResourceBundle; -import java.util.ResourceBundle.Control; -import jdk.test.resources.MyControl; +import java.util.Set; +import java.util.spi.AbstractResourceBundleProvider; + import jdk.test.resources.MyResourcesProvider; -public class MyResourcesAsia extends MyControl implements MyResourcesProvider { +public class MyResourcesAsia extends AbstractResourceBundleProvider + implements MyResourcesProvider +{ + private static Set asiaLocales + = Set.of(Locale.JAPANESE, Locale.CHINESE, Locale.TAIWAN); + + @Override + public String toBundleName(String baseName, Locale locale) { + String bundleName = super.toBundleName(baseName, locale); + if (asiaLocales.contains(locale)) { + int index = bundleName.lastIndexOf('.'); + return bundleName.substring(0, index + 1) + "asia" + bundleName.substring(index); + } + return bundleName; + } + @Override public ResourceBundle getBundle(String baseName, Locale locale) { - if (isAsiaLocale(locale)) { - try { - ClassLoader loader = MyResourcesAsia.class.getClassLoader(); - return newBundle(baseName, locale, "java.properties", loader, false); - } catch (IllegalAccessException | InstantiationException | IOException e) { - System.out.println(e); - } + if (asiaLocales.contains(locale)) { + return super.getBundle(baseName, locale); } return null; } diff --git a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java index 29d36410e6b..b16d4126342 100644 --- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java +++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,23 +23,36 @@ package jdk.test.resources.eu; -import java.io.IOException; import java.util.Locale; import java.util.ResourceBundle; -import java.util.ResourceBundle.Control; -import jdk.test.resources.MyControl; +import java.util.Set; +import java.util.spi.AbstractResourceBundleProvider; + import jdk.test.resources.MyResourcesProvider; -public class MyResourcesEU extends MyControl implements MyResourcesProvider { +public class MyResourcesEU extends AbstractResourceBundleProvider + implements MyResourcesProvider +{ + private static final Set euLocales = Set.of(Locale.GERMAN, Locale.FRENCH); + + public MyResourcesEU() { + super("java.class"); + } + + @Override + public String toBundleName(String baseName, Locale locale) { + String bundleName = super.toBundleName(baseName, locale); + if (euLocales.contains(locale)) { + int index = bundleName.lastIndexOf('.'); + return bundleName.substring(0, index + 1) + "eu" + bundleName.substring(index); + } + return bundleName; + } + @Override public ResourceBundle getBundle(String baseName, Locale locale) { - if (isEULocale(locale)) { - try { - ClassLoader loader = MyResourcesEU.class.getClassLoader(); - return newBundle(baseName, locale, "java.class", loader, false); - } catch (IllegalAccessException | InstantiationException | IOException e) { - System.out.println(e); - } + if (euLocales.contains(locale)) { + return super.getBundle(baseName, locale); } return null; } diff --git a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyControl.java b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyControl.java deleted file mode 100644 index 0cf7f9b3f29..00000000000 --- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyControl.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.resources; - -import java.util.*; - -public class MyControl extends ResourceBundle.Control { - private static final Set euLocales, asiaLocales; - - static { - euLocales = new HashSet<>(Arrays.asList(Locale.GERMAN, Locale.FRENCH)); - asiaLocales = new HashSet<>(Arrays.asList(Locale.JAPANESE, Locale.CHINESE, Locale.TAIWAN)); - } - - @Override - public String toBundleName(String baseName, Locale locale) { - String bundleName = baseName; - if (euLocales.contains(locale)) { - bundleName = addRegion(baseName, "eu"); - } else if (asiaLocales.contains(locale)) { - bundleName = addRegion(baseName, "asia"); - } - return super.toBundleName(bundleName, locale); - } - - private String addRegion(String baseName, String region) { - int index = baseName.lastIndexOf('.'); - return baseName.substring(0, index + 1) + region + baseName.substring(index); - } - - protected static boolean isEULocale(Locale locale) { - return euLocales.contains(locale); - } - - protected static boolean isAsiaLocale(Locale locale) { - return asiaLocales.contains(locale); - } -} diff --git a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java index 91dec1fabf4..eef21d29416 100644 --- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java +++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,19 +23,20 @@ package jdk.test.resources; -import java.io.IOException; import java.util.Locale; import java.util.ResourceBundle; +import java.util.spi.AbstractResourceBundleProvider; -public class MyResourcesProviderImpl extends MyControl implements MyResourcesProvider { +public class MyResourcesProviderImpl extends AbstractResourceBundleProvider + implements MyResourcesProvider +{ + public MyResourcesProviderImpl() { + super("java.class"); + } @Override public ResourceBundle getBundle(String baseName, Locale locale) { if (locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT)) { - try { - ClassLoader loader = MyResourcesProviderImpl.class.getClassLoader(); - return newBundle(baseName, locale, "java.class", loader, false); - } catch (IllegalAccessException | InstantiationException | IOException e) { - } + return super.getBundle(baseName, locale); } return null; } From 4afc77c7cc90e6d833afb251e3f0f690c66e53e2 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Fri, 3 Jun 2016 16:31:13 -0700 Subject: [PATCH 08/10] 8074819: Resolve disabled warnings for libzip Reviewed-by: naoto --- jdk/make/lib/CoreLibraries.gmk | 3 -- .../java.base/share/native/libzip/zip_util.c | 28 +++++++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk index 3cb135253ea..bfe94de4d6a 100644 --- a/jdk/make/lib/CoreLibraries.gmk +++ b/jdk/make/lib/CoreLibraries.gmk @@ -212,9 +212,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \ -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \ CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \ - DISABLED_WARNINGS_gcc := parentheses, \ - DISABLED_WARNINGS_clang := dangling-else, \ - DISABLED_WARNINGS_microsoft := 4267, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \ REORDER := $(BUILD_LIBZIP_REORDER), \ LDFLAGS := $(LDFLAGS_JDKLIB) \ diff --git a/jdk/src/java.base/share/native/libzip/zip_util.c b/jdk/src/java.base/share/native/libzip/zip_util.c index 26f507e90e4..01c7f05ef59 100644 --- a/jdk/src/java.base/share/native/libzip/zip_util.c +++ b/jdk/src/java.base/share/native/libzip/zip_util.c @@ -582,16 +582,17 @@ readCEN(jzfile *zip, jint knownTotal) } } - if (cenlen > endpos) + if (cenlen > endpos) { ZIP_FORMAT_ERROR("invalid END header (bad central directory size)"); + } cenpos = endpos - cenlen; /* Get position of first local file (LOC) header, taking into * account that there may be a stub prefixed to the zip file. */ zip->locpos = cenpos - cenoff; - if (zip->locpos < 0) + if (zip->locpos < 0) { ZIP_FORMAT_ERROR("invalid END header (bad central directory offset)"); - + } #ifdef USE_MMAP if (zip->usemmap) { /* On Solaris & Linux prior to JDK 6, we used to mmap the whole jar file to @@ -681,15 +682,18 @@ readCEN(jzfile *zip, jint knownTotal) method = CENHOW(cp); nlen = CENNAM(cp); - if (!CENSIG_AT(cp)) + if (!CENSIG_AT(cp)) { ZIP_FORMAT_ERROR("invalid CEN header (bad signature)"); - if (CENFLG(cp) & 1) + } + if (CENFLG(cp) & 1) { ZIP_FORMAT_ERROR("invalid CEN header (encrypted entry)"); - if (method != STORED && method != DEFLATED) + } + if (method != STORED && method != DEFLATED) { ZIP_FORMAT_ERROR("invalid CEN header (bad compression method)"); - if (cp + CENHDR + nlen > cenend) + } + if (cp + CENHDR + nlen > cenend) { ZIP_FORMAT_ERROR("invalid CEN header (bad header size)"); - + } /* if the entry is metadata add it to our metadata names */ if (isMetaName((char *)cp+CENHDR, nlen)) if (addMetaName(zip, (char *)cp+CENHDR, nlen) != 0) @@ -704,9 +708,9 @@ readCEN(jzfile *zip, jint knownTotal) entries[i].next = table[hsh]; table[hsh] = i; } - if (cp != cenend) + if (cp != cenend) { ZIP_FORMAT_ERROR("invalid CEN header (bad header size)"); - + } zip->total = i; goto Finally; @@ -1115,7 +1119,7 @@ jzentry * ZIP_GetEntry(jzfile *zip, char *name, jint ulen) { if (ulen == 0) { - return ZIP_GetEntry2(zip, name, strlen(name), JNI_FALSE); + return ZIP_GetEntry2(zip, name, (jint)strlen(name), JNI_FALSE); } return ZIP_GetEntry2(zip, name, ulen, JNI_TRUE); } @@ -1441,7 +1445,7 @@ ZIP_FindEntry(jzfile *zip, char *name, jint *sizeP, jint *nameLenP) jzentry *entry = ZIP_GetEntry(zip, name, 0); if (entry) { *sizeP = (jint)entry->size; - *nameLenP = strlen(entry->name); + *nameLenP = (jint)strlen(entry->name); } return entry; } From 3af1187ad7378cc631c2efdea4a4907677c5976b Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Fri, 3 Jun 2016 17:01:23 -0700 Subject: [PATCH 09/10] 8152893: StackWalker#getCallerClass is not filtering hidden/ reflection frames when walker is configured to show hidden /reflection frames Reviewed-by: mchung --- .../classes/java/lang/StackStreamFactory.java | 5 +-- .../share/classes/java/lang/StackWalker.java | 16 ++++----- .../lang/StackWalker/GetCallerClassTest.java | 33 +++++++++++++++++-- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java index a96aa01335c..d9aeaf47f4a 100644 --- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java +++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -680,7 +680,8 @@ final class StackStreamFactory { // 1: caller-sensitive method // 2: caller class while (n < 2 && (caller = nextFrame()) != null) { - if (isMethodHandleFrame(caller)) continue; + if (isMethodHandleFrame(caller)) { continue; } + if (isReflectionFrame(caller)) { continue; } frames[n++] = caller; } if (frames[1] == null) { diff --git a/jdk/src/java.base/share/classes/java/lang/StackWalker.java b/jdk/src/java.base/share/classes/java/lang/StackWalker.java index 247cd467a83..b5c43fd2d67 100644 --- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java +++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -468,23 +468,23 @@ public final class StackWalker { * Gets the {@code Class} object of the caller invoking the method * that calls this {@code getCallerClass} method. * - *

Reflection frames, {@link java.lang.invoke.MethodHandle} and + *

Reflection frames, {@link java.lang.invoke.MethodHandle}, and * hidden frames are filtered regardless of the * {@link Option#SHOW_REFLECT_FRAMES SHOW_REFLECT_FRAMES} * and {@link Option#SHOW_HIDDEN_FRAMES SHOW_HIDDEN_FRAMES} options - * this {@code StackWalker} has been configured. + * this {@code StackWalker} has been configured with. * *

This method throws {@code UnsupportedOperationException} - * if this {@code StackWalker} is not configured with - * {@link Option#RETAIN_CLASS_REFERENCE RETAIN_CLASS_REFERENCE} option, + * if this {@code StackWalker} is not configured with the + * {@link Option#RETAIN_CLASS_REFERENCE RETAIN_CLASS_REFERENCE} option. * This method should be called when a caller frame is present. If - * it is called from the last frame on the stack; + * it is called from the last frame on the stack, * {@code IllegalStateException} will be thrown. * * @apiNote * For example, {@code Util::getResourceBundle} loads a resource bundle * on behalf of the caller. It calls this {@code getCallerClass} method - * to find the method calling {@code Util::getResourceBundle} and use the caller's + * to find the method calling {@code Util::getResourceBundle} and uses the caller's * class loader to load the resource bundle. The caller class in this example * is the {@code MyTool} class. * @@ -519,7 +519,7 @@ public final class StackWalker { * When the {@code getCallerClass} method is called from a method that * is the last frame on the stack, * for example, {@code static public void main} method launched by the - * {@code java} launcher or a method invoked from a JNI attached thread. + * {@code java} launcher, or a method invoked from a JNI attached thread, * {@code IllegalStateException} is thrown. * * @return {@code Class} object of the caller's caller invoking this method. diff --git a/jdk/test/java/lang/StackWalker/GetCallerClassTest.java b/jdk/test/java/lang/StackWalker/GetCallerClassTest.java index 8276d721087..e3b96ee558a 100644 --- a/jdk/test/java/lang/StackWalker/GetCallerClassTest.java +++ b/jdk/test/java/lang/StackWalker/GetCallerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8140450 + * @bug 8140450 8152893 * @summary Basic test for StackWalker.getCallerClass() * @run main/othervm GetCallerClassTest * @run main/othervm GetCallerClassTest sm @@ -41,6 +41,7 @@ import java.security.Permissions; import java.security.Policy; import java.security.ProtectionDomain; import java.util.Arrays; +import java.util.EnumSet; import java.util.List; public class GetCallerClassTest { @@ -65,16 +66,20 @@ public class GetCallerClassTest { } new GetCallerClassTest(StackWalker.getInstance(), true).test(); new GetCallerClassTest(StackWalker.getInstance(RETAIN_CLASS_REFERENCE), false).test(); + new GetCallerClassTest(StackWalker.getInstance(EnumSet.of(RETAIN_CLASS_REFERENCE, + SHOW_HIDDEN_FRAMES)), false).test(); } public void test() { new TopLevelCaller().run(); + new LambdaTest().run(); new Nested().createNestedCaller().run(); new InnerClassCaller().run(); new ReflectionTest().run(); List threads = Arrays.asList( new Thread(new TopLevelCaller()), + new Thread(new LambdaTest()), new Thread(new Nested().createNestedCaller()), new Thread(new InnerClassCaller()), new Thread(new ReflectionTest()) @@ -149,7 +154,7 @@ public class GetCallerClassTest { public static void assertEquals(Class c, Class expected) { if (expected != c) { - throw new RuntimeException(c + " != " + expected); + throw new RuntimeException("Got " + c + ", but expected " + expected); } } @@ -172,6 +177,28 @@ public class GetCallerClassTest { } } + class LambdaTest implements Runnable { + public void run() { + Runnable lambdaRunnable = () -> { + try { + Class c = walker.getCallerClass(); + + assertEquals(c, LambdaTest.class); + if (expectUOE) { // Should have thrown + throw new RuntimeException("Didn't get expected exception"); + } + } catch (Throwable e) { + if (expectUOE && causeIsUOE(e)) { + return; /* expected */ + } + System.err.println("Unexpected exception:"); + throw new RuntimeException(e); + } + }; + lambdaRunnable.run(); + } + } + class Nested { NestedClassCaller createNestedCaller() { return new NestedClassCaller(); } class NestedClassCaller implements Runnable { From 389fc2ae2587a550516f513eaf32a1d708467e0b Mon Sep 17 00:00:00 2001 From: Shilpi Rastogi Date: Mon, 6 Jun 2016 09:13:35 +0200 Subject: [PATCH 10/10] 8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE Reviewed-by: sundar, mhaupt --- .../share/classes/java/lang/invoke/MethodHandles.java | 6 +++--- jdk/test/java/lang/invoke/DropArgumentsTest.java | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index debe9e3928d..7eda4908461 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -3360,9 +3360,9 @@ assertEquals("xy", h3.invoke("x", "y", 1, "a", "b", "c")); * @param pos place in {@code newTypes} where the non-skipped target parameters must occur * @return a possibly adapted method handle * @throws NullPointerException if either argument is null - * @throws IllegalArgumentException - * if either index is out of range in its corresponding list, or - * if the non-skipped target parameter types match the new types at {@code pos} + * @throws IllegalArgumentException if any element of {@code newTypes} is {@code void.class}, + * or if either index is out of range in its corresponding list, + * or if the non-skipped target parameter types match the new types at {@code pos} * @since 9 */ public static diff --git a/jdk/test/java/lang/invoke/DropArgumentsTest.java b/jdk/test/java/lang/invoke/DropArgumentsTest.java index d3d9e482d0c..319d5b86eb3 100644 --- a/jdk/test/java/lang/invoke/DropArgumentsTest.java +++ b/jdk/test/java/lang/invoke/DropArgumentsTest.java @@ -25,7 +25,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @run testng/othervm -ea -esa test.java.lang.invoke.DropArgumentsTest + * @run testng test.java.lang.invoke.DropArgumentsTest */ package test.java.lang.invoke; @@ -87,4 +87,13 @@ public class DropArgumentsTest { public void dropArgumentsToMatchIAE(MethodHandle target, int pos, List> valueType, int skip) { MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip); } + + @Test + @ExpectedExceptions(IllegalArgumentException.class) + public void dropArgumentsToMatchTestWithVoid() throws Throwable { + MethodHandle cat = lookup().findVirtual(String.class, "concat", + MethodType.methodType(String.class, String.class)); + MethodType bigTypewithVoid = cat.type().insertParameterTypes(0, void.class, String.class, int.class); + MethodHandle handle2 = MethodHandles.dropArgumentsToMatch(cat, 0, bigTypewithVoid.parameterList(), 1); + } }