Fix 'Potential heap pollution via vargs parameter' warnings

Most existing sites are safe.  The implementating method only scans
the array and does not retain it beyond the method invocation.  In the
questionable cases use ImmutableList instead of a varargs array.

Change-Id: Ic2d0c1c1801a68ec58b642552e97e2d193b40a98
This commit is contained in:
Shawn Pearce
2013-11-28 22:49:31 -08:00
parent 42e2944d3a
commit d170274b24
9 changed files with 30 additions and 31 deletions

View File

@@ -50,6 +50,7 @@ public abstract class Predicate<T> {
}
/** Combine the passed predicates into a single AND node. */
@SafeVarargs
public static <T> Predicate<T> and(final Predicate<T>... that) {
if (that.length == 1) {
return that[0];
@@ -67,6 +68,7 @@ public abstract class Predicate<T> {
}
/** Combine the passed predicates into a single OR node. */
@SafeVarargs
public static <T> Predicate<T> or(final Predicate<T>... that) {
if (that.length == 1) {
return that[0];