diff --git a/etc/pmd-configuration.xml b/etc/pmd-configuration.xml index 927db432..f3b054f1 100644 --- a/etc/pmd-configuration.xml +++ b/etc/pmd-configuration.xml @@ -3,7 +3,7 @@ + xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> Ullrich Hafner's PMD rules @@ -16,6 +16,12 @@ + + + + + + @@ -67,6 +73,12 @@ + + + + + + diff --git a/src/main/java/edu/hm/hafner/util/TreeString.java b/src/main/java/edu/hm/hafner/util/TreeString.java index 775cd88e..6593c3ac 100644 --- a/src/main/java/edu/hm/hafner/util/TreeString.java +++ b/src/main/java/edu/hm/hafner/util/TreeString.java @@ -52,7 +52,7 @@ public final class TreeString implements Serializable { } String getLabel() { - return new String(label); + return String.valueOf(label); } /** diff --git a/src/test/java/edu/hm/hafner/util/ArchitectureRules.java b/src/test/java/edu/hm/hafner/util/ArchitectureRules.java index 6791e901..f4c5936f 100644 --- a/src/test/java/edu/hm/hafner/util/ArchitectureRules.java +++ b/src/test/java/edu/hm/hafner/util/ArchitectureRules.java @@ -30,6 +30,7 @@ * * @author Ullrich Hafner */ +@SuppressWarnings("PMD.DataClass") public final class ArchitectureRules { /** Tests should not use fields. Recommendation is to use factory methods for stubs and mocks. */ public static final ArchRule NO_FIELDS_IN_TESTS = diff --git a/src/test/java/edu/hm/hafner/util/LineRangeListTest.java b/src/test/java/edu/hm/hafner/util/LineRangeListTest.java index 3f1d0e97..318efe8d 100644 --- a/src/test/java/edu/hm/hafner/util/LineRangeListTest.java +++ b/src/test/java/edu/hm/hafner/util/LineRangeListTest.java @@ -1,5 +1,7 @@ package edu.hm.hafner.util; +import java.util.List; + import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.*; @@ -75,15 +77,15 @@ void shouldResizeCorrectly() { @Test void shouldProvideContains() { - LineRangeList last = createThreeElements(); + var last = createThreeElements(); last.remove(new LineRange(4, 5)); assertThat(last).containsExactly(new LineRange(0, 1), new LineRange(2, 3)); - LineRangeList middle = createThreeElements(); + var middle = createThreeElements(); middle.remove(new LineRange(2, 3)); assertThat(middle).containsExactly(new LineRange(0, 1), new LineRange(4, 5)); - LineRangeList first = createThreeElements(); + var first = createThreeElements(); assertThat(first.contains(new LineRange(0, 1))).isTrue(); assertThat(first.contains(new LineRange(2, 3))).isTrue(); assertThat(first.contains(new LineRange(4, 5))).isTrue(); @@ -95,7 +97,7 @@ void shouldProvideContains() { assertThat(first.contains(new LineRange(0, 1))).isFalse(); } - private LineRangeList createThreeElements() { + private List createThreeElements() { var range = new LineRangeList(); range.add(new LineRange(0, 1)); range.add(new LineRange(2, 3));