8145006: Collections.asLifoQueue(null) doesn't throw NPE as specified

Reviewed-by: smarks
This commit is contained in:
Paul Sandoz 2015-12-18 09:59:25 +01:00
parent 422bb76fbe
commit 5d45834ee3
2 changed files with 3 additions and 1 deletions

View File

@ -5530,7 +5530,7 @@ public class Collections {
* @since 1.6
*/
public static <T> Queue<T> asLifoQueue(Deque<T> deque) {
return new AsLIFOQueue<>(deque);
return new AsLIFOQueue<>(Objects.requireNonNull(deque));
}
/**

View File

@ -70,6 +70,8 @@ public class AsLifoQueue {
check(q.isEmpty());
equal(q.size(), 0);
} catch (Throwable t) { unexpected(t); }
THROWS(NullPointerException.class, () -> Collections.asLifoQueue(null));
}
//--------------------- Infrastructure ---------------------------