Skip to content

Commit d467545

Browse files
committed
Fix spotbugs.
1 parent 5c42457 commit d467545

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/src/main/java/com/diffplug/spotless/ValuePerStep.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,27 @@ class ValuePerStep<T> extends AbstractList<T> {
3434
}
3535

3636
@Override
37-
public @Nullable T set(int index, T exception) {
37+
public @Nullable T set(int index, T newValue) {
3838
if (index < 0 || index >= size) {
3939
throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
4040
}
4141
if (this.value == null) {
4242
this.valueIdx = index;
43-
this.value = exception;
43+
this.value = newValue;
4444
return null;
4545
} else if (this.multipleValues != null) {
4646
T previousValue = (T) multipleValues[index];
47-
multipleValues[index] = exception;
47+
multipleValues[index] = newValue;
4848
return previousValue;
4949
} else {
5050
if (index == valueIdx) {
5151
T previousValue = this.value;
52-
this.value = exception;
52+
this.value = newValue;
5353
return previousValue;
54-
} else if (value == null) {
55-
// everything is assumed null anyway so we don't need to do anything
56-
return null;
5754
} else {
5855
multipleValues = new Object[size];
5956
multipleValues[valueIdx] = this.value;
60-
multipleValues[index] = exception;
57+
multipleValues[index] = newValue;
6158
return null;
6259
}
6360
}

0 commit comments

Comments
 (0)