From 05ab2d9784d9ea7b90cd6d6d30f14ad14804741f Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 9 Oct 2024 10:00:12 -0400 Subject: [PATCH] SpotBugs violations --- .../plugins/jacoco/JacocoPublisher.java | 26 +++---------------- .../plugins/jacoco/model/CoverageObject.java | 12 ++++----- .../plugins/jacoco/report/CoverageReport.java | 2 +- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/main/java/hudson/plugins/jacoco/JacocoPublisher.java b/src/main/java/hudson/plugins/jacoco/JacocoPublisher.java index 0b68e4a9..fa1f9baf 100644 --- a/src/main/java/hudson/plugins/jacoco/JacocoPublisher.java +++ b/src/main/java/hudson/plugins/jacoco/JacocoPublisher.java @@ -1,6 +1,5 @@ package hudson.plugins.jacoco; -import edu.umd.cs.findbugs.annotations.NonNull; import hudson.*; import hudson.model.Result; import hudson.model.AbstractBuild; @@ -51,7 +50,7 @@ public class JacocoPublisher extends Recorder implements SimpleBuildStep { *

* TODO: define a configuration mechanism. */ - public Rule rule; + // public Rule rule; @Deprecated public transient String includes; @Deprecated @@ -59,10 +58,10 @@ public class JacocoPublisher extends Recorder implements SimpleBuildStep { /** * {@link hudson.model.HealthReport} thresholds to apply. */ - public JacocoHealthReportThresholds healthReports; + private JacocoHealthReportThresholds healthReports; // Delta coverage thresholds to apply - public JacocoHealthReportDeltaThresholds deltaHealthReport; + JacocoHealthReportDeltaThresholds deltaHealthReport; /** @@ -799,27 +798,8 @@ public BuildStepMonitor getRequiredMonitorService() { return BuildStepMonitor.NONE; } - @Override - public BuildStepDescriptor getDescriptor() { - return (BuildStepDescriptor)super.getDescriptor(); - } - - /** - * @deprecated - * use injection via {@link Jenkins#getInjector()} - */ - public static /*final*/ BuildStepDescriptor DESCRIPTOR; - - private static void setDescriptor(BuildStepDescriptor descriptor) { - DESCRIPTOR = descriptor; - } - @Extension @Symbol("jacoco") public static class DescriptorImpl extends BuildStepDescriptor { - public DescriptorImpl() { - super(JacocoPublisher.class); - setDescriptor(this); - } @NonNull @Override diff --git a/src/main/java/hudson/plugins/jacoco/model/CoverageObject.java b/src/main/java/hudson/plugins/jacoco/model/CoverageObject.java index 79b7613c..ddfaaf85 100644 --- a/src/main/java/hudson/plugins/jacoco/model/CoverageObject.java +++ b/src/main/java/hudson/plugins/jacoco/model/CoverageObject.java @@ -66,12 +66,12 @@ public abstract class CoverageObject> { /** * Variables used to store which child has to highest coverage for each coverage type. */ - public int maxClazz=1; - public int maxMethod=1; - public int maxLine=1; - public int maxComplexity=1; - public int maxInstruction=1; - public int maxBranch=1; + private int maxClazz=1; + private int maxMethod=1; + private int maxLine=1; + private int maxComplexity=1; + private int maxInstruction=1; + private int maxBranch=1; private volatile boolean failed = false; diff --git a/src/main/java/hudson/plugins/jacoco/report/CoverageReport.java b/src/main/java/hudson/plugins/jacoco/report/CoverageReport.java index d38b2107..fb91a216 100644 --- a/src/main/java/hudson/plugins/jacoco/report/CoverageReport.java +++ b/src/main/java/hudson/plugins/jacoco/report/CoverageReport.java @@ -51,7 +51,7 @@ private CoverageReport(JacocoBuildAction action) { // private String complexityColor; // private String lineColor; // private String methodColor; - public JacocoHealthReportThresholds healthReports; + private JacocoHealthReportThresholds healthReports; /** * Loads the exec files using JaCoCo API. Creates the reporting objects and the report tree.