From 0c0101ad005feaecae9c7637d5b2340ae3178492 Mon Sep 17 00:00:00 2001 From: Manfred Hanke Date: Sun, 5 Nov 2023 22:46:08 +0100 Subject: [PATCH 1/2] fix violations of new spotbugs rule `CT_CONSTRUCTOR_THROW` (which will show up with spotbugs >=5.2.0) cf. https://wiki.sei.cmu.edu/confluence/display/java/OBJ11-J.+Be+wary+of+letting+constructors+throw+exceptions Signed-off-by: Manfred Hanke --- .../main/java/com/tngtech/archunit/junit/ArchUnitRunner.java | 2 +- .../com/tngtech/archunit/core/importer/ClassFileSource.java | 4 ++-- .../com/tngtech/archunit/library/plantuml/rules/Alias.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/archunit-junit/junit4/src/main/java/com/tngtech/archunit/junit/ArchUnitRunner.java b/archunit-junit/junit4/src/main/java/com/tngtech/archunit/junit/ArchUnitRunner.java index 5020f553a6..d94d4ba62e 100644 --- a/archunit-junit/junit4/src/main/java/com/tngtech/archunit/junit/ArchUnitRunner.java +++ b/archunit-junit/junit4/src/main/java/com/tngtech/archunit/junit/ArchUnitRunner.java @@ -49,7 +49,7 @@ * The runner will cache classes between test runs, for details please refer to {@link com.tngtech.archunit.junit.internal.ClassCache}. */ @PublicAPI(usage = ACCESS) -public class ArchUnitRunner extends ParentRunner { +public final class ArchUnitRunner extends ParentRunner { private final InternalRunner runnerDelegate; @Internal diff --git a/archunit/src/main/java/com/tngtech/archunit/core/importer/ClassFileSource.java b/archunit/src/main/java/com/tngtech/archunit/core/importer/ClassFileSource.java index f3e5f6c56b..3468173578 100644 --- a/archunit/src/main/java/com/tngtech/archunit/core/importer/ClassFileSource.java +++ b/archunit/src/main/java/com/tngtech/archunit/core/importer/ClassFileSource.java @@ -41,7 +41,7 @@ @Internal interface ClassFileSource extends Iterable { @Internal - class FromFilePath extends SimpleFileVisitor implements ClassFileSource { + final class FromFilePath extends SimpleFileVisitor implements ClassFileSource { private final Set classFileLocations = new HashSet<>(); private final ImportOptions importOptions; @@ -87,7 +87,7 @@ InputStream getInputStream() throws IOException { } @Internal - class FromJar implements ClassFileSource { + final class FromJar implements ClassFileSource { private final Iterable classFileLocations; FromJar(URL jarUrl, String path, ImportOptions importOptions) { diff --git a/archunit/src/main/java/com/tngtech/archunit/library/plantuml/rules/Alias.java b/archunit/src/main/java/com/tngtech/archunit/library/plantuml/rules/Alias.java index 8ca2f6a308..09c6518967 100644 --- a/archunit/src/main/java/com/tngtech/archunit/library/plantuml/rules/Alias.java +++ b/archunit/src/main/java/com/tngtech/archunit/library/plantuml/rules/Alias.java @@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull; -class Alias { +final class Alias { private final String value; Alias(String value) { From 5e5712068c4ae22b82c6ee6a205229f714b24447 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 5 Nov 2023 22:09:49 +0000 Subject: [PATCH 2/2] Bump com.github.spotbugs from 5.1.4 to 5.2.1 As the `PI_DO_NOT_REUSE_PUBLIC_IDENTIFIERS_CLASS_NAMES` rule [https://wiki.sei.cmu.edu/confluence/display/java/DCL01-J.+Do+not+reuse+public+identifiers+from+the+Java+Standard+Library] doesn't seem to be too problematic, but produces quite some violations, it is just ignored. Co-authored-by: Manfred Hanke Signed-off-by: dependabot[bot] --- build.gradle | 2 +- .../src/main/resources/code_quality/spotbugs-excludes.xml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b4733b51e8..6fff6da13c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'archunit.base-conventions' id 'com.github.johnrengelman.shadow' version '7.1.2' apply false - id 'com.github.spotbugs' version '5.1.4' apply false + id 'com.github.spotbugs' version '5.2.1' apply false id "io.github.gradle-nexus.publish-plugin" version "1.3.0" apply false id "com.diffplug.spotless" version "6.23.2" apply false id 'com.github.ben-manes.versions' version '0.50.0' apply false diff --git a/buildSrc/src/main/resources/code_quality/spotbugs-excludes.xml b/buildSrc/src/main/resources/code_quality/spotbugs-excludes.xml index 0df9b98438..c57f9551dc 100644 --- a/buildSrc/src/main/resources/code_quality/spotbugs-excludes.xml +++ b/buildSrc/src/main/resources/code_quality/spotbugs-excludes.xml @@ -57,4 +57,8 @@ + + + +