mobius icon indicating copy to clipboard operation
mobius copied to clipboard

redundant cast

Open k1ngmang opened this issue 8 months ago • 0 comments

There is an redundant cast in the file com.spotify.mobius.Effects:

public static <F, G extends F> Set<F> effects(G... effects) {
    Set<F> result = new HashSet<>(effects.length);
    Collections.addAll(result, (F[]) Preconditions.checkArrayNoNulls((F[]) effects));

    return result;
  }

In this context, the cast does not make sense, and therefore can be written as follows:

public static <F, G extends F> Set<F> effects(G... effects) {
    Set<F> result = new HashSet<>(effects.length);
    Collections.addAll(result, Preconditions.checkArrayNoNulls((F[]) effects));

    return result;
  }

k1ngmang avatar May 29 '25 17:05 k1ngmang