diff --git a/core/src/main/java/jenkins/util/SetContextClassLoader.java b/core/src/main/java/jenkins/util/SetContextClassLoader.java index c486fa4607e1..9e0a4c7dec30 100644 --- a/core/src/main/java/jenkins/util/SetContextClassLoader.java +++ b/core/src/main/java/jenkins/util/SetContextClassLoader.java @@ -62,7 +62,7 @@ public final class SetContextClassLoader implements AutoCloseable { * @since 2.362 */ public SetContextClassLoader() { - this(StackWalker.getInstance().getCallerClass()); + this(StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass()); } /**