From 82970c0f242f1f6de40b70bb6f73356aaa56656b Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 7 Oct 2023 10:59:16 -0400
Subject: [PATCH 01/19] chore(deps): update plugin com.gradle.enterprise to
v3.15.1 (#2606)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
settings.gradle.kts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 8d354c56dde..d65c9cf83ec 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,5 +1,5 @@
plugins {
- id("com.gradle.enterprise") version "3.15"
+ id("com.gradle.enterprise") version "3.15.1"
}
include(":eclipsePlugin")
From b245f766bf8780852ae89a557bd546519963ef22 Mon Sep 17 00:00:00 2001
From: Guillaume Toison <86775455+gtoison@users.noreply.github.com>
Date: Sat, 7 Oct 2023 16:59:49 +0200
Subject: [PATCH 02/19] build: install readthedocs requirements (#2608)
The template readthedocs v2 configuration file add the requirements
install commented out. Enable it so we install the theme
---
.readthedocs.yaml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index b468076c68e..f6a12ce2d52 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -30,6 +30,6 @@ sphinx:
# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
-# python:
-# install:
-# - requirements: docs/requirements.txt
+python:
+ install:
+ - requirements: docs/requirements.txt
From d3b130cc95a38af8ba84cb687d48ba610f487094 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 7 Oct 2023 11:10:19 -0400
Subject: [PATCH 03/19] fix(deps): update dependency org.mockito:mockito-core
to v5.6.0 (#2610)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
eclipsePlugin-junit/build.gradle | 2 +-
spotbugsTestCases/build.gradle | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/eclipsePlugin-junit/build.gradle b/eclipsePlugin-junit/build.gradle
index 4db835143b0..97ca15fd50f 100644
--- a/eclipsePlugin-junit/build.gradle
+++ b/eclipsePlugin-junit/build.gradle
@@ -12,7 +12,7 @@ tasks.named('compileJava', JavaCompile).configure {
dependencies {
implementation project(':eclipsePlugin')
testImplementation 'org.junit.vintage:junit-vintage-engine:5.10.0'
- testImplementation 'org.mockito:mockito-core:5.5.0'
+ testImplementation 'org.mockito:mockito-core:5.6.0'
}
tasks.named('jacocoTestReport', JacocoReport).configure {
diff --git a/spotbugsTestCases/build.gradle b/spotbugsTestCases/build.gradle
index a2195117a4e..78f9327e782 100644
--- a/spotbugsTestCases/build.gradle
+++ b/spotbugsTestCases/build.gradle
@@ -34,7 +34,7 @@ dependencies {
implementation project(':spotbugs')
api project(':spotbugs-annotations')
implementation 'org.apache.groovy:groovy-all:4.0.15'
- implementation 'org.mockito:mockito-core:5.5.0'
+ implementation 'org.mockito:mockito-core:5.6.0'
}
tasks.withType(JavaCompile).configureEach {
From bc6a9d4a606f74cbceef2a6f3fdd0ef029cdc8ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Patrik=20S=C3=BCli?=
Ce code stocke une référence à un objet modifiable externe dans un champ statique. Si des modifications non vérifiées de l'objet modifiable peuvent compromettre la sécurité ou d'autres propriétés importantes, vous devez faire autre chose. Stocker une copie de l'objet est souvent une meilleur approche.
]]> @@ -2562,8 +2562,8 @@ public vida foo() {* Add an entry to aux classpath of SpotBugs analysis. *
+ * @param engineCustomization + * A customization of the engine to apply before running engine#execute * @param path * A path of the target class file or jar file. Non-null. * @return callee itself, so caller can chain another method in fluent interface. */ // TODO let users specify "groupId:artifactId:packaging:version:classifier" like Grape in Groovy @Nonnull - public SpotBugsRunner addAuxClasspathEntry(Path path) { + public SpotBugsRunner addAuxClasspathEntry(Consumer* Run SpotBugs under given condition, and return its result. *
+ * @param engineCustomization + * A customization of the engine to apply before running engine#execute * @param paths * Paths of target class files * @return a {@link BugCollection} which contains all detected bugs. */ // TODO let users specify SlashedClassName, then find its file path automatically @Nonnull - public BugCollection performAnalysis(Path... paths) { + public BugCollection performAnalysis(Consumer+ * Run SpotBugs under given condition, and return its result. + *
+ * @param paths + * Paths of target class files + * @return a {@link BugCollection} which contains all detected bugs. + */ + // TODO let users specify SlashedClassName, then find its file path automatically + @Nonnull + public BugCollection performAnalysis(Path... paths) { + return performAnalysis(e -> { + }, paths); } } diff --git a/test-harness/build.gradle b/test-harness/build.gradle index 98f426629aa..3392c12cd57 100644 --- a/test-harness/build.gradle +++ b/test-harness/build.gradle @@ -3,7 +3,8 @@ apply from: "$rootDir/gradle/javadoc.gradle" apply from: "$rootDir/gradle/maven.gradle" dependencies { - compileOnly 'org.junit.vintage:junit-vintage-engine:5.10.0' + compileOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' + compileOnly 'org.hamcrest:hamcrest:2.2' testImplementation project(':spotbugs') api project(':test-harness-core') } @@ -15,8 +16,8 @@ java { publishing.publications.maven { pom { - name = 'JUnit 4 Test Harness for SpotBugs Plugin' - description = 'A test harness library for SpotBugs plugin developers to test on JUnit4' + name = 'JUnit 5 Test Harness for SpotBugs Plugin' + description = 'A test harness library for SpotBugs plugin developers to test on JUnit5' } } diff --git a/test-harness/src/main/java/edu/umd/cs/findbugs/test/CountMatcher.java b/test-harness/src/main/java/edu/umd/cs/findbugs/test/CountMatcher.java index 755091b1a46..d3d85ef8786 100644 --- a/test-harness/src/main/java/edu/umd/cs/findbugs/test/CountMatcher.java +++ b/test-harness/src/main/java/edu/umd/cs/findbugs/test/CountMatcher.java @@ -1,7 +1,6 @@ package edu.umd.cs.findbugs.test; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; @@ -33,7 +32,6 @@ public CountMatcher(int count, Matcher- * A JUnit rule to execute integration test for SpotBugs. This is basically - * designed to help SpotBugs plugin developer to test their product. Basic usage: - *
- *
- * public class MyIntegrationTest {
- * @Rule
- * public SpotBugsRule spotbugs = new SpotBugsRule();
- * @Test
- * public void testIssuesAreFound() {
- * Path path = Paths.get("target/classes/my/company/AnalyzedClass.class")
- * BugCollection bugCollection = spotbugs.performAnalysis(path);
- *
- * // There should only be exactly 1 issue of this type
- * final BugInstanceMatcher bugTypeMatcher = new BugInstanceMatcherBuilder()
- * .bugType("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE").build();
- * assertThat(bugCollection, CountMatcher.containsExactly(1, bugTypeMatcher));
- *
- * final BugInstanceMatcher bugInstanceMatcher = new BugInstanceMatcherBuilder()
- * .bugType("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
- * .inClass("AnalyzedClass")
- * .atLine(25)
- * .build();
- * assertThat(bugCollection, hasItem(bugInstanceMatcher));
- * }
- * }
- *
- * @since 3.1
- */
-@ParametersAreNonnullByDefault
-public class SpotBugsRule extends ExternalResource {
- private AnalysisRunner runner;
-
- @Override
- protected void before() throws Throwable {
- runner = new AnalysisRunner();
- }
-
- @Override
- protected void after() {
- runner = null;
- }
-
- /**
- * - * Add an entry to aux classpath of SpotBugs analysis. - *
- * @param path - * A path of the target class file or jar file. Non-null. - * @return callee itself, so caller can chain another method in fluent interface. - */ - // TODO let users specify "groupId:artifactId:packaging:version:classifier" like Grape in Groovy - @Nonnull - public SpotBugsRule addAuxClasspathEntry(Path path) { - if (runner == null) { - throw new IllegalStateException( - "Please call this addAuxClasspathEntry() method in @Before method or test method"); - } - runner.addAuxClasspathEntry(path); - return this; - } - - /** - *- * Run SpotBugs under given condition, and return its result. - *
- * @param engineCustomization - * A customization of the engine to apply before running engine#execute - * @param paths - * Paths of target class files - * @return a {@link BugCollection} which contains all detected bugs. - */ - // TODO let users specify SlashedClassName, then find its file path automatically - @Nonnull - public BugCollection performAnalysis(Consumer- * Run SpotBugs under given condition, and return its result. - *
- * @param paths - * Paths of target class files - * @return a {@link BugCollection} which contains all detected bugs. - */ - // TODO let users specify SlashedClassName, then find its file path automatically - @Nonnull - public BugCollection performAnalysis(Path... paths) { - return performAnalysis(e -> { - }, paths); - } -} diff --git a/test-harness/src/main/java/edu/umd/cs/findbugs/test/service/ClassFileLocator.java b/test-harness/src/main/java/edu/umd/cs/findbugs/test/service/ClassFileLocator.java index b7af870f777..5ffea6d8c77 100644 --- a/test-harness/src/main/java/edu/umd/cs/findbugs/test/service/ClassFileLocator.java +++ b/test-harness/src/main/java/edu/umd/cs/findbugs/test/service/ClassFileLocator.java @@ -17,8 +17,8 @@ */ package edu.umd.cs.findbugs.test.service; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.net.URISyntaxException; import java.net.URL; @@ -38,7 +38,7 @@ public String getClassFilePath(String path) { return getFilenameFromUrl(url); } url = cl.getResource(path); - assertNotNull("No class found for the path = " + path, url); + assertNotNull(url, "No class found for the path = " + path); return getFilenameFromUrl(url); } @@ -52,14 +52,14 @@ public String getJspFilePath(String path) { url = cl.getResource("org/apache/jsp/" + generatedClassName + ".class"); } - assertNotNull("No jsp file found for the path = " + path, url); + assertNotNull(url, "No jsp file found for the path = " + path); return getFilenameFromUrl(url); } public String getJarFilePath(String path) { ClassLoader cl = getClass().getClassLoader(); URL url = cl.getResource(path); - assertNotNull("No jar found for the path = " + path, url); + assertNotNull(url, "No jar found for the path = " + path); return getFilenameFromUrl(url); } From b8c498cc05dced2c6f101c6e838aa32dca993d6c Mon Sep 17 00:00:00 2001 From: Jeremy Landis