Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add serialVersionUID to serializable class #8561

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
@SuppressFBWarnings(value = "SE_NO_SERIALVERSIONID", justification = "The Serializable should be removed.")
@Extension
public class SetBuildDescriptionCommand extends CLICommand implements Serializable {
private static final long serialVersionUID = 1L;

@Override
public String getShortDescription() {
return Messages.SetBuildDescriptionCommand_ShortDescription();
}
}

@Argument(metaVar = "JOB", usage = "Name of the job to build", required = true, index = 0)
public transient Job<?, ?> job;
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/HealthReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,5 +368,7 @@ public static class ConverterImpl extends XStream2.PassthruConverter<HealthRepor
hr.iconClassName = iconIMGToClassMap.get(hr.iconUrl);
}
}

private static final long serialVersionUID = 1L;
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/ParameterDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
@ExportedBean(defaultVisibility = 3)
public abstract class ParameterDefinition implements
Describable<ParameterDefinition>, ExtensionPoint, Serializable {

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

private String description;
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/ParameterValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
@ExportedBean(defaultVisibility = 3)
@StaplerAccessibleType
public abstract class ParameterValue implements Serializable {
private static final long serialVersionUID = 1L;

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

Expand Down
4 changes: 3 additions & 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 = 1L;
private static final Logger LOGGER = Logger.getLogger(Slave.class.getName());

/**
Expand Down Expand Up @@ -760,6 +760,8 @@ private Object readResolve() {
long endTime = System.currentTimeMillis();
return new ClockDifference((startTime + endTime) / 2 - remoteTime);
}

private static final long serialVersionUID = 1L;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/security/AuthorizationStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ 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 = 1L;

/**
* Maintains the singleton semantics.
*/
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/security/FederatedLoginService.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public abstract class FederatedLoginService implements ExtensionPoint {
* Identity information as obtained from {@link FederatedLoginService}.
*/
public abstract class FederatedIdentity implements Serializable {
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
4 changes: 3 additions & 1 deletion core/src/main/java/hudson/tools/ToolInstallation.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@
* @author huybrechts
* @since 1.286
*/
public abstract class ToolInstallation extends AbstractDescribableImpl<ToolInstallation> implements Serializable, ExtensionPoint {
public abstract class ToolInstallation extends AbstractDescribableImpl<ToolInstallation>
implements Serializable, ExtensionPoint {
private static final long serialVersionUID = 1L;

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

Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/util/ClasspathBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* @since 1.300
*/
public class ClasspathBuilder implements Serializable {
private static final long serialVersionUID = 1L;

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

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

private static class DescendantFileSelector implements FileSelector {
private static final long serialVersionUID = 1L;
private final Set<String> alreadyDeselected;
private final FilePath baseDirFP;
private final int baseDirPathLength;
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/util/Secret.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingC
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) {
return fromString(reader.getValue());
}

private static final long serialVersionUID = 1L;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
@ExportedBean
@Restricted(NoExternalUse.class)
public class Categories implements HttpResponse, Serializable {
private static final long serialVersionUID = 1L;

private List<Category> items;

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

private String id;

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

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

Expand Down
7 changes: 6 additions & 1 deletion core/src/main/java/jenkins/util/VirtualFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
* @since 1.532
*/
public abstract class VirtualFile implements Comparable<VirtualFile>, Serializable {
private static final long serialVersionUID = 1L;

/**
* Gets the base name, meaning just the last portion of the path name without any
Expand Down Expand Up @@ -568,6 +569,7 @@ public static VirtualFile forFile(final File f) {
}

private static final class FileVF extends VirtualFile {
private static final long serialVersionUID = 2L;
private final File f;
private final File root;
private boolean cacheDescendant = false;
Expand Down Expand Up @@ -864,6 +866,7 @@ public static VirtualFile forFilePath(final FilePath f) {
}

private static final class FilePathVF extends VirtualFile {
private static final long serialVersionUID = 3L;
private final FilePath f;
private final FilePath root;
private boolean cacheDescendant = false;
Expand Down Expand Up @@ -1152,6 +1155,7 @@ private String computeRelativePathToRoot() {
}

private static final class Scanner extends MasterToSlaveFileCallable<List<String>> {
private static final long serialVersionUID = 1L;
private final String includes, excludes;
private final boolean useDefaultExcludes;
private final String verificationRoot;
Expand Down Expand Up @@ -1191,6 +1195,7 @@ private static final class Readable extends MasterToSlaveFileCallable<Boolean> {
@Override public Boolean invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
return f.canRead();
}
}

private static final long serialVersionUID = 1L;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/
@Deprecated
public class AnonymousAuthenticationToken implements Authentication, Serializable {
private static final long serialVersionUID = 1L;

// TODO perhaps better to extend AbstractAuthenticationToken
private final org.springframework.security.authentication.AnonymousAuthenticationToken delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
@Deprecated
public class WebAuthenticationDetails implements Serializable {
private static final long serialVersionUID = 1L;

public WebAuthenticationDetails(HttpServletRequest request) {}

}
Loading