From c82620dca9ebe9d4e1d6eecc4c1fd878532c9a62 Mon Sep 17 00:00:00 2001 From: Daniel Beck Date: Sat, 31 Mar 2018 19:06:21 +0200 Subject: [PATCH] Minimize readResolve visibility (#2567) * Minimize readResolve visibility * Relax visibility from private to protected --- core/src/main/java/hudson/ProxyConfiguration.java | 2 +- core/src/main/java/hudson/model/MyViewsProperty.java | 3 +++ core/src/main/java/hudson/scm/NullChangeLogParser.java | 2 +- core/src/main/java/hudson/tasks/ArtifactArchiver.java | 4 ++-- core/src/main/java/jenkins/install/InstallState.java | 2 +- test/src/test/java/hudson/model/RunMapTest.java | 2 +- test/src/test/java/hudson/triggers/TriggerTest.java | 2 +- .../test/java/hudson/util/RobustReflectionConverterTest.java | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/hudson/ProxyConfiguration.java b/core/src/main/java/hudson/ProxyConfiguration.java index d8c0d032af..b8ba5bdf3f 100644 --- a/core/src/main/java/hudson/ProxyConfiguration.java +++ b/core/src/main/java/hudson/ProxyConfiguration.java @@ -204,7 +204,7 @@ public final class ProxyConfiguration extends AbstractDescribableImpl} * @see #UNUSED_INNER_CLASSES */ - public Object readResolve() { + protected Object readResolve() { // If we get invalid state from the configuration, fallback to unknown if (StringUtils.isBlank(name)) { LOGGER.log(Level.WARNING, "Read install state with blank name: ''{0}''. It will be ignored", name); diff --git a/test/src/test/java/hudson/model/RunMapTest.java b/test/src/test/java/hudson/model/RunMapTest.java index 3d555f2691..bfa4529ee9 100644 --- a/test/src/test/java/hudson/model/RunMapTest.java +++ b/test/src/test/java/hudson/model/RunMapTest.java @@ -98,7 +98,7 @@ public class RunMapTest { } public static class BombAction extends InvisibleAction { - public Object readResolve() { + private Object readResolve() { bombed = true; throw new NullPointerException(); } diff --git a/test/src/test/java/hudson/triggers/TriggerTest.java b/test/src/test/java/hudson/triggers/TriggerTest.java index 48679ff669..c915da8007 100644 --- a/test/src/test/java/hudson/triggers/TriggerTest.java +++ b/test/src/test/java/hudson/triggers/TriggerTest.java @@ -71,7 +71,7 @@ public class TriggerTest { // Override Trigger#readResolve so this one is not called @Override - public Object readResolve() { + protected Object readResolve() { return this; } diff --git a/test/src/test/java/hudson/util/RobustReflectionConverterTest.java b/test/src/test/java/hudson/util/RobustReflectionConverterTest.java index d728e053f1..2eef414668 100644 --- a/test/src/test/java/hudson/util/RobustReflectionConverterTest.java +++ b/test/src/test/java/hudson/util/RobustReflectionConverterTest.java @@ -100,7 +100,7 @@ public class RobustReflectionConverterTest { return ACCEPT_KEYWORD.equals(keyword); } - public Object readResolve() throws Exception { + private Object readResolve() throws Exception { if (!ACL.SYSTEM.equals(Jenkins.getAuthentication())) { // called via REST / CLI with authentication if (!isAcceptable()) {