OpenJDK / portola / portola
changeset 50579:9ee93487d262
8204172: Predicate::not should explicitly mention "NullPointerException - if target is null"
Reviewed-by: sundar, psandoz, dfuchs
author | jlaskey |
---|---|
date | Thu, 14 Jun 2018 09:38:31 -0300 |
parents | c0b896fc3f08 |
children | 0f807f558017 |
files | src/java.base/share/classes/java/util/function/Predicate.java |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/function/Predicate.java Thu Jun 14 13:16:21 2018 +0200 +++ b/src/java.base/share/classes/java/util/function/Predicate.java Thu Jun 14 09:38:31 2018 -0300 @@ -119,6 +119,8 @@ /** * Returns a predicate that is the negation of the supplied predicate. + * This is accomplished by returning result of the calling + * {@code target.negate()}. * * @param <T> the type of arguments to the specified predicate * @param target predicate to negate @@ -126,10 +128,13 @@ * @return a predicate that negates the results of the supplied * predicate * + * @throws NullPointerException if target is null + * * @since 11 */ @SuppressWarnings("unchecked") static <T> Predicate<T> not(Predicate<? super T> target) { + Objects.requireNonNull(target); return (Predicate<T>)target.negate(); } }