Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
@CheckForNull
annotations to override `@ParametersAreNo… (#1053)
Previously if someone had put ParametersAreNonnullByDefault on a class / method / package-info there was no way to override and say this field should be nullable.
- Loading branch information
Showing
4 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
.../impl/configurators/nonnull/nonnullparampackage/PackageParametersNonNullCheckForNull.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.jenkins.plugins.casc.impl.configurators.nonnull.nonnullparampackage; | ||
|
||
import hudson.util.Secret; | ||
import javax.annotation.CheckForNull; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* Checks the behaviour of {@link io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator} with non null | ||
* {@link Secret} when using package-level {@link javax.annotation.ParametersAreNonnullByDefault} annotations. | ||
*/ | ||
public class PackageParametersNonNullCheckForNull { | ||
private Secret secret; | ||
|
||
@DataBoundConstructor | ||
public PackageParametersNonNullCheckForNull(@CheckForNull Secret secret) { | ||
this.secret = secret; | ||
} | ||
|
||
public Secret getSecret() { | ||
return secret; | ||
} | ||
} |