Skip to content

Commit 2b53657

Browse files
hpoettkerfmbenhassine
authored andcommitted
Add SafeVarargs annotations
1 parent 74be83a commit 2b53657

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/Chunk.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,20 @@ public class Chunk<W> implements Iterable<W>, Serializable {
4242

4343
private List<SkipWrapper<W>> skips = new ArrayList<>();
4444

45-
private List<Exception> errors = new ArrayList<>();
45+
private final List<Exception> errors = new ArrayList<>();
4646

4747
private Object userData;
4848

4949
private boolean end;
5050

5151
private boolean busy;
5252

53+
@SafeVarargs
5354
public Chunk(W... items) {
54-
this(Arrays.stream(items).toList());
55+
this(Arrays.asList(items));
5556
}
5657

58+
@SafeVarargs
5759
public static <W> Chunk<W> of(W... items) {
5860
return new Chunk<>(items);
5961
}

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/CompositeItemWriter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2022 the original author or authors.
2+
* Copyright 2006-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,6 +63,7 @@ public CompositeItemWriter(List<ItemWriter<? super T>> delegates) {
6363
* Convenience constructor for setting the delegates.
6464
* @param delegates the array of delegates to use.
6565
*/
66+
@SafeVarargs
6667
public CompositeItemWriter(ItemWriter<? super T>... delegates) {
6768
this(Arrays.asList(delegates));
6869
}

0 commit comments

Comments
 (0)