8145006: Collections.asLifoQueue(null) doesn't throw NPE as specified
Reviewed-by: smarks
This commit is contained in:
parent
422bb76fbe
commit
5d45834ee3
@ -5530,7 +5530,7 @@ public class Collections {
|
|||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public static <T> Queue<T> asLifoQueue(Deque<T> deque) {
|
public static <T> Queue<T> asLifoQueue(Deque<T> deque) {
|
||||||
return new AsLIFOQueue<>(deque);
|
return new AsLIFOQueue<>(Objects.requireNonNull(deque));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +70,8 @@ public class AsLifoQueue {
|
|||||||
check(q.isEmpty());
|
check(q.isEmpty());
|
||||||
equal(q.size(), 0);
|
equal(q.size(), 0);
|
||||||
} catch (Throwable t) { unexpected(t); }
|
} catch (Throwable t) { unexpected(t); }
|
||||||
|
|
||||||
|
THROWS(NullPointerException.class, () -> Collections.asLifoQueue(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------- Infrastructure ---------------------------
|
//--------------------- Infrastructure ---------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user