From 7dee8b28f121f3e5178dabbc8866acc3b06634b8 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 1 Dec 2023 13:56:29 -0500 Subject: [PATCH] Clearer reproducer --- .../java/jenkins/model/PeepholePermalink.java | 2 +- .../jenkins/model/PeepholePermalinkTest.java | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/jenkins/model/PeepholePermalink.java b/core/src/main/java/jenkins/model/PeepholePermalink.java index 50dbdb39bb83..256dc438d4ae 100644 --- a/core/src/main/java/jenkins/model/PeepholePermalink.java +++ b/core/src/main/java/jenkins/model/PeepholePermalink.java @@ -135,7 +135,7 @@ protected File getPermalinkFile(Job job) { return b; } - static @NonNull Map cacheFor(@NonNull File buildDir) { + private static @NonNull Map cacheFor(@NonNull File buildDir) { synchronized (caches) { Map cache = caches.get(buildDir); if (cache == null) { diff --git a/core/src/test/java/jenkins/model/PeepholePermalinkTest.java b/core/src/test/java/jenkins/model/PeepholePermalinkTest.java index ad1ac7a7f3e6..35593a7ac623 100644 --- a/core/src/test/java/jenkins/model/PeepholePermalinkTest.java +++ b/core/src/test/java/jenkins/model/PeepholePermalinkTest.java @@ -28,7 +28,7 @@ import static org.hamcrest.Matchers.is; import hudson.model.PermalinkProjectAction; -import java.io.File; +import hudson.model.Run; import org.junit.Test; public final class PeepholePermalinkTest { @@ -39,7 +39,22 @@ public void classLoadingDeadlock() throws Exception { assertThat("successfully loaded LAST_STABLE_BUILD", PermalinkProjectAction.Permalink.LAST_STABLE_BUILD.getId(), is("lastStableBuild")); }); t.start(); - PeepholePermalink.cacheFor(new File(".")); + new PeepholePermalink() { + @Override + public boolean apply(Run run) { + throw new UnsupportedOperationException(); + } + + @Override + public String getDisplayName() { + throw new UnsupportedOperationException(); + } + + @Override + public String getId() { + throw new UnsupportedOperationException(); + } + }; t.join(); }