diff --git a/pom.xml b/pom.xml index ab6c1fc8..1ae3ac46 100644 --- a/pom.xml +++ b/pom.xml @@ -613,8 +613,13 @@ - -Xlint:-varargs - -Xlint:deprecation + -J-Duser.country=US + -J-Duser.language=en + -Xlint:all + -Xlint:-exports + -Xlint:-missing-explicit-ctor + -Xlint:-requires-transitive-automatic + -Xlint:-requires-automatic --should-stop=ifError=FLOW -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED diff --git a/src/main/java/edu/hm/hafner/util/FilteredLog.java b/src/main/java/edu/hm/hafner/util/FilteredLog.java index edd0150f..abfbf2e6 100644 --- a/src/main/java/edu/hm/hafner/util/FilteredLog.java +++ b/src/main/java/edu/hm/hafner/util/FilteredLog.java @@ -1,5 +1,10 @@ package edu.hm.hafner.util; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; + +import com.google.errorprone.annotations.FormatMethod; + import java.io.Serial; import java.io.Serializable; import java.util.ArrayList; @@ -9,11 +14,6 @@ import java.util.Objects; import java.util.concurrent.locks.ReentrantLock; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.exception.ExceptionUtils; - -import com.google.errorprone.annotations.FormatMethod; - /** * Provides a log of info messages and a limited number of error messages. If the number of errors exceeds this limit, * then further error messages will be skipped. This class is thread-safe and can be used in a distributed @@ -31,7 +31,9 @@ public class FilteredLog implements Serializable { private final int maxLines; private int lines; + @SuppressWarnings("serial") private final List infoMessages = new ArrayList<>(); + @SuppressWarnings("serial") private final List errorMessages = new ArrayList<>(); private transient ReentrantLock lock = new ReentrantLock(); diff --git a/src/main/java/edu/hm/hafner/util/LineRangeList.java b/src/main/java/edu/hm/hafner/util/LineRangeList.java index 4aad16c0..0e802d86 100644 --- a/src/main/java/edu/hm/hafner/util/LineRangeList.java +++ b/src/main/java/edu/hm/hafner/util/LineRangeList.java @@ -8,7 +8,6 @@ import java.io.Serial; import java.io.Serializable; import java.util.AbstractList; -import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -75,7 +74,7 @@ public LineRangeList(final int capacity) { public LineRangeList(final Collection copy) { this(copy.size() * 4); // guess - addAll(copy); + copy.forEach(this::add); } /** @@ -84,15 +83,13 @@ public LineRangeList(final Collection copy) { * @param initialElements * the initial elements */ + @SuppressWarnings("PMD.UseArraysAsList") public LineRangeList(final LineRange... initialElements) { this(initialElements.length * 4); // guess - addAll(Arrays.asList(initialElements)); - } - - @Override - public final boolean addAll(final Collection c) { - return super.addAll(c); + for (LineRange lr : initialElements) { + add(lr); + } } /** diff --git a/src/test/java/edu/hm/hafner/archunit/ArchitectureRules.java b/src/test/java/edu/hm/hafner/archunit/ArchitectureRules.java index 26967b94..e82837da 100644 --- a/src/test/java/edu/hm/hafner/archunit/ArchitectureRules.java +++ b/src/test/java/edu/hm/hafner/archunit/ArchitectureRules.java @@ -182,6 +182,7 @@ private static class ExceptionHasNoContext extends DescribedPredicate... allowedExceptions) { super("exception context is missing"); diff --git a/src/test/java/edu/hm/hafner/archunit/ArchitectureRulesTest.java b/src/test/java/edu/hm/hafner/archunit/ArchitectureRulesTest.java index 89299467..b85fb05d 100644 --- a/src/test/java/edu/hm/hafner/archunit/ArchitectureRulesTest.java +++ b/src/test/java/edu/hm/hafner/archunit/ArchitectureRulesTest.java @@ -7,8 +7,8 @@ import com.tngtech.archunit.core.importer.ClassFileImporter; import edu.hm.hafner.util.Generated; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.io.Serial; import java.io.Serializable; import static org.assertj.core.api.Assertions.*; @@ -140,8 +140,9 @@ private Object readResolve() { } @SuppressWarnings("all") @Generated // This class is just there to be used in architecture tests - @SuppressFBWarnings("SE") public static class ArchitectureRulesAlsoViolatedTest implements Serializable { + @Serial + private static final long serialVersionUID = 1L; /** * Called after deserialization to retain backward compatibility. @@ -154,8 +155,10 @@ private Object readResolve() { } @SuppressWarnings("all") @Generated // This class is just there to be used in architecture tests - @SuppressFBWarnings("SE") static final class ArchitectureRulesPassedTest implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + @Test @Disabled("This test is just there to be used in architecture tests") void shouldPass() { throw new IllegalArgumentException("context"); @@ -172,8 +175,10 @@ private Object readResolve() { } @SuppressWarnings("all") // This class is just there to be used in architecture tests - @SuppressFBWarnings("SE") static class ArchitectureRulesAlsoPassedTest implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + /** * Called after deserialization to retain backward compatibility. *