From 30717d9de3129c89638de777cf7c3976034105cf Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Fri, 17 Jan 2014 13:54:13 +0000 Subject: [PATCH 1/6] 8032057: Remove unneeded/obsolete -source options in concurrency tests Reviewed-by: chegar --- .../concurrent/BlockingQueue/CancelledProducerConsumerLoops.java | 1 - .../BlockingQueue/MultipleProducersSingleConsumerLoops.java | 1 - .../util/concurrent/BlockingQueue/ProducerConsumerLoops.java | 1 - .../BlockingQueue/SingleProducerMultipleConsumerLoops.java | 1 - jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java | 1 - jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java | 1 - jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java | 1 - .../ExecutorCompletionServiceLoops.java | 1 - .../java/util/concurrent/FutureTask/CancelledFutureLoops.java | 1 - jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java | 1 - .../util/concurrent/locks/ReentrantLock/CancelledLockLoops.java | 1 - .../concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java | 1 - .../concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java | 1 - .../util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java | 1 - .../util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java | 1 - 15 files changed, 15 deletions(-) diff --git a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java index acee6e676be..74a902ae754 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 CancelledProducerConsumerLoops.java * @run main/timeout=7000 CancelledProducerConsumerLoops * @summary Checks for responsiveness of blocking queues to cancellation. * Runs under the assumption that ITERS computations require more than diff --git a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java index 58983059bfe..47b7347174d 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 MultipleProducersSingleConsumerLoops.java * @run main/timeout=3600 MultipleProducersSingleConsumerLoops * @summary multiple producers and single consumer using blocking queues */ diff --git a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java index 7755126674c..e8770cd0d39 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 ProducerConsumerLoops.java * @run main/timeout=3600 ProducerConsumerLoops * @summary multiple producers and consumers using blocking queues */ diff --git a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java index a697d312df5..51efc7ac7f3 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 SingleProducerMultipleConsumerLoops.java * @run main/timeout=600 SingleProducerMultipleConsumerLoops * @summary check ordering for blocking queues with 1 producer and multiple consumers */ diff --git a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java index 723ef64dc89..4246e6147cb 100644 --- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 MapCheck.java * @run main/timeout=240 MapCheck * @summary Times and checks basic map operations */ diff --git a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java index 49f615a3401..4a4ce22239d 100644 --- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 MapLoops.java * @run main/timeout=1600 MapLoops * @summary Exercise multithreaded maps, by default ConcurrentHashMap. * Multithreaded hash table test. Each thread does a random walk diff --git a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java index 7527e4fe4c2..6dd04134edb 100644 --- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java +++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 ExchangeLoops.java * @run main/timeout=720 ExchangeLoops * @summary checks to make sure a pipeline of exchangers passes data. */ diff --git a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java index 79b2c5634e9..91c6cf412eb 100644 --- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java +++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4965960 - * @compile -source 1.5 ExecutorCompletionServiceLoops.java * @run main/timeout=3600 ExecutorCompletionServiceLoops * @summary Exercise ExecutorCompletionServiceLoops */ diff --git a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java index 25cec33881d..5575bb4505a 100644 --- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java +++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 CancelledFutureLoops.java * @run main/timeout=2000 CancelledFutureLoops * @summary Checks for responsiveness of futures to cancellation. * Runs under the assumption that ITERS computations require more than diff --git a/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java b/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java index 9bbce5d72eb..144e6d8d41f 100644 --- a/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java +++ b/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java @@ -24,7 +24,6 @@ /* * @test * @bug 4992443 4994819 - * @compile -source 1.5 VMSupportsCS8.java * @run main VMSupportsCS8 * @summary Checks that the value of VMSupportsCS8 matches system properties. */ diff --git a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java index dd80d996a82..f9b3cc907bc 100644 --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 CancelledLockLoops.java * @run main/timeout=2800 CancelledLockLoops * @summary tests lockInterruptibly. * Checks for responsiveness of locks to interrupts. Runs under that diff --git a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java index c3cedf4ab1e..c0a62906d7b 100644 --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 LockOncePerThreadLoops.java * @run main/timeout=15000 LockOncePerThreadLoops * @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread */ diff --git a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java index f3e77053027..bd650022cd9 100644 --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 SimpleReentrantLockLoops.java * @run main/timeout=4500 SimpleReentrantLockLoops * @summary multiple threads using a single lock */ diff --git a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java index 303e11038a8..575a7bf47f3 100644 --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 5031862 - * @compile -source 1.5 TimeoutLockLoops.java * @run main TimeoutLockLoops * @summary Checks for responsiveness of locks to timeouts. * Runs under the assumption that ITERS computations require more than diff --git a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java index 36116703814..c9846df1486 100644 --- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java +++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java @@ -34,7 +34,6 @@ /* * @test * @bug 4486658 - * @compile -source 1.5 MapLoops.java * @run main/timeout=4700 MapLoops * @summary Exercise multithreaded maps, by default ConcurrentHashMap. * Multithreaded hash table test. Each thread does a random walk From b31c05a9aa4ff99a7bd69691600802d272f0bf75 Mon Sep 17 00:00:00 2001 From: Tristan Yan Date: Fri, 17 Jan 2014 14:03:57 +0000 Subject: [PATCH 2/6] 8031666: TEST_BUG: java/net/ipv6tests/UdpTest.java failed because of SocketTimeoutException Reviewed-by: alanb, chegar --- jdk/test/java/net/ipv6tests/UdpTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jdk/test/java/net/ipv6tests/UdpTest.java b/jdk/test/java/net/ipv6tests/UdpTest.java index 8f91ade0207..33fe7e702dd 100644 --- a/jdk/test/java/net/ipv6tests/UdpTest.java +++ b/jdk/test/java/net/ipv6tests/UdpTest.java @@ -147,6 +147,7 @@ public class UdpTest extends Tests { final InetAddress ia6 = ia6addr; final int port = s1.getLocalPort(); + s1.setSoTimeout(10000); runAfter (2000, new Runnable () { public void run () { try { @@ -157,7 +158,7 @@ public class UdpTest extends Tests { }); t1 = System.currentTimeMillis(); s1.receive (new DatagramPacket (new byte [128], 128)); - checkTime (System.currentTimeMillis() - t1, 2000); + checkTime (System.currentTimeMillis() - t1, 4000); s1.close (); s2.close (); System.out.println ("Test2: OK"); From 286b95f83f3ffa10474e500680cb3adef4c4c22e Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Fri, 17 Jan 2014 15:58:18 +0100 Subject: [PATCH 3/6] 8029378: com/sun/jdi/BadHandshakeTest.java failed with java.util.concurrent.TimeoutException Reviewed-by: dholmes, jbachorik --- jdk/test/com/sun/jdi/BadHandshakeTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/test/com/sun/jdi/BadHandshakeTest.java b/jdk/test/com/sun/jdi/BadHandshakeTest.java index 8e35442ebb3..35afb33567a 100644 --- a/jdk/test/com/sun/jdi/BadHandshakeTest.java +++ b/jdk/test/com/sun/jdi/BadHandshakeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,7 +85,7 @@ public class BadHandshakeTest { success.set(line.contains("Listening for transport dt_socket at address:")); return true; }, - 1500, + Integer.MAX_VALUE, TimeUnit.MILLISECONDS ); From 49103a8c63fc9cc51c978c0982f01d60c7c96736 Mon Sep 17 00:00:00 2001 From: Peter Allwin Date: Fri, 17 Jan 2014 16:25:17 +0100 Subject: [PATCH 4/6] 8004183: test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java doesn't clean-up Reviewed-by: sjiang, dfuchs, dholmes, olagneau, dholmes, jbachorik --- .../LocalRMIServerSocketFactoryTest.java | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java b/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java index e4243391341..83e63f8565a 100644 --- a/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java +++ b/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java @@ -44,6 +44,7 @@ public class LocalRMIServerSocketFactoryTest { private static final SynchronousQueue queue = new SynchronousQueue(); + private static volatile boolean isRunning = true; static final class Result extends Exception { @@ -91,19 +92,23 @@ public class LocalRMIServerSocketFactoryTest { Thread t = new Thread() { public void run() { - while (true) { + while (isRunning) { Exception error = Result.SUCCESS; try { System.err.println("Accepting: "); final Socket ss = s.accept(); System.err.println(ss.getInetAddress() + " accepted"); } catch (Exception x) { - x.printStackTrace(); + if (isRunning) { + x.printStackTrace(); + } error = x; } finally { try { - // wait for the client to get the exception. - queue.put(error); + if (isRunning) { + // wait for the client to get the exception. + queue.put(error); + } } catch (Exception x) { // too bad! System.err.println("Could't send result to client!"); @@ -114,32 +119,38 @@ public class LocalRMIServerSocketFactoryTest { } } }; - t.setDaemon(true); - t.start(); - System.err.println("new Socket((String)null, port)"); - final Socket s1 = new Socket((String) null, port); - checkError("new Socket((String)null, port)"); - s1.close(); - System.err.println("new Socket((String)null, port): PASSED"); + try { + t.start(); - System.err.println("new Socket(InetAddress.getByName(null), port)"); - final Socket s2 = new Socket(InetAddress.getByName(null), port); - checkError("new Socket(InetAddress.getByName(null), port)"); - s2.close(); - System.err.println("new Socket(InetAddress.getByName(null), port): PASSED"); + System.err.println("new Socket((String)null, port)"); + final Socket s1 = new Socket((String) null, port); + checkError("new Socket((String)null, port)"); + s1.close(); + System.err.println("new Socket((String)null, port): PASSED"); - System.err.println("new Socket(localhost, port)"); - final Socket s3 = new Socket("localhost", port); - checkError("new Socket(localhost, port)"); - s3.close(); - System.err.println("new Socket(localhost, port): PASSED"); + System.err.println("new Socket(InetAddress.getByName(null), port)"); + final Socket s2 = new Socket(InetAddress.getByName(null), port); + checkError("new Socket(InetAddress.getByName(null), port)"); + s2.close(); + System.err.println("new Socket(InetAddress.getByName(null), port): PASSED"); - System.err.println("new Socket(127.0.0.1, port)"); - final Socket s4 = new Socket("127.0.0.1", port); - checkError("new Socket(127.0.0.1, port)"); - s4.close(); - System.err.println("new Socket(127.0.0.1, port): PASSED"); + System.err.println("new Socket(localhost, port)"); + final Socket s3 = new Socket("localhost", port); + checkError("new Socket(localhost, port)"); + s3.close(); + System.err.println("new Socket(localhost, port): PASSED"); + System.err.println("new Socket(127.0.0.1, port)"); + final Socket s4 = new Socket("127.0.0.1", port); + checkError("new Socket(127.0.0.1, port)"); + s4.close(); + System.err.println("new Socket(127.0.0.1, port): PASSED"); + } + finally { + isRunning = false; + s.close(); + t.join(); + } } } From 3aeefa52845266fb39eba7a5ca21800f4daeff90 Mon Sep 17 00:00:00 2001 From: Brian Goetz Date: Fri, 17 Jan 2014 12:28:59 -0500 Subject: [PATCH 5/6] 8031373: Lint warnings in java.util.stream 8030079: Lint warnings in java.lang.invoke Reviewed-by: psandoz, forax --- .../java/lang/invoke/BoundMethodHandle.java | 10 +++++----- .../lang/invoke/InnerClassLambdaMetafactory.java | 16 ++++++++-------- .../lang/invoke/InvokerBytecodeGenerator.java | 12 ++++++------ .../lang/invoke/TypeConvertingMethodAdapter.java | 6 +++--- .../classes/java/util/stream/ForEachOps.java | 5 ++++- .../share/classes/java/util/stream/Nodes.java | 7 ++++++- .../classes/java/util/stream/SortedOps.java | 8 +++++--- .../classes/java/util/stream/SpinedBuffer.java | 4 ++++ .../java/util/stream/StreamSpliterators.java | 11 ++++++++--- .../share/classes/java/util/stream/Streams.java | 1 + 10 files changed, 50 insertions(+), 30 deletions(-) diff --git a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java index abc31479f98..f592d51f471 100644 --- a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java @@ -611,7 +611,7 @@ import jdk.internal.org.objectweb.asm.Type; mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKESPECIAL, BMH, "", makeSignature("", true)); + mv.visitMethodInsn(INVOKESPECIAL, BMH, "", makeSignature("", true), false); for (int i = 0, j = 0; i < types.length(); ++i, ++j) { // i counts the arguments, j counts corresponding argument slots @@ -662,7 +662,7 @@ import jdk.internal.org.objectweb.asm.Type; // put fields on the stack emitPushFields(types, className, mv); // finally, invoke the constructor and return - mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types, false)); + mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types, false), false); mv.visitInsn(ARETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -678,7 +678,7 @@ import jdk.internal.org.objectweb.asm.Type; int iconstInsn = ICONST_0 + extensionIndex(t); assert(iconstInsn <= ICONST_5); mv.visitInsn(iconstInsn); - mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWithIndex", BMHSPECIES_DATA_EWI_SIG); + mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWithIndex", BMHSPECIES_DATA_EWI_SIG, false); mv.visitFieldInsn(GETFIELD, SPECIES_DATA, "constructor", "[" + MH_SIG); mv.visitInsn(ICONST_0); mv.visitInsn(AALOAD); @@ -690,7 +690,7 @@ import jdk.internal.org.objectweb.asm.Type; // put narg on stack mv.visitVarInsn(typeLoadOp(t), 3); // finally, invoke the constructor and return - mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + t, false)); + mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + t, false), false); mv.visitInsn(ARETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -701,7 +701,7 @@ import jdk.internal.org.objectweb.asm.Type; mv.visitCode(); mv.visitLdcInsn(types); mv.visitLdcInsn(Type.getObjectType(className)); - mv.visitMethodInsn(INVOKESTATIC, SPECIES_DATA, "getForClass", BMHSPECIES_DATA_GFC_SIG); + mv.visitMethodInsn(INVOKESTATIC, SPECIES_DATA, "getForClass", BMHSPECIES_DATA_GFC_SIG, false); mv.visitFieldInsn(PUTSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); diff --git a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java index 2fc8618cbc5..752c0976d9e 100644 --- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java +++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java @@ -193,10 +193,10 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; CallSite buildCallSite() throws LambdaConversionException { final Class innerClass = spinInnerClass(); if (invokedType.parameterCount() == 0) { - final Constructor[] ctrs = AccessController.doPrivileged( - new PrivilegedAction() { + final Constructor[] ctrs = AccessController.doPrivileged( + new PrivilegedAction[]>() { @Override - public Constructor[] run() { + public Constructor[] run() { Constructor[] ctrs = innerClass.getDeclaredConstructors(); if (ctrs.length == 1) { // The lambda implementing inner class constructor is private, set @@ -338,7 +338,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; m.visitVarInsn(getLoadOpcode(argType), varIndex); varIndex += getParameterSize(argType); } - m.visitMethodInsn(INVOKESPECIAL, lambdaClassName, NAME_CTOR, constructorType.toMethodDescriptorString()); + m.visitMethodInsn(INVOKESPECIAL, lambdaClassName, NAME_CTOR, constructorType.toMethodDescriptorString(), false); m.visitInsn(ARETURN); m.visitMaxs(-1, -1); m.visitEnd(); @@ -354,7 +354,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; ctor.visitCode(); ctor.visitVarInsn(ALOAD, 0); ctor.visitMethodInsn(INVOKESPECIAL, JAVA_LANG_OBJECT, NAME_CTOR, - METHOD_DESCRIPTOR_VOID); + METHOD_DESCRIPTOR_VOID, false); int parameterCount = invokedType.parameterCount(); for (int i = 0, lvIndex = 0; i < parameterCount; i++) { ctor.visitVarInsn(ALOAD, 0); @@ -402,7 +402,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; mv.visitInsn(AASTORE); } mv.visitMethodInsn(INVOKESPECIAL, NAME_SERIALIZED_LAMBDA, NAME_CTOR, - DESCR_CTOR_SERIALIZED_LAMBDA); + DESCR_CTOR_SERIALIZED_LAMBDA, false); mv.visitInsn(ARETURN); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored mv.visitMaxs(-1, -1); @@ -421,7 +421,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; mv.visitInsn(DUP); mv.visitLdcInsn("Non-serializable lambda"); mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR, - DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION); + DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION, false); mv.visitInsn(ATHROW); mv.visitMaxs(-1, -1); mv.visitEnd(); @@ -434,7 +434,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; mv.visitInsn(DUP); mv.visitLdcInsn("Non-serializable lambda"); mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR, - DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION); + DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION, false); mv.visitInsn(ATHROW); mv.visitMaxs(-1, -1); mv.visitEnd(); diff --git a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index 6a7929166dd..bb873b10c5a 100644 --- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -403,7 +403,7 @@ class InvokerBytecodeGenerator { String owner = "java/lang/" + wrapper.wrapperType().getSimpleName(); String name = "valueOf"; String desc = "(" + wrapper.basicTypeChar() + ")L" + owner + ";"; - mv.visitMethodInsn(Opcodes.INVOKESTATIC, owner, name, desc); + mv.visitMethodInsn(Opcodes.INVOKESTATIC, owner, name, desc, false); } /** @@ -417,7 +417,7 @@ class InvokerBytecodeGenerator { String name = wrapper.primitiveSimpleName() + "Value"; String desc = "()" + wrapper.basicTypeChar(); mv.visitTypeInsn(Opcodes.CHECKCAST, owner); - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, owner, name, desc); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, owner, name, desc, false); } /** @@ -437,7 +437,7 @@ class InvokerBytecodeGenerator { mv.visitLdcInsn(constantPlaceholder(pclass)); mv.visitTypeInsn(Opcodes.CHECKCAST, CLS); mv.visitInsn(Opcodes.SWAP); - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CLS, "cast", LL_SIG); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CLS, "cast", LL_SIG, false); if (pclass.isArray()) mv.visitTypeInsn(Opcodes.CHECKCAST, OBJARY); } @@ -570,7 +570,7 @@ class InvokerBytecodeGenerator { // invocation MethodType type = name.function.methodType(); - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.basicType().toMethodDescriptorString()); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.basicType().toMethodDescriptorString(), false); } static private Class[] STATICALLY_INVOCABLE_PACKAGES = { @@ -944,7 +944,7 @@ class InvokerBytecodeGenerator { emitAloadInsn(0); mv.visitFieldInsn(Opcodes.GETFIELD, MH, "form", "Ljava/lang/invoke/LambdaForm;"); mv.visitInsn(Opcodes.SWAP); // swap form and array; avoid local variable - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, LF, "interpretWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;"); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, LF, "interpretWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;", false); // maybe unbox Class rtype = invokerType.returnType(); @@ -1007,7 +1007,7 @@ class InvokerBytecodeGenerator { // Invoke String targetDesc = dstType.basicType().toMethodDescriptorString(); - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", targetDesc); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", targetDesc, false); // Box primitive types Class rtype = dstType.returnType(); diff --git a/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java b/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java index 5d8e1bf82f5..b23ba663128 100644 --- a/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java +++ b/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java @@ -158,19 +158,19 @@ class TypeConvertingMethodAdapter extends MethodVisitor { visitMethodInsn(Opcodes.INVOKESTATIC, wrapperName(w), NAME_BOX_METHOD, - boxingDescriptor(w)); + boxingDescriptor(w), false); } /** * Convert types by unboxing. The source type is known to be a primitive wrapper. - * @param ws A primitive wrapper corresponding to wrapped reference source type + * @param sname A primitive wrapper corresponding to wrapped reference source type * @param wt A primitive wrapper being converted to */ void unbox(String sname, Wrapper wt) { visitMethodInsn(Opcodes.INVOKEVIRTUAL, sname, unboxMethod(wt), - unboxingDescriptor(wt)); + unboxingDescriptor(wt), false); } private String descriptorToName(String desc) { diff --git a/jdk/src/share/classes/java/util/stream/ForEachOps.java b/jdk/src/share/classes/java/util/stream/ForEachOps.java index 92320933813..b527f054f4d 100644 --- a/jdk/src/share/classes/java/util/stream/ForEachOps.java +++ b/jdk/src/share/classes/java/util/stream/ForEachOps.java @@ -32,6 +32,7 @@ import java.util.concurrent.ForkJoinTask; import java.util.function.Consumer; import java.util.function.DoubleConsumer; import java.util.function.IntConsumer; +import java.util.function.IntFunction; import java.util.function.LongConsumer; /** @@ -471,9 +472,11 @@ final class ForEachOps { if (task.getPendingCount() > 0) { // Cannot complete just yet so buffer elements into a Node // for use when completion occurs + @SuppressWarnings("unchecked") + IntFunction generator = size -> (T[]) new Object[size]; Node.Builder nb = task.helper.makeNodeBuilder( task.helper.exactOutputSizeIfKnown(rightSplit), - size -> (T[]) new Object[size]); + generator); task.node = task.helper.wrapAndCopyInto(nb, rightSplit).build(); task.spliterator = null; } diff --git a/jdk/src/share/classes/java/util/stream/Nodes.java b/jdk/src/share/classes/java/util/stream/Nodes.java index d69b9f61b1a..c18540c4e6e 100644 --- a/jdk/src/share/classes/java/util/stream/Nodes.java +++ b/jdk/src/share/classes/java/util/stream/Nodes.java @@ -63,7 +63,7 @@ final class Nodes { // IllegalArgumentException messages static final String BAD_SIZE = "Stream size exceeds max array size"; - @SuppressWarnings("raw") + @SuppressWarnings("rawtypes") private static final Node EMPTY_NODE = new EmptyNode.OfRef(); private static final Node.OfInt EMPTY_INT_NODE = new EmptyNode.OfInt(); private static final Node.OfLong EMPTY_LONG_NODE = new EmptyNode.OfLong(); @@ -956,6 +956,7 @@ final class Nodes { * Initiate a stack containing, in left-to-right order, the child nodes * covered by this spliterator */ + @SuppressWarnings("unchecked") protected final Deque initStack() { // Bias size to the case where leaf nodes are close to this node // 8 is the minimum initial capacity for the ArrayDeque implementation @@ -969,6 +970,7 @@ final class Nodes { * Depth first search, in left-to-right order, of the node tree, using * an explicit stack, to find the next non-empty leaf node. */ + @SuppressWarnings("unchecked") protected final N findNextLeafNode(Deque stack) { N n = null; while ((n = stack.pollFirst()) != null) { @@ -984,6 +986,7 @@ final class Nodes { return null; } + @SuppressWarnings("unchecked") protected final boolean initTryAdvance() { if (curNode == null) return false; @@ -1870,6 +1873,7 @@ final class Nodes { } assert task.offset + task.length < MAX_ARRAY_SIZE; + @SuppressWarnings("unchecked") T_SINK sink = (T_SINK) task; task.helper.wrapAndCopyInto(sink, rightSplit); task.propagateCompletion(); @@ -2173,6 +2177,7 @@ final class Nodes { } @Override + @SuppressWarnings("unchecked") protected T_NODE doLeaf() { T_BUILDER builder = builderFactory.apply(helper.exactOutputSizeIfKnown(spliterator)); return (T_NODE) helper.wrapAndCopyInto(builder, spliterator).build(); diff --git a/jdk/src/share/classes/java/util/stream/SortedOps.java b/jdk/src/share/classes/java/util/stream/SortedOps.java index 39e8092e7e8..7a646686d80 100644 --- a/jdk/src/share/classes/java/util/stream/SortedOps.java +++ b/jdk/src/share/classes/java/util/stream/SortedOps.java @@ -29,7 +29,6 @@ import java.util.Arrays; import java.util.Comparator; import java.util.Objects; import java.util.Spliterator; -import java.util.concurrent.ForkJoinTask; import java.util.function.IntFunction; @@ -113,7 +112,9 @@ final class SortedOps { StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED); this.isNaturalSort = true; // Will throw CCE when we try to sort if T is not Comparable - this.comparator = (Comparator) Comparator.naturalOrder(); + @SuppressWarnings("unchecked") + Comparator comp = (Comparator) Comparator.naturalOrder(); + this.comparator = comp; } /** @@ -170,7 +171,7 @@ final class SortedOps { } @Override - public Sink opWrapSink(int flags, Sink sink) { + public Sink opWrapSink(int flags, Sink sink) { Objects.requireNonNull(sink); if (StreamOpFlag.SORTED.isKnown(flags)) @@ -291,6 +292,7 @@ final class SortedOps { } @Override + @SuppressWarnings("unchecked") public void begin(long size) { if (size >= Nodes.MAX_ARRAY_SIZE) throw new IllegalArgumentException(Nodes.BAD_SIZE); diff --git a/jdk/src/share/classes/java/util/stream/SpinedBuffer.java b/jdk/src/share/classes/java/util/stream/SpinedBuffer.java index 878b2c2899e..163692cf858 100644 --- a/jdk/src/share/classes/java/util/stream/SpinedBuffer.java +++ b/jdk/src/share/classes/java/util/stream/SpinedBuffer.java @@ -92,6 +92,7 @@ class SpinedBuffer * @throws IllegalArgumentException if the specified initial capacity * is negative */ + @SuppressWarnings("unchecked") SpinedBuffer(int initialCapacity) { super(initialCapacity); curChunk = (E[]) new Object[1 << initialChunkPower]; @@ -100,6 +101,7 @@ class SpinedBuffer /** * Constructs an empty list with an initial capacity of sixteen. */ + @SuppressWarnings("unchecked") SpinedBuffer() { super(); curChunk = (E[]) new Object[1 << initialChunkPower]; @@ -114,6 +116,7 @@ class SpinedBuffer : priorElementCount[spineIndex] + spine[spineIndex].length; } + @SuppressWarnings("unchecked") private void inflateSpine() { if (spine == null) { spine = (E[][]) new Object[MIN_SPINE_SIZE][]; @@ -125,6 +128,7 @@ class SpinedBuffer /** * Ensure that the buffer has at least capacity to hold the target size */ + @SuppressWarnings("unchecked") protected final void ensureCapacity(long targetSize) { long capacity = capacity(); if (targetSize > capacity) { diff --git a/jdk/src/share/classes/java/util/stream/StreamSpliterators.java b/jdk/src/share/classes/java/util/stream/StreamSpliterators.java index 7322773fe87..67683425bfc 100644 --- a/jdk/src/share/classes/java/util/stream/StreamSpliterators.java +++ b/jdk/src/share/classes/java/util/stream/StreamSpliterators.java @@ -516,6 +516,7 @@ class StreamSpliterators { } @Override + @SuppressWarnings("unchecked") public T_SPLITR trySplit() { return (T_SPLITR) get().trySplit(); } @@ -643,6 +644,7 @@ class StreamSpliterators { // existing and additionally created F/J tasks that perform // redundant work on no elements. while (true) { + @SuppressWarnings("unchecked") T_SPLITR leftSplit = (T_SPLITR) s.trySplit(); if (leftSplit == null) return null; @@ -970,6 +972,7 @@ class StreamSpliterators { // Stop splitting when there are no more limit permits if (permits.get() == 0) return null; + @SuppressWarnings("unchecked") T_SPLITR split = (T_SPLITR) s.trySplit(); return split == null ? null : makeSpliterator(split); } @@ -1068,16 +1071,18 @@ class StreamSpliterators { super(s, skip, limit); } - OfPrimitive(T_SPLITR s, UnorderedSliceSpliterator.OfPrimitive parent) { + OfPrimitive(T_SPLITR s, UnorderedSliceSpliterator.OfPrimitive parent) { super(s, parent); } @Override public boolean tryAdvance(T_CONS action) { Objects.requireNonNull(action); + @SuppressWarnings("unchecked") + T_CONS consumer = (T_CONS) this; while (permitStatus() != PermitStatus.NO_MORE) { - if (!s.tryAdvance((T_CONS) this)) + if (!s.tryAdvance(consumer)) return false; else if (acquirePermits(1) == 1) { acceptConsumed(action); @@ -1316,7 +1321,7 @@ class StreamSpliterators { * estimate size is 0. * *

The {@code forEachRemaining} method if invoked will never terminate. - * The {@coe tryAdvance} method always returns true. + * The {@code tryAdvance} method always returns true. * */ static abstract class InfiniteSupplyingSpliterator implements Spliterator { diff --git a/jdk/src/share/classes/java/util/stream/Streams.java b/jdk/src/share/classes/java/util/stream/Streams.java index 41f3adad592..072691aeccb 100644 --- a/jdk/src/share/classes/java/util/stream/Streams.java +++ b/jdk/src/share/classes/java/util/stream/Streams.java @@ -715,6 +715,7 @@ final class Streams { @Override public T_SPLITR trySplit() { + @SuppressWarnings("unchecked") T_SPLITR ret = beforeSplit ? aSpliterator : (T_SPLITR) bSpliterator.trySplit(); beforeSplit = false; return ret; From 8348cfd296a70f24a3bdc561c0ef87aededb1c4b Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Sat, 18 Jan 2014 10:57:41 -0800 Subject: [PATCH 6/6] 8031375: Revert test exclusions after fix for JDK-8030656 propagates Reviewed-by: mduigou --- jdk/test/ProblemList.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index c42548ebed3..2a90ff98b67 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -123,11 +123,6 @@ # 8029415 java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java generic-all -# 8030656 -java/lang/reflect/Parameter/GetAnnotatedTypeTest.java generic-all -java/lang/reflect/Parameter/WithParameters.java generic-all -java/lang/reflect/Parameter/BadClassFiles.java generic-all - ############################################################################ # jdk_management