Migrate toward java.util.function.Predicate

- Package-private changes only
- Maintains binary and source compatibility
This commit is contained in:
Gary Gregory 2024-07-11 09:07:37 -04:00
parent 3618193221
commit 68c0814f23
3 changed files with 8 additions and 8 deletions

View File

@ -118,7 +118,7 @@ public class ChainedClosure<E> implements Closure<E>, Serializable {
* @since 3.1
*/
public Closure<? super E>[] getClosures() {
return FunctorUtils.<E>copy(iClosures);
return FunctorUtils.copy(iClosures);
}
}

View File

@ -81,17 +81,17 @@ final class FunctorUtils {
}
/**
* Clone the closures to ensure that the internal reference can't be messed with.
* Clones the consumers to ensure that the internal references can't be updated.
*
* @param closures the closures to copy
* @return the cloned closures
* @param consumers the consumers to copy.
* @return the cloned consumers.
*/
@SuppressWarnings("unchecked")
static <E> Closure<E>[] copy(final Closure<? super E>... closures) {
if (closures == null) {
static <C extends Consumer<?>> C[] copy(final C... consumers) {
if (consumers == null) {
return null;
}
return (Closure<E>[]) closures.clone();
return consumers.clone();
}
/**

View File

@ -157,7 +157,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
* @since 3.1
*/
public Closure<? super E>[] getClosures() {
return FunctorUtils.<E>copy(iClosures);
return FunctorUtils.copy(iClosures);
}
/**