Skip to content

Commit

Permalink
fix: serialVersionUID fix for most of the cases found and removed inc…
Browse files Browse the repository at this point in the history
…onsistency
  • Loading branch information
rng70-or committed Oct 19, 2023
1 parent 1e663d7 commit 059de13
Show file tree
Hide file tree
Showing 43 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/EnvVars.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
* @author Kohsuke Kawaguchi
*/
public class EnvVars extends TreeMap<String, String> {
private static final long serialVersionUID = 4320331661987259022L;
private static final long serialVersionUID = 1L;
private static Logger LOGGER = Logger.getLogger(EnvVars.class.getName());
/**
* If this {@link EnvVars} object represents the whole environment variable set,
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/java/hudson/FilePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
* // if 'file' is on a different node, this FileCallable will
* // be transferred to that node and executed there.
* private static final class Freshen implements FileCallable&lt;Void&gt; {
* private static final long serialVersionUID = 1;
* private static final long serialVersionUID = 1L;
* &#64;Override public Void invoke(File f, VirtualChannel channel) {
* // f and file represent the same thing
* f.deleteContents();
Expand Down Expand Up @@ -1791,7 +1791,7 @@ private static class Touch extends MasterToSlaveFileCallable<Void> {
this.timestamp = timestamp;
}

private static final long serialVersionUID = -5094638816500738429L;
private static final long serialVersionUID = 1L;

@Override
public Void invoke(File f, VirtualChannel channel) throws IOException {
Expand Down Expand Up @@ -1819,7 +1819,7 @@ private static class SetLastModified extends MasterToSlaveFileCallable<String> {
this.timestamp = timestamp;
}

private static final long serialVersionUID = -828220335793641630L;
private static final long serialVersionUID = 1L;

@Override
public String invoke(File f, VirtualChannel channel) throws IOException {
Expand Down Expand Up @@ -2675,7 +2675,7 @@ public void copyTo(OutputStream os) throws IOException, InterruptedException {
}

private static class CopyTo extends MasterToSlaveFileCallable<Void> {
private static final long serialVersionUID = 4088559042349254141L;
private static final long serialVersionUID = 1L;
private final OutputStream out;

CopyTo(OutputStream out) {
Expand Down Expand Up @@ -3182,7 +3182,7 @@ private static class ValidateAntFileMask extends MasterToSlaveFileCallable<Strin
this.bound = bound;
}

private static final long serialVersionUID = 1;
private static final long serialVersionUID = 1L;

@Override
public String invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException {
Expand Down Expand Up @@ -3636,7 +3636,7 @@ public FilePath call() throws IOException {
*/
public static final class ExplicitlySpecifiedDirScanner extends DirScanner {

private static final long serialVersionUID = 1;
private static final long serialVersionUID = 1L;

private final Map<String, String> files;

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ protected int compare(long idA, long idB) {

public static class ThreadGroupMap extends ThreadSorterBase implements Comparator<ThreadInfo>, Serializable {

private static final long serialVersionUID = 7803975728695308444L;
private static final long serialVersionUID = 1L;

/**
* @return ThreadGroup name or null if unknown
Expand All @@ -1534,7 +1534,7 @@ public int compare(ThreadInfo a, ThreadInfo b) {

private static class ThreadSorter extends ThreadSorterBase implements Comparator<Thread>, Serializable {

private static final long serialVersionUID = 5053631350439192685L;
private static final long serialVersionUID = 1L;

@Override
public int compare(Thread a, Thread b) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@SuppressFBWarnings(value = "SE_NO_SERIALVERSIONID", justification = "The Serializable should be removed.")
@Extension
public class SetBuildDescriptionCommand extends CLICommand implements Serializable {
private static final long serialVersionUID = -7269184394646019447L;
private static final long serialVersionUID = 1L;

@Override
public String getShortDescription() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Extension
public class SetBuildDisplayNameCommand extends CLICommand implements Serializable {
private static final long serialVersionUID = 6665171784136358536L;
private static final long serialVersionUID = 1L;

@Override
public String getShortDescription() {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/console/HyperlinkNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@ public String getDisplayName() {
}

private static final Logger LOGGER = Logger.getLogger(HyperlinkNote.class.getName());
private static final long serialVersionUID = 3908468829358026949L;
private static final long serialVersionUID = 1L;
}
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/logging/LogRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public void disable() {

private static class TargetComparator implements Comparator<Target>, Serializable {

private static final long serialVersionUID = 9285340752515798L;
private static final long serialVersionUID = 1L;

@Override
public int compare(Target left, Target right) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/FileParameterValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
public class FileParameterValue extends ParameterValue {
private static final String FOLDER_NAME = "fileParameters";
private static final Pattern PROHIBITED_DOUBLE_DOT = Pattern.compile(".*[\\\\/]\\.\\.[\\\\/].*");
private static final long serialVersionUID = -143427023159076073L;
private static final long serialVersionUID = 1L;

/**
* Escape hatch for SECURITY-1074, fileParameter used to escape their expected folder.
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/model/HealthReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class HealthReport implements Serializable, Comparable<HealthReport> {
private static final String HEALTH_UNKNOWN_IMG = "empty.png";

private static final Map<String, String> iconIMGToClassMap = new HashMap<>();
private static final long serialVersionUID = 7451361788415642230L;
private static final long serialVersionUID = 1L;

static {
iconIMGToClassMap.put(HEALTH_OVER_80_IMG, HEALTH_OVER_80);
Expand Down Expand Up @@ -355,7 +355,7 @@ public static HealthReport max(HealthReport a, HealthReport b) {
* Fix deserialization of older data.
*/
public static class ConverterImpl extends XStream2.PassthruConverter<HealthReport> {
private static final long serialVersionUID = -1L;
private static final long serialVersionUID = 1L;
public ConverterImpl(XStream2 xstream) { super(xstream); }

Check warning on line 359 in core/src/main/java/hudson/model/HealthReport.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

ERROR: 'CTOR_DEF' should be separated from previous line. [EmptyLineSeparator]

Check warning on line 359 in core/src/main/java/hudson/model/HealthReport.java

View check run for this annotation

ci.jenkins.io / Java Compiler

license:process

ERROR: 'CTOR_DEF' should be separated from previous line. [EmptyLineSeparator]

Check warning on line 359 in core/src/main/java/hudson/model/HealthReport.java

View check run for this annotation

ci.jenkins.io / CheckStyle

EmptyLineSeparatorCheck

ERROR: 'CTOR_DEF' should be separated from previous line.
Raw output
<p>Since Checkstyle 5.8</p><p> Checks for empty line separators after header, package, all import declarations, fields, constructors, methods, nested classes, static initializers and instance initializers. </p><p> ATTENTION: empty line separator is required between AST siblings, not after line where token is found. </p>

@Override protected void callback(HealthReport hr, UnmarshallingContext context) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/JDK.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class JDK extends ToolInstallation implements NodeSpecific<JDK>, En
* @since 1.577
*/
public static final String DEFAULT_NAME = "(System)";
private static final long serialVersionUID = -3318291200160313357L;
private static final long serialVersionUID = 1L;

@Restricted(NoExternalUse.class)
public static boolean isDefaultName(String name) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Label.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public boolean isSelfLabel() {
}

private static class NodeSorter implements Comparator<Node>, Serializable {
private static final long serialVersionUID = -7368519598046684532L;
private static final long serialVersionUID = 1L;

@Override
public int compare(Node o1, Node o2) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/ParameterValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
@ExportedBean(defaultVisibility = 3)
@StaplerAccessibleType
public abstract class ParameterValue implements Serializable {
private static final long serialVersionUID = -7269184774646019967L;
private static final long serialVersionUID = 1L;

private static final Logger LOGGER = Logger.getLogger(ParameterValue.class.getName());

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Slave.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
* @author Kohsuke Kawaguchi
*/
public abstract class Slave extends Node implements Serializable {
private static final long serialVersionUID = -7267774394646019967L;
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = Logger.getLogger(Slave.class.getName());

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private void error(Computer c, Throwable x) {
* returns computers that was not monitored as they ware either offline or monitor produced {@code null} {@link Callable}.
*/
protected static final class Result<T> {
private static final long serialVersionUID = -7671448355804481216L;
private static final long serialVersionUID = 1L;

private final @NonNull Map<Computer, T> data;
private final @NonNull ArrayList<Computer> skipped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private <T extends Throwable> MemoryUsage report(T e) throws T {
*/
@ExportedBean
public static class MemoryUsage2 extends MemoryUsage {
private static final long serialVersionUID = 2216994637932270352L;
private static final long serialVersionUID = 1L;

public MemoryUsage2(MemoryUsage mem) {
super(mem.totalPhysicalMemory, mem.availablePhysicalMemory, mem.totalSwapSpace, mem.availableSwapSpace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public abstract class AuthorizationStrategy extends AbstractDescribableImpl<Auth
public static final AuthorizationStrategy UNSECURED = new Unsecured();

public static final class Unsecured extends AuthorizationStrategy implements Serializable {
private static final long serialVersionUID = -7269184394646019967L;
private static final long serialVersionUID = 1L;
/**
* Maintains the singleton semantics.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public abstract class FederatedLoginService implements ExtensionPoint {
* Identity information as obtained from {@link FederatedLoginService}.
*/
public abstract class FederatedIdentity implements Serializable {
private static final long serialVersionUID = -7269184394646019567L;
private static final long serialVersionUID = 1L;
/**
* Gets the string representation of the identity in the form that makes sense to the enclosing
* {@link FederatedLoginService}, such as full OpenID URL.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/slaves/ChannelPinger.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void install(Channel channel) {
@VisibleForTesting
@Restricted(NoExternalUse.class)
public static class SetUpRemotePing extends MasterToSlaveCallable<Void, IOException> {
private static final long serialVersionUID = -2702219700841759872L;
private static final long serialVersionUID = 1L;
@Deprecated
private transient int pingInterval;
private final int pingTimeoutSeconds;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/tasks/ArtifactArchiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public void perform(Run<?, ?> build, FilePath ws, EnvVars environment, Launcher
}

private static final class ListFiles extends MasterToSlaveFileCallable<Map<String, String>> {
private static final long serialVersionUID = 1;
private static final long serialVersionUID = 1L;
private final String includes, excludes;
private final boolean defaultExcludes;
private final boolean caseSensitive;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/tasks/LogRotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class LogRotator extends BuildDiscarder {
/** @deprecated Replaced by more generic {@link CompositeIOException}. */
@Deprecated
public static class CollatedLogRotatorException extends IOException {
private static final long serialVersionUID = 5944233808072651101L;
private static final long serialVersionUID = 1L;

public final Collection<Exception> collated;

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/tasks/Maven.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private Object readResolve() {
* name.
*/
private static final class DecideDefaultMavenCommand extends MasterToSlaveFileCallable<String> {
private static final long serialVersionUID = -2327576423452215146L;
private static final long serialVersionUID = 1L;
// command line arguments.
private final String arguments;

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/tools/ToolInstallation.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
*/
public abstract class ToolInstallation extends AbstractDescribableImpl<ToolInstallation>
implements Serializable, ExtensionPoint {
private static final long serialVersionUID = -7261984394646019967L;
private static final long serialVersionUID = 1L;

private static final Logger LOGGER = Logger.getLogger(ToolInstallation.class.getName());

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/util/AbstractTaskListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
@RestrictedSince("2.91")
public abstract class AbstractTaskListener implements TaskListener {

private static final long serialVersionUID = 7217626701881006422L;
private static final long serialVersionUID = 1L;

}
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/util/ClasspathBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @since 1.300
*/
public class ClasspathBuilder implements Serializable {
private static final long serialVersionUID = -7269184387646019967L;
private static final long serialVersionUID = 1L;

private final List<String> args = new ArrayList<>();

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/util/DirScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void scan(File dir, FileVisitor visitor) throws IOException {
}

private static class DescendantFileSelector implements FileSelector {
private static final long serialVersionUID = 5L;
private static final long serialVersionUID = 1L;
private final Set<String> alreadyDeselected;
private final FilePath baseDirFP;
private final int baseDirPathLength;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/util/Secret.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingCont
return fromString(reader.getValue());
}

private static final long serialVersionUID = 7269184394646019967L;
private static final long serialVersionUID = 1L;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/util/io/ParserConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
*/
@Deprecated
public abstract class ParserConfigurator implements ExtensionPoint, Serializable {
private static final long serialVersionUID = -2523542286453177108L;
private static final long serialVersionUID = 1L;

/**
* Configures the given {@link SAXReader}
Expand Down Expand Up @@ -88,7 +88,7 @@ public static void applyConfiguration(SAXReader reader, Object context) throws I
}

private static class GetParserConfigurators extends SlaveToMasterCallable<Collection<ParserConfigurator>, IOException> {
private static final long serialVersionUID = -2178106894481500733L;
private static final long serialVersionUID = 1L;

@Override
public Collection<ParserConfigurator> call() throws IOException {
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/jenkins/model/IdStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Character convertPseudoUnicode(String matchedGroup) {
*/
public static class CaseInsensitive extends IdStrategy implements Serializable {

private static final long serialVersionUID = -7244768200684861085L;
private static final long serialVersionUID = 1L;

@DataBoundConstructor
public CaseInsensitive() {}
Expand Down Expand Up @@ -236,7 +236,7 @@ public String getDisplayName() {
*/
public static class CaseSensitive extends IdStrategy implements Serializable {

private static final long serialVersionUID = 8339425353883308324L;
private static final long serialVersionUID = 1L;

@DataBoundConstructor
public CaseSensitive() {}
Expand Down Expand Up @@ -283,7 +283,7 @@ public String getDisplayName() {
*/
public static class CaseSensitiveEmailAddress extends CaseSensitive implements Serializable {

private static final long serialVersionUID = -5713655323057260180L;
private static final long serialVersionUID = 1L;

@DataBoundConstructor
public CaseSensitiveEmailAddress() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@ExportedBean
@Restricted(NoExternalUse.class)
public class Category implements Serializable {
private static final long serialVersionUID = 9269184394646019967L;
private static final long serialVersionUID = 1L;

private String id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class DomainValidator implements Serializable {
/** Maximum allowable length ({@value}) of a domain name */
private static final int MAX_DOMAIN_LENGTH = 253;

private static final long serialVersionUID = -4407125112880174009L;
private static final long serialVersionUID = 1L;

// Regular expression strings for hostnames (derived from RFC2396 and RFC 1123)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class InetAddressValidator implements Serializable {

private static final int BASE_16 = 16;

private static final long serialVersionUID = -919201640201914789L;
private static final long serialVersionUID = 1L;

private static final String IPV4_REGEX =
"^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
// end of [PATCH]
public class RegexValidator implements Serializable {

private static final long serialVersionUID = -8832409930574867162L;
private static final long serialVersionUID = 1L;

private final Pattern[] patterns;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
// end of [PATCH]
public class UrlValidator implements Serializable {

private static final long serialVersionUID = 7557161713937335013L;
private static final long serialVersionUID = 1L;

private static final int MAX_UNSIGNED_16_BIT_INT = 0xFFFF; // port max

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/tasks/SimpleBuildWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void setDisposer(@NonNull Disposer disposer) {
*/
public abstract static class Disposer implements Serializable {

private static final long serialVersionUID = -7263485554646019967L;
private static final long serialVersionUID = 1L;
@CheckForNull
private Boolean wrapperRequiresWorkspace;

Expand Down
Loading

0 comments on commit 059de13

Please sign in to comment.