Skip to content
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
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,13 @@
</annotationProcessorPaths>
<?SORTPOM IGNORE?>
<compilerArgs>
<arg>-Xlint:-varargs</arg>
<arg>-Xlint:deprecation</arg>
<arg>-J-Duser.country=US</arg>
<arg>-J-Duser.language=en</arg>
<arg>-Xlint:all</arg>
<arg>-Xlint:-exports</arg>
<arg>-Xlint:-missing-explicit-ctor</arg>
<arg>-Xlint:-requires-transitive-automatic</arg>
<arg>-Xlint:-requires-automatic</arg>
<arg>--should-stop=ifError=FLOW</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/edu/hm/hafner/util/FilteredLog.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand All @@ -31,7 +31,9 @@ public class FilteredLog implements Serializable {
private final int maxLines;
private int lines;

@SuppressWarnings("serial")
private final List<String> infoMessages = new ArrayList<>();
@SuppressWarnings("serial")
private final List<String> errorMessages = new ArrayList<>();

private transient ReentrantLock lock = new ReentrantLock();
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/edu/hm/hafner/util/LineRangeList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -75,7 +74,7 @@ public LineRangeList(final int capacity) {
public LineRangeList(final Collection<LineRange> copy) {
this(copy.size() * 4); // guess

addAll(copy);
copy.forEach(this::add);
}

/**
Expand All @@ -84,15 +83,13 @@ public LineRangeList(final Collection<LineRange> 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<? extends LineRange> c) {
return super.addAll(c);
for (LineRange lr : initialElements) {
add(lr);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ private static class ExceptionHasNoContext extends DescribedPredicate<JavaConstr
* exceptions that are allowed to be instantiated without arguments
*/
@SafeVarargs
@SuppressWarnings("varargs")
ExceptionHasNoContext(final Class<? extends Throwable>... allowedExceptions) {
super("exception context is missing");

Expand Down
13 changes: 9 additions & 4 deletions src/test/java/edu/hm/hafner/archunit/ArchitectureRulesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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.
Expand All @@ -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");
Expand All @@ -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.
*
Expand Down
Loading