diff --git a/src/main/java/hudson/plugin/versioncolumn/JVMVersionMonitor.java b/src/main/java/hudson/plugin/versioncolumn/JVMVersionMonitor.java index 67ce20c..4bb416d 100644 --- a/src/main/java/hudson/plugin/versioncolumn/JVMVersionMonitor.java +++ b/src/main/java/hudson/plugin/versioncolumn/JVMVersionMonitor.java @@ -36,6 +36,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import jenkins.security.MasterToSlaveCallable; +import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; public class JVMVersionMonitor extends NodeMonitor { @@ -110,6 +111,7 @@ public JVMVersionComparator.ComparisonMode getComparisonMode() { } @Extension + @Symbol("jvmVersion") public static class JvmVersionDescriptor extends AbstractAsyncNodeMonitorDescriptor { @Override diff --git a/src/main/java/hudson/plugin/versioncolumn/VersionMonitor.java b/src/main/java/hudson/plugin/versioncolumn/VersionMonitor.java index ef539d1..2aca082 100644 --- a/src/main/java/hudson/plugin/versioncolumn/VersionMonitor.java +++ b/src/main/java/hudson/plugin/versioncolumn/VersionMonitor.java @@ -24,6 +24,7 @@ package hudson.plugin.versioncolumn; import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.Extension; import hudson.Util; import hudson.model.Computer; @@ -34,13 +35,16 @@ import java.io.IOException; import java.util.logging.Logger; import jenkins.security.MasterToSlaveCallable; -import net.sf.json.JSONObject; -import org.kohsuke.stapler.StaplerRequest; +import org.jenkinsci.Symbol; +import org.kohsuke.stapler.DataBoundConstructor; public class VersionMonitor extends NodeMonitor { private static final String masterVersion = Launcher.VERSION; + @DataBoundConstructor + public VersionMonitor() {} + @SuppressWarnings("unused") // jelly public String toHtml(String version) { if (version == null) { @@ -52,8 +56,19 @@ public String toHtml(String version) { return version; } + @SuppressFBWarnings(value = "MS_PKGPROTECT", justification = "for backward compatibility") + public static /*almost final*/ AbstractNodeMonitorDescriptor DESCRIPTOR; + @Extension - public static final AbstractNodeMonitorDescriptor DESCRIPTOR = new AbstractNodeMonitorDescriptor<>() { + @Symbol("remotingVersion") + public static class DescriptorImpl extends AbstractNodeMonitorDescriptor { + + @SuppressFBWarnings( + value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", + justification = "for backward compatibility") + public DescriptorImpl() { + DESCRIPTOR = this; + } protected String monitor(Computer c) throws IOException, InterruptedException { String version = c.getChannel().call(new SlaveVersion()); @@ -70,12 +85,7 @@ protected String monitor(Computer c) throws IOException, InterruptedException { public String getDisplayName() { return Messages.VersionMonitor_DisplayName(); } - - @Override - public NodeMonitor newInstance(StaplerRequest req, @NonNull JSONObject formData) throws FormException { - return new VersionMonitor(); - } - }; + } private static final class SlaveVersion extends MasterToSlaveCallable {