Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to qulice 0.22.2 #1720

Merged
merged 5 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ SOFTWARE.
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.22.0</version>
<version>0.22.2</version>
<configuration>
<excludes combine.children="append">
<exclude>checkstyle:/src/site/resources/.*</exclude>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/cactoos/bytes/BytesOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
*
* @since 0.12
*/
@SuppressWarnings("PMD.OnlyOneConstructorShouldDoInitialization")
public final class BytesOf implements Bytes {

/**
Expand Down Expand Up @@ -263,6 +264,7 @@ public BytesOf(final Throwable error, final Charset charset) {
* @param error The exception to serialize
* @param charset Charset
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public BytesOf(final Throwable error, final CharSequence charset) {
this(
() -> {
Expand Down Expand Up @@ -304,6 +306,7 @@ public BytesOf(final StackTraceElement[] strace, final Charset charset) {
* @param charset Charset
* @since 0.29
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public BytesOf(final StackTraceElement[] strace,
final CharSequence charset) {
this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* @param <X> Element type
* @since 0.23
*/
@SuppressWarnings("PMD.TooManyMethods")
public abstract class CollectionEnvelope<X>
extends IterableEnvelope<X> implements Collection<X> {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/cactoos/io/InputOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public final class InputOf implements Input {
*
* @param file The file
*/
@SuppressWarnings("PMD.AvoidFileStream")
public InputOf(final File file) {
this(
() -> new FileInputStream(
Expand All @@ -72,6 +73,7 @@ public InputOf(final File file) {
*
* @param path The path
*/
@SuppressWarnings("PMD.AvoidFileStream")
public InputOf(final Path path) {
this(() -> new FileInputStream(path.toFile()));
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/cactoos/io/OutputTo.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public OutputTo(final File file) {
* @param mkdirs Should we do mkdirs beforehand?
* @since 0.15
*/
@SuppressWarnings("PMD.AvoidFileStream")
public OutputTo(final File file, final boolean mkdirs) {
this(
() -> {
Expand All @@ -85,6 +86,7 @@ public OutputTo(final Path path) {
* @param mkdirs Should we do mkdirs beforehand?
* @since 0.15
*/
@SuppressWarnings("PMD.AvoidFileStream")
public OutputTo(final Path path, final boolean mkdirs) {
this(
() -> {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/cactoos/io/ResourceOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public ResourceOf(final CharSequence res) {
* @param cls Resource class loader
* @since 0.49
*/
@SuppressWarnings("PMD.UseProperClassLoader")
public ResourceOf(final CharSequence res, final Class<?> cls) {
this(res, cls.getClassLoader());
}
Expand All @@ -95,6 +96,7 @@ public ResourceOf(final CharSequence res, final ClassLoader ldr) {
* @param cls Resource class loader
* @since 0.49
*/
@SuppressWarnings("PMD.UseProperClassLoader")
public ResourceOf(final CharSequence res,
final Func<CharSequence, Input> fbk, final Class<?> cls) {
this(res, fbk, cls.getClassLoader());
Expand Down Expand Up @@ -210,6 +212,7 @@ public ResourceOf(final Text res,
}

@Override
@SuppressWarnings("PMD.CloseResource")
public InputStream stream() throws Exception {
InputStream input = this.loader.getResourceAsStream(
this.path.asString()
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/org/cactoos/io/TailOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public final class TailOf implements Input {
* @param bytes Number of last bytes to show from input
*/
public TailOf(final Input inpt, final int bytes) {
this(inpt, bytes, 16384);
this(inpt, bytes, 16_384);
}

/**
Expand Down Expand Up @@ -87,12 +87,13 @@ public InputStream stream() throws Exception {
final byte[] buffer = new byte[this.max];
final byte[] response = new byte[this.count];
int num = 0;
final InputStream strm = this.input.stream();
for (int read = strm.read(buffer); read > 0; read = strm.read(buffer)) {
if (read < this.max && read < this.count) {
num = this.copyPartial(buffer, response, num, read);
} else {
num = this.copy(buffer, response, read);
try (InputStream strm = this.input.stream()) {
for (int read = strm.read(buffer); read > 0; read = strm.read(buffer)) {
if (read < this.max && read < this.count) {
num = this.copyPartial(buffer, response, num, read);
} else {
num = this.copy(buffer, response, read);
}
}
}
return new ByteArrayInputStream(response, 0, num);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/cactoos/io/TempFolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public TempFolder() {
new Randomized(
new org.cactoos.iterable.Joined<>(
new IterableOf<>(
new RangeOf<>('0', '9', ch -> ++ch),
new RangeOf<>('A', 'Z', ch -> ++ch),
new RangeOf<>('a', 'z', ch -> ++ch)
new RangeOf<>('0', '9', ch -> (char) (ch + 1)),
new RangeOf<>('A', 'Z', ch -> (char) (ch + 1)),
new RangeOf<>('a', 'z', ch -> (char) (ch + 1))
)
),
() -> 5
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/io/Zip.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public Zip(final Iterable<? extends Path> origin) {
}

@Override
@SuppressWarnings("PMD.AvoidFileStream")
public InputStream stream() throws Exception {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
try (ZipOutputStream zip = new ZipOutputStream(out)) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/iterable/IterableOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Iterator<X> iterator() {

@Override
@SuppressFBWarnings("EQ_UNUSUAL")
@SuppressWarnings (value = "unchecked")
@SuppressWarnings("unchecked")
public boolean equals(final Object other) {
return new Unchecked<>(
new Or(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/iterable/Partitioned.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class Partitioned<T> extends IterableEnvelope<List<T>> {
* @param items The source items.
*/
@SafeVarargs
public Partitioned(final int size, final T...items) {
public Partitioned(final int size, final T... items) {
this(size, new IterableOf<>(items));
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/iterable/Synced.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package org.cactoos.iterable;

import java.util.Iterator;
import org.cactoos.iterator.Mapped;

/**
* Synchronized iterable.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public final class IteratorOf<X> implements Iterator<X> {
* @param items Items to iterate
*/
@SafeVarargs
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOf(final X... items) {
this.list = items;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfBooleans.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public final class IteratorOfBooleans implements Iterator<Boolean> {
* Ctor.
* @param items Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfBooleans(final boolean... items) {
this.list = items;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfBytes.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public IteratorOfBytes(final Bytes bytes) {
* Ctor.
* @param itms Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfBytes(final byte... itms) {
this.items = itms;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfChars.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public IteratorOfChars(final Text txt) {
* Ctor.
* @param items Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfChars(final char... items) {
this.list = items;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfDoubles.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public final class IteratorOfDoubles implements Iterator<Double> {
* Ctor.
* @param itms Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfDoubles(final double... itms) {
this.items = itms;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfFloats.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public final class IteratorOfFloats implements Iterator<Float> {
* Ctor.
* @param itms Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfFloats(final float... itms) {
this.items = itms;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfInts.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public final class IteratorOfInts implements Iterator<Integer> {
* Ctor.
* @param itms Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfInts(final int... itms) {
this.items = itms;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfLongs.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public final class IteratorOfLongs implements Iterator<Long> {
* Ctor.
* @param itms Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfLongs(final long... itms) {
this.items = itms;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/iterator/IteratorOfShorts.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public final class IteratorOfShorts implements Iterator<Short> {
* Ctor.
* @param itms Items to iterate
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public IteratorOfShorts(final short... itms) {
this.items = itms;
this.position = new AtomicInteger(0);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/list/ListOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public ListOf(final Iterator<? extends T> src) {
* Ctor.
* @param src An {@link Iterable}
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public ListOf(final Iterable<? extends T> src) {
super(new LinkedList<>());
src.forEach(super::add);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/proc/RunnableOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public RunnableOf(final Scalar<?> scalar) {
* @param callable The callable
* @since 0.53
*/
@SuppressWarnings("PMD.AvoidCatchingGenericException")
public RunnableOf(final Callable<?> callable) {
this(
() -> {
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/org/cactoos/scalar/Checked.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ public Checked(final Scalar<? extends T> scalar,
}

@Override
@SuppressWarnings
(
{
"PMD.AvoidCatchingGenericException",
"PMD.AvoidRethrowingException",
"PMD.PreserveStackTrace"
}
)
@SuppressWarnings(
{
"PMD.AvoidCatchingGenericException",
"PMD.AvoidRethrowingException",
"PMD.PreserveStackTrace"
}
)
public T value() throws E {
try {
return this.origin.value();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/scalar/LengthOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public LengthOf(final Input input) {
* @param input The input
* @param max Buffer size
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public LengthOf(final Input input, final int max) {
this(() -> {
if (max == 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/cactoos/scalar/PropertiesOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.cactoos.Text;
import org.cactoos.io.InputOf;
import org.cactoos.iterable.IterableOf;
import org.cactoos.iterable.Mapped;
import org.cactoos.map.MapEntry;
import org.cactoos.map.MapOf;
import org.cactoos.text.TextOf;
Expand All @@ -44,6 +43,7 @@
*
* @since 0.12
*/
@SuppressWarnings("PMD.OnlyOneConstructorShouldDoInitialization")
public final class PropertiesOf implements Scalar<Properties> {

/**
Expand Down Expand Up @@ -71,6 +71,7 @@ public PropertiesOf(final Text text) {
* Ctor.
* @param input Input
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public PropertiesOf(final Input input) {
this(
() -> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/set/SetEnvelope.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* <p>There is no thread-safety guarantee.</p>
*
* @param <T> Element type
* @checkstyle AbstractClassNameCheck (500 lines)
* @since 0.49.2
* @checkstyle AbstractClassNameCheck (500 lines)
*/
@SuppressWarnings(
{
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/set/SetOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public SetOf(final T... array) {
* Ctor.
* @param src An {@link Iterable}
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public SetOf(final Iterable<? extends T> src) {
super(new HashSet<>());
src.forEach(super::add);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/set/SortedSetEnvelope.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* <p>There is no thread-safety guarantee.</p>
*
* @param <T> Element type
* @checkstyle AbstractClassNameCheck (500 lines)
* @since 0.45
* @checkstyle AbstractClassNameCheck (500 lines)
*/
@SuppressWarnings(
{
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/text/FormattedText.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public FormattedText(
* @param locale Format locale
* @param args Arguments
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public FormattedText(
final Text ptn,
final Locale locale,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/text/HexOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public HexOf(final Bytes bytes) {
final byte[] bts = bytes.asBytes();
final char[] hex = new char[bts.length * 2];
int chr = -1;
for (int idx = 0; idx < bts.length; ++idx) {
final int value = 0xff & bts[idx];
for (final byte byt: bts) {
final int value = 0xff & byt;
hex[++chr] = HexOf.HEX_CHARS[value >>> 4];
hex[++chr] = HexOf.HEX_CHARS[value & 0x0f];
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/text/Randomized.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Randomized(final Integer len) {
public Randomized(final Scalar<Integer> len) {
this(
new RangeOf<>(
'!', '~', ch -> ++ch
'!', '~', ch -> (char) (ch + 1)
),
len
);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/text/Rotated.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Rotated(final Text text, final int shift) {
offset = origin.length() + offset;
}
final StringBuilder builder = new StringBuilder(length);
// @checkstyle ParameterAssignmentCheck (6 lines)
origin = builder.append(
origin.substring(offset)
).append(
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/cactoos/func/SolidBiFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class SolidBiFuncTest {
@Test
void testThatFuncIsSynchronized() {
final int threads = 100;
final int[] shared = new int[]{0};
final int[] shared = {0};
final BiFunc<Integer, Integer, Boolean> testable =
new SolidBiFunc<>(
(first, second) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class CloseShieldInputStreamTest {
void preventsOriginalStreamToBeClosed() throws Exception {
try (FakeInputStream origin = new FakeInputStream()) {
// @checkstyle EmptyBlockCheck (2 lines)
try (InputStream stream = new CloseShieldInputStream(origin)) {
try (InputStream ignored = new CloseShieldInputStream(origin)) {
}
new Assertion<>(
"Must not close origin stream",
Expand Down
Loading