Skip to content

Commit

Permalink
Merge branch 'update-forms' into update-forms-2
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Dec 29, 2021
2 parents b569503 + 8b35b58 commit 0d128dc
Show file tree
Hide file tree
Showing 342 changed files with 1,020 additions and 848 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/logging/LogRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.google.common.annotations.VisibleForTesting;
import com.thoughtworks.xstream.XStream;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.BulkChange;
import hudson.Extension;
import hudson.FilePath;
Expand Down Expand Up @@ -293,6 +294,7 @@ public boolean includes(LogRecord r) {
return rest.startsWith(".") || rest.length()==0;
}

@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "converting this to YesNoMaybe would break backward compatibility")
public Boolean matches(LogRecord r) {
boolean levelSufficient = r.getLevel().intValue() >= level;
if (name.length() == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import java.util.Objects;
import net.sf.json.JSONObject;
Expand Down Expand Up @@ -103,6 +104,7 @@ public int hashCode() {
}

@Override
@SuppressFBWarnings(value = "EQ_GETCLASS_AND_CLASS_CONSTANT", justification = "ParameterDefinitionTest tests that subclasses are not equal to their parent classes, so the behavior appears to be intentional")
public boolean equals(Object obj) {
if (BooleanParameterDefinition.class != getClass())
return super.equals(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.Util;
import hudson.util.FormValidation;
Expand Down Expand Up @@ -181,6 +182,7 @@ public int hashCode() {
}

@Override
@SuppressFBWarnings(value = "EQ_GETCLASS_AND_CLASS_CONSTANT", justification = "ParameterDefinitionTest tests that subclasses are not equal to their parent classes, so the behavior appears to be intentional")
public boolean equals(Object obj) {
if (ChoiceParameterDefinition.class != getClass())
return super.equals(obj);
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/FileParameterDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.cli.CLICommand;
import java.io.File;
Expand Down Expand Up @@ -140,6 +141,7 @@ public int hashCode() {
}

@Override
@SuppressFBWarnings(value = "EQ_GETCLASS_AND_CLASS_CONSTANT", justification = "ParameterDefinitionTest tests that subclasses are not equal to their parent classes, so the behavior appears to be intentional")
public boolean equals(Object obj) {
if (FileParameterDefinition.class != getClass())
return super.equals(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.util.Secret;
import java.util.Objects;
Expand Down Expand Up @@ -116,6 +117,7 @@ public int hashCode() {
}

@Override
@SuppressFBWarnings(value = "EQ_GETCLASS_AND_CLASS_CONSTANT", justification = "ParameterDefinitionTest tests that subclasses are not equal to their parent classes, so the behavior appears to be intentional")
public boolean equals(Object obj) {
if (PasswordParameterDefinition.class != getClass())
return super.equals(obj);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Queue.java
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,7 @@ public String getName() {
*/
@Restricted(NoExternalUse.class)
@ExportedBean(defaultVisibility = 999)
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "it is exported, so it might be used")
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public static class StubItem {

@Exported public StubTask task;
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/RunParameterDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.util.EnumConverter;
import hudson.util.RunList;
Expand Down Expand Up @@ -219,6 +220,7 @@ public int hashCode() {
}

@Override
@SuppressFBWarnings(value = "EQ_GETCLASS_AND_CLASS_CONSTANT", justification = "ParameterDefinitionTest tests that subclasses are not equal to their parent classes, so the behavior appears to be intentional")
public boolean equals(Object obj) {
if (RunParameterDefinition.class != getClass())
return super.equals(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.Util;
import java.util.Objects;
Expand Down Expand Up @@ -172,6 +173,7 @@ public int hashCode() {
}

@Override
@SuppressFBWarnings(value = "EQ_GETCLASS_AND_CLASS_CONSTANT", justification = "ParameterDefinitionTest tests that subclasses are not equal to their parent classes, so the behavior appears to be intentional")
public boolean equals(Object obj) {
if (StringParameterDefinition.class != getClass())
return super.equals(obj);
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/TextParameterDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import java.util.Objects;
import net.sf.json.JSONObject;
Expand Down Expand Up @@ -85,6 +86,7 @@ public int hashCode() {
}

@Override
@SuppressFBWarnings(value = "EQ_GETCLASS_AND_CLASS_CONSTANT", justification = "ParameterDefinitionTest tests that subclasses are not equal to their parent classes, so the behavior appears to be intentional")
public boolean equals(Object obj) {
if (TextParameterDefinition.class != getClass())
return super.equals(obj);
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/UpdateCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,7 @@ public final class CompleteBatchJob extends UpdateCenterJob {
private final List<PluginWrapper> batch;
private final long start;
@Exported(inline = true)
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public volatile CompleteBatchJobStatus status = new CompleteBatchJob.Pending();

public CompleteBatchJob(List<PluginWrapper> batch, long start, UUID correlationId) {
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/search/Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public static class Result {
@ExportedBean(defaultVisibility=999)
public static class Item {
@Exported
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public String name;

public Item(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ public static final class SignupInfo {
* To display a general error message, set it here.
*
*/
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public String errorMessage;

/**
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/security/SidACL.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static java.util.logging.Level.FINER;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.logging.Logger;
import org.acegisecurity.acls.sid.GrantedAuthoritySid;
import org.acegisecurity.acls.sid.PrincipalSid;
Expand Down Expand Up @@ -65,6 +66,7 @@ public boolean hasPermission2(@NonNull Authentication a, Permission permission)
* true or false if {@link #hasPermission(Sid, Permission)} returns it.
* Otherwise null, indicating that this ACL doesn't have any entry for it.
*/
@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "converting this to YesNoMaybe would break backward compatibility")
protected Boolean _hasPermission(@NonNull Authentication a, Permission permission) {
// ACL entries for this principal takes precedence
Boolean b = hasPermission(new PrincipalSid(a),permission);
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/security/SparseACL.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import static java.util.logging.Level.FINE;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
Expand Down Expand Up @@ -84,6 +85,7 @@ public boolean hasPermission2(Authentication a, Permission permission) {
return false;
}

@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "converting this to YesNoMaybe would break backward compatibility")
@Override
protected Boolean hasPermission(Sid p, Permission permission) {
for( ; permission!=null; permission=permission.impliedBy ) {
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/slaves/SlaveComputer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.OverrideMustInvoke;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.AbortException;
import hudson.FilePath;
import hudson.Functions;
Expand Down Expand Up @@ -1047,6 +1048,7 @@ private static class SlaveInitializer extends MasterToSlaveCallable<Void,Runtime
}

@Override
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "field is static for the reason explained in the Javadoc for LogHolder")
public Void call() {
SLAVE_LOG_HANDLER = new RingBufferLogHandler(ringBufferSize);

Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/tasks/ArtifactArchiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public BuildStepMonitor getRequiredMonitorService() {

@Extension @Symbol("archiveArtifacts")
public static class DescriptorImpl extends BuildStepDescriptor<Publisher> {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this; // backward compatibility
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/triggers/SCMTrigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ public boolean isActivated() {
public static class BuildAction implements RunAction2 {
private transient /*final*/ Run<?,?> run;
@Deprecated
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "for backward compatibility")
public transient /*final*/ AbstractBuild build;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public Socket createSocket(String host, int port) throws IOException {
*/
@Override
public boolean equals(Object obj) {
return obj != null && obj.getClass().equals(NoClientBindProtocolSocketFactory.class);
return obj != null && obj.getClass().equals(getClass());
}

/**
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/util/ProcessTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ public String call() throws IOException {
/**
* Serialized form of {@link OSProcess} is the PID and {@link ProcessTree}
*/
@SuppressFBWarnings(value = "SE_INNER_CLASS", justification = "Serializing the outer instance is intended")
private final class SerializedProcess implements Serializable {
private final int pid;
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -2177,6 +2178,7 @@ Object writeReplace() {

private static final long serialVersionUID = 1L;

@SuppressFBWarnings(value = "SE_INNER_CLASS", justification = "Serializing the outer instance is intended")
private class RemoteProcess extends OSProcess implements Serializable {
private final IOSProcess proxy;

Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/jenkins/YesNoMaybe.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
package jenkins;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Enum that represents {@link Boolean} state (including null for the absence.)
*
Expand All @@ -36,11 +38,13 @@ public enum YesNoMaybe {
NO,
MAYBE;

@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "bridge method for backward compatibility")
public static Boolean toBoolean(YesNoMaybe v) {
if (v==null) return null;
return v.toBool();
}

@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "bridge method for backward compatibility")
public Boolean toBool() {
switch (this) {
case YES:
Expand Down
16 changes: 13 additions & 3 deletions core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jenkins.model;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Functions;
import hudson.Util;
import hudson.model.Action;
Expand Down Expand Up @@ -255,37 +256,46 @@ class MenuItem {
* Human readable caption of the menu item. Do not use HTML.
*/
@Exported
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public String displayName;

/**
* Optional URL to the icon image. Rendered as 24x24.
*/
@Exported
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public String icon;

/**
* True to make a POST request rather than GET.
* @since 1.504
*/
@Exported public boolean post;
@Exported
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public boolean post;

/**
* True to require confirmation after a click.
* @since 1.512
*/
@Exported public boolean requiresConfirmation;
@Exported
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public boolean requiresConfirmation;


/**
* True to display this item as a section header.
* @since 2.231
*/
@Exported public boolean header;
@Exported
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public boolean header;

/**
* If this is a submenu, definition of subitems.
*/
@Exported(inline=true)
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public ContextMenu subMenu;

public MenuItem(String url, String icon, String displayName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package jenkins.security;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import hudson.model.Job;
Expand Down Expand Up @@ -72,6 +73,7 @@ public boolean isSecurity() {
}

@RequirePOST
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "field is static so that it can be written to by the static QueueListenerImpl class")
public HttpResponse doAct(@QueryParameter String redirect, @QueryParameter String dismiss, @QueryParameter String reset) throws IOException {
if (redirect != null) {
return HttpResponses.redirectTo("https://www.jenkins.io/redirect/queue-item-security");
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/jenkins/security/UserDetailsCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.common.util.concurrent.UncheckedExecutionException;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.security.UserMayOrMayNotExistException2;
Expand Down Expand Up @@ -61,6 +62,7 @@ public final class UserDetailsCache {
* Constructor intended to be instantiated by Jenkins only.
*/
@Restricted(NoExternalUse.class)
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "field is static for script console")
public UserDetailsCache() {
if (EXPIRE_AFTER_WRITE_SEC == null || EXPIRE_AFTER_WRITE_SEC <= 0) {
//just in case someone is trying to trick us
Expand Down
Loading

0 comments on commit 0d128dc

Please sign in to comment.