Skip to content

Commit 581c1ea

Browse files
yegor256claude
andcommitted
feat(pom): upgrade qulice to 0.31.1
Bump qulice-maven-plugin to 0.31.1 and satisfy the checks it adds: drop Javadoc from private methods, hoist the identity comparison out of the lambda in every equals so ErrorProne sees it inside equals itself, delegate to Objects#equals in EqualsNullable, compare instances with IsSame instead of ==, count integers without boxing, repeat the threaded Solid test instead of calling one test from another, and remove the List#remove ambiguity by typing the list on String Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent a110443 commit 581c1ea

21 files changed

Lines changed: 48 additions & 165 deletions

src/main/java/org/cactoos/io/TailOf.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,6 @@ public InputStream stream() throws Exception {
8080
return new ByteArrayInputStream(response, 0, num);
8181
}
8282

83-
/**
84-
* Copy full buffer to response.
85-
* @param buffer The buffer array
86-
* @param response The response array
87-
* @param read Number of bytes read in buffer
88-
* @return Number of bytes in the response buffer
89-
*/
9083
private int copy(final byte[] buffer, final byte[] response,
9184
final int read) {
9285
System.arraycopy(
@@ -95,14 +88,6 @@ private int copy(final byte[] buffer, final byte[] response,
9588
return new MinOf(this.count, read).intValue();
9689
}
9790

98-
/**
99-
* Copy buffer to response for read count smaller then buffer size.
100-
* @param buffer The buffer array
101-
* @param response The response array
102-
* @param num Number of bytes in response array from previous read
103-
* @param read Number of bytes read in the buffer
104-
* @return New count of bytes in the response array
105-
*/
10691
private int copyPartial(final byte[] buffer, final byte[] response,
10792
final int num, final int read) {
10893
final int result;

src/main/java/org/cactoos/io/WriterAsOutputStream.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,6 @@ public void close() throws IOException {
174174
this.writer.close();
175175
}
176176

177-
/**
178-
* Write a portion from the buffer.
179-
* @param buffer The buffer
180-
* @param offset Offset in the buffer
181-
* @param length Maximum possible amount to take
182-
* @return How much was taken
183-
* @throws IOException If fails
184-
*/
185177
private int next(final byte[] buffer, final int offset,
186178
final int length) throws IOException {
187179
final ByteBuffer ibuf = this.input.value();

src/main/java/org/cactoos/iterable/IterableOf.java

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.cactoos.iterator.IteratorOf;
1313
import org.cactoos.scalar.And;
1414
import org.cactoos.scalar.HashCode;
15-
import org.cactoos.scalar.Or;
1615
import org.cactoos.scalar.ScalarWithFallback;
1716
import org.cactoos.scalar.Unchecked;
1817
import org.cactoos.text.Joined;
@@ -69,32 +68,29 @@ public Iterator<X> iterator() {
6968
@SuppressFBWarnings("EQ_UNUSUAL")
7069
@SuppressWarnings("unchecked")
7170
public boolean equals(final Object other) {
72-
return new Unchecked<>(
73-
new Or(
74-
() -> other == this,
75-
new And(
76-
() -> other != null,
77-
() -> Iterable.class.isAssignableFrom(other.getClass()),
78-
() -> new ScalarWithFallback<>(
79-
new And(
80-
(X value) -> true,
81-
new Matched<>(
82-
this,
83-
(Iterable<X>) other
84-
)
71+
return other == this || new Unchecked<>(
72+
new And(
73+
() -> other != null,
74+
() -> Iterable.class.isAssignableFrom(other.getClass()),
75+
() -> new ScalarWithFallback<>(
76+
new And(
77+
(X value) -> true,
78+
new Matched<>(
79+
this,
80+
(Iterable<X>) other
81+
)
82+
),
83+
new org.cactoos.iterable.IterableOf<>(
84+
new Fallback.From<>(
85+
IllegalStateException.class,
86+
ex -> false
8587
),
86-
new org.cactoos.iterable.IterableOf<>(
87-
new Fallback.From<>(
88-
IllegalStateException.class,
89-
ex -> false
90-
),
91-
new Fallback.From<>(
92-
NoSuchElementException.class,
93-
ex -> false
94-
)
88+
new Fallback.From<>(
89+
NoSuchElementException.class,
90+
ex -> false
9591
)
96-
).value()
97-
)
92+
)
93+
).value()
9894
)
9995
).value();
10096
}

src/main/java/org/cactoos/iterator/Sliced.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ public T next() {
9494
return this.iterator.next();
9595
}
9696

97-
/**
98-
* Skips head elements up to start index.
99-
*/
10097
private void skip() {
10198
while (this.current < this.start && this.iterator.hasNext()) {
10299
this.iterator.next();

src/main/java/org/cactoos/list/JoinedListIterator.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,26 +166,14 @@ public void add(final T elt) {
166166
throw new UnsupportedOperationException();
167167
}
168168

169-
/**
170-
* If {@link List} of {@link ListIterator} has next element.
171-
* @return Has or no
172-
*/
173169
private boolean listHasNextElt() {
174170
return this.cursorlit.get() + 1 <= this.listiters.value().size() - 1;
175171
}
176172

177-
/**
178-
* If {@link List} of {@link ListIterator} has previous element.
179-
* @return Has or no
180-
*/
181173
private boolean listHasPreviousElt() {
182174
return this.cursorlit.get() - 1 >= 0;
183175
}
184176

185-
/**
186-
* Get current {@link ListIterator}.
187-
* @return Current element
188-
*/
189177
private ListIterator<? extends T> currentListIterator() {
190178
final ListIterator<? extends T> current;
191179
if (this.cursorlit.get() == -1) {

src/main/java/org/cactoos/scalar/Checked.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ public T value() throws E {
6060
}
6161
}
6262

63-
/**
64-
* Wraps exception.
65-
* Skips unnecessary wrapping of exceptions of the same type.
66-
* Allows wrapping of exceptions of the same type if the error message
67-
* has been changed.
68-
* @param exp Exception
69-
* @return E Wrapped exception
70-
*/
7163
@SuppressWarnings("unchecked")
7264
private E wrappedException(final Exception exp) {
7365
E wrapped = new UncheckedFunc<>(this.func).apply(exp);

src/main/java/org/cactoos/scalar/EqualsNullable.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package org.cactoos.scalar;
66

7+
import java.util.Objects;
78
import org.cactoos.Scalar;
89

910
/**
@@ -65,11 +66,7 @@ public EqualsNullable(final Scalar<? extends Object> first,
6566
}
6667

6768
@Override
68-
@SuppressWarnings("PMD.CompareObjectsWithEquals")
6969
public Boolean value() throws Exception {
70-
final Object source = this.first.value();
71-
final Object compared = this.second.value();
72-
return source == compared
73-
|| source != null && source.equals(compared);
70+
return Objects.equals(this.first.value(), this.second.value());
7471
}
7572
}

src/main/java/org/cactoos/scalar/InheritanceLevel.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ public Integer value() {
5858
return level;
5959
}
6060

61-
/**
62-
* Calculates inheritance level.
63-
* @return Integer Level
64-
*/
6561
private int calculateLevel() {
6662
int level = Integer.MIN_VALUE;
6763
Class<?> sclass = this.derived.getSuperclass();

src/main/java/org/cactoos/scalar/ScalarWithFallback.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ public T value() throws Exception {
7676
return result;
7777
}
7878

79-
/**
80-
* Finds the best fallback for the given exception type and apply it to
81-
* the exception or throw the original error if no fallback found.
82-
* @param exp The original exception
83-
* @return Result of the most suitable fallback
84-
* @throws Exception The original exception if no fallback found
85-
*/
8679
@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
8780
private T fallback(final Throwable exp) throws Exception {
8881
final Iterator<? extends Map.Entry<Fallback<? extends T>, Integer>> candidates =

src/main/java/org/cactoos/text/TextOfScalar.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import org.cactoos.Scalar;
99
import org.cactoos.Text;
1010
import org.cactoos.scalar.And;
11-
import org.cactoos.scalar.Or;
1211
import org.cactoos.scalar.Unchecked;
1312

1413
/**
@@ -51,15 +50,12 @@ public int hashCode() {
5150
@Override
5251
@SuppressFBWarnings("EQ_UNUSUAL")
5352
public boolean equals(final Object obj) {
54-
return new Unchecked<>(
55-
new Or(
56-
() -> this == obj,
57-
new And(
58-
() -> obj instanceof Text,
59-
() -> new UncheckedText(this)
60-
.asString()
61-
.equals(new UncheckedText((Text) obj).asString())
62-
)
53+
return this == obj || new Unchecked<>(
54+
new And(
55+
() -> obj instanceof Text,
56+
() -> new UncheckedText(this)
57+
.asString()
58+
.equals(new UncheckedText((Text) obj).asString())
6359
)
6460
).value();
6561
}

0 commit comments

Comments
 (0)