8145006: Collections.asLifoQueue(null) doesn't throw NPE as specified
Reviewed-by: smarks
--- a/jdk/src/java.base/share/classes/java/util/Collections.java Thu Dec 17 20:27:37 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Collections.java Fri Dec 18 09:59:25 2015 +0100
@@ -5530,7 +5530,7 @@
* @since 1.6
*/
public static <T> Queue<T> asLifoQueue(Deque<T> deque) {
- return new AsLIFOQueue<>(deque);
+ return new AsLIFOQueue<>(Objects.requireNonNull(deque));
}
/**
--- a/jdk/test/java/util/Collections/AsLifoQueue.java Thu Dec 17 20:27:37 2015 -0800
+++ b/jdk/test/java/util/Collections/AsLifoQueue.java Fri Dec 18 09:59:25 2015 +0100
@@ -70,6 +70,8 @@
check(q.isEmpty());
equal(q.size(), 0);
} catch (Throwable t) { unexpected(t); }
+
+ THROWS(NullPointerException.class, () -> Collections.asLifoQueue(null));
}
//--------------------- Infrastructure ---------------------------