1
0
mirror of synced 2026-05-22 13:23:17 +00:00

Add missing @Nullable to setters of Nullable Fields

There are setters and builder methods that initialize members that are
`@Nullable` but do not accept `@Nullable` parameters.

For example:

```
private @Nullable Object foo;

public void setFoo(Object foo) {
    this.foo = foo;
}
```

It is an unnecessary restriction that the parameter is unable to be null
since the field can be null.

This commit fixes these inconsistencies.

Closes gh-18618
This commit is contained in:
Robert Winch
2026-01-29 13:58:42 -06:00
parent b591a0a757
commit 6a6c7a7a78
10 changed files with 30 additions and 25 deletions
@@ -122,7 +122,7 @@ public final class RequiredFactor {
* @param authority the authority. * @param authority the authority.
* @return the builder. * @return the builder.
*/ */
public Builder authority(String authority) { public Builder authority(@Nullable String authority) {
this.authority = authority; this.authority = authority;
return this; return this;
} }
@@ -205,7 +205,7 @@ public final class RequiredFactor {
* @param validDuration the {@link Duration}. * @param validDuration the {@link Duration}.
* @return * @return
*/ */
public Builder validDuration(Duration validDuration) { public Builder validDuration(@Nullable Duration validDuration) {
this.validDuration = validDuration; this.validDuration = validDuration;
return this; return this;
} }
@@ -155,7 +155,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param authenticatorData the authenticator data. * @param authenticatorData the authenticator data.
* @return the {@link AuthenticatorAssertionResponseBuilder} * @return the {@link AuthenticatorAssertionResponseBuilder}
*/ */
public AuthenticatorAssertionResponseBuilder authenticatorData(Bytes authenticatorData) { public AuthenticatorAssertionResponseBuilder authenticatorData(@Nullable Bytes authenticatorData) {
this.authenticatorData = authenticatorData; this.authenticatorData = authenticatorData;
return this; return this;
} }
@@ -165,7 +165,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param signature the signature * @param signature the signature
* @return the {@link AuthenticatorAssertionResponseBuilder} * @return the {@link AuthenticatorAssertionResponseBuilder}
*/ */
public AuthenticatorAssertionResponseBuilder signature(Bytes signature) { public AuthenticatorAssertionResponseBuilder signature(@Nullable Bytes signature) {
this.signature = signature; this.signature = signature;
return this; return this;
} }
@@ -175,7 +175,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param userHandle the user handle * @param userHandle the user handle
* @return the {@link AuthenticatorAssertionResponseBuilder} * @return the {@link AuthenticatorAssertionResponseBuilder}
*/ */
public AuthenticatorAssertionResponseBuilder userHandle(Bytes userHandle) { public AuthenticatorAssertionResponseBuilder userHandle(@Nullable Bytes userHandle) {
this.userHandle = userHandle; this.userHandle = userHandle;
return this; return this;
} }
@@ -185,7 +185,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param attestationObject the attestation object * @param attestationObject the attestation object
* @return the {@link AuthenticatorAssertionResponseBuilder} * @return the {@link AuthenticatorAssertionResponseBuilder}
*/ */
public AuthenticatorAssertionResponseBuilder attestationObject(Bytes attestationObject) { public AuthenticatorAssertionResponseBuilder attestationObject(@Nullable Bytes attestationObject) {
this.attestationObject = attestationObject; this.attestationObject = attestationObject;
return this; return this;
} }
@@ -195,7 +195,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param clientDataJSON the client data JSON * @param clientDataJSON the client data JSON
* @return the {@link AuthenticatorAssertionResponseBuilder} * @return the {@link AuthenticatorAssertionResponseBuilder}
*/ */
public AuthenticatorAssertionResponseBuilder clientDataJSON(Bytes clientDataJSON) { public AuthenticatorAssertionResponseBuilder clientDataJSON(@Nullable Bytes clientDataJSON) {
this.clientDataJSON = clientDataJSON; this.clientDataJSON = clientDataJSON;
return this; return this;
} }
@@ -120,7 +120,7 @@ public final class AuthenticatorAttestationResponse extends AuthenticatorRespons
* @param transports the transports * @param transports the transports
* @return the {@link AuthenticatorAttestationResponseBuilder} * @return the {@link AuthenticatorAttestationResponseBuilder}
*/ */
public AuthenticatorAttestationResponseBuilder transports(List<AuthenticatorTransport> transports) { public AuthenticatorAttestationResponseBuilder transports(@Nullable List<AuthenticatorTransport> transports) {
this.transports = transports; this.transports = transports;
return this; return this;
} }
@@ -133,7 +133,7 @@ public final class AuthenticatorSelectionCriteria {
* @return the {@link AuthenticatorSelectionCriteriaBuilder} * @return the {@link AuthenticatorSelectionCriteriaBuilder}
*/ */
public AuthenticatorSelectionCriteriaBuilder authenticatorAttachment( public AuthenticatorSelectionCriteriaBuilder authenticatorAttachment(
AuthenticatorAttachment authenticatorAttachment) { @Nullable AuthenticatorAttachment authenticatorAttachment) {
this.authenticatorAttachment = authenticatorAttachment; this.authenticatorAttachment = authenticatorAttachment;
return this; return this;
} }
@@ -143,7 +143,7 @@ public final class AuthenticatorSelectionCriteria {
* @param residentKey the resident key * @param residentKey the resident key
* @return the {@link AuthenticatorSelectionCriteriaBuilder} * @return the {@link AuthenticatorSelectionCriteriaBuilder}
*/ */
public AuthenticatorSelectionCriteriaBuilder residentKey(ResidentKeyRequirement residentKey) { public AuthenticatorSelectionCriteriaBuilder residentKey(@Nullable ResidentKeyRequirement residentKey) {
this.residentKey = residentKey; this.residentKey = residentKey;
return this; return this;
} }
@@ -153,7 +153,8 @@ public final class AuthenticatorSelectionCriteria {
* @param userVerification the user verification requirement * @param userVerification the user verification requirement
* @return the {@link AuthenticatorSelectionCriteriaBuilder} * @return the {@link AuthenticatorSelectionCriteriaBuilder}
*/ */
public AuthenticatorSelectionCriteriaBuilder userVerification(UserVerificationRequirement userVerification) { public AuthenticatorSelectionCriteriaBuilder userVerification(
@Nullable UserVerificationRequirement userVerification) {
this.userVerification = userVerification; this.userVerification = userVerification;
return this; return this;
} }
@@ -179,7 +179,7 @@ public final class ImmutablePublicKeyCredentialUserEntity implements PublicKeyCr
* @param displayName the display name * @param displayName the display name
* @return the {@link PublicKeyCredentialUserEntityBuilder} * @return the {@link PublicKeyCredentialUserEntityBuilder}
*/ */
public PublicKeyCredentialUserEntityBuilder displayName(String displayName) { public PublicKeyCredentialUserEntityBuilder displayName(@Nullable String displayName) {
this.displayName = displayName; this.displayName = displayName;
return this; return this;
} }
@@ -176,7 +176,7 @@ public final class PublicKeyCredential<R extends AuthenticatorResponse> implemen
* @param type the type * @param type the type
* @return the PublicKeyCredentialBuilder * @return the PublicKeyCredentialBuilder
*/ */
public PublicKeyCredentialBuilder type(PublicKeyCredentialType type) { public PublicKeyCredentialBuilder type(@Nullable PublicKeyCredentialType type) {
this.type = type; this.type = type;
return this; return this;
} }
@@ -206,7 +206,8 @@ public final class PublicKeyCredential<R extends AuthenticatorResponse> implemen
* @param authenticatorAttachment the authenticator attachment * @param authenticatorAttachment the authenticator attachment
* @return the PublicKeyCredentialBuilder * @return the PublicKeyCredentialBuilder
*/ */
public PublicKeyCredentialBuilder authenticatorAttachment(AuthenticatorAttachment authenticatorAttachment) { public PublicKeyCredentialBuilder authenticatorAttachment(
@Nullable AuthenticatorAttachment authenticatorAttachment) {
this.authenticatorAttachment = authenticatorAttachment; this.authenticatorAttachment = authenticatorAttachment;
return this; return this;
} }
@@ -217,7 +218,7 @@ public final class PublicKeyCredential<R extends AuthenticatorResponse> implemen
* @return the PublicKeyCredentialBuilder * @return the PublicKeyCredentialBuilder
*/ */
public PublicKeyCredentialBuilder clientExtensionResults( public PublicKeyCredentialBuilder clientExtensionResults(
AuthenticationExtensionsClientOutputs clientExtensionResults) { @Nullable AuthenticationExtensionsClientOutputs clientExtensionResults) {
this.clientExtensionResults = clientExtensionResults; this.clientExtensionResults = clientExtensionResults;
return this; return this;
} }
@@ -265,7 +265,7 @@ public final class PublicKeyCredentialCreationOptions {
* @param timeout the timeout * @param timeout the timeout
* @return the PublicKeyCredentialCreationOptionsBuilder * @return the PublicKeyCredentialCreationOptionsBuilder
*/ */
public PublicKeyCredentialCreationOptionsBuilder timeout(Duration timeout) { public PublicKeyCredentialCreationOptionsBuilder timeout(@Nullable Duration timeout) {
this.timeout = timeout; this.timeout = timeout;
return this; return this;
} }
@@ -297,7 +297,8 @@ public final class PublicKeyCredentialCreationOptions {
* @param attestation the attestation * @param attestation the attestation
* @return the PublicKeyCredentialCreationOptionsBuilder * @return the PublicKeyCredentialCreationOptionsBuilder
*/ */
public PublicKeyCredentialCreationOptionsBuilder attestation(AttestationConveyancePreference attestation) { public PublicKeyCredentialCreationOptionsBuilder attestation(
@Nullable AttestationConveyancePreference attestation) {
this.attestation = attestation; this.attestation = attestation;
return this; return this;
} }
@@ -307,7 +308,8 @@ public final class PublicKeyCredentialCreationOptions {
* @param extensions the extensions * @param extensions the extensions
* @return the PublicKeyCredentialCreationOptionsBuilder * @return the PublicKeyCredentialCreationOptionsBuilder
*/ */
public PublicKeyCredentialCreationOptionsBuilder extensions(AuthenticationExtensionsClientInputs extensions) { public PublicKeyCredentialCreationOptionsBuilder extensions(
@Nullable AuthenticationExtensionsClientInputs extensions) {
this.extensions = extensions; this.extensions = extensions;
return this; return this;
} }
@@ -124,7 +124,7 @@ public final class PublicKeyCredentialDescriptor implements Serializable {
* @param id the id * @param id the id
* @return the {@link PublicKeyCredentialDescriptorBuilder} * @return the {@link PublicKeyCredentialDescriptorBuilder}
*/ */
public PublicKeyCredentialDescriptorBuilder id(Bytes id) { public PublicKeyCredentialDescriptorBuilder id(@Nullable Bytes id) {
this.id = id; this.id = id;
return this; return this;
} }
@@ -134,7 +134,7 @@ public final class PublicKeyCredentialDescriptor implements Serializable {
* @param transports the transports * @param transports the transports
* @return the {@link PublicKeyCredentialDescriptorBuilder} * @return the {@link PublicKeyCredentialDescriptorBuilder}
*/ */
public PublicKeyCredentialDescriptorBuilder transports(Set<AuthenticatorTransport> transports) { public PublicKeyCredentialDescriptorBuilder transports(@Nullable Set<AuthenticatorTransport> transports) {
this.transports = transports; this.transports = transports;
return this; return this;
} }
@@ -169,7 +169,7 @@ public final class PublicKeyCredentialRequestOptions implements Serializable {
* @param challenge the challenge * @param challenge the challenge
* @return the {@link PublicKeyCredentialRequestOptionsBuilder} * @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/ */
public PublicKeyCredentialRequestOptionsBuilder challenge(Bytes challenge) { public PublicKeyCredentialRequestOptionsBuilder challenge(@Nullable Bytes challenge) {
this.challenge = challenge; this.challenge = challenge;
return this; return this;
} }
@@ -190,7 +190,7 @@ public final class PublicKeyCredentialRequestOptions implements Serializable {
* @param rpId the rpId property * @param rpId the rpId property
* @return the {@link PublicKeyCredentialRequestOptionsBuilder} * @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/ */
public PublicKeyCredentialRequestOptionsBuilder rpId(String rpId) { public PublicKeyCredentialRequestOptionsBuilder rpId(@Nullable String rpId) {
this.rpId = rpId; this.rpId = rpId;
return this; return this;
} }
@@ -212,7 +212,8 @@ public final class PublicKeyCredentialRequestOptions implements Serializable {
* @param userVerification the user verification * @param userVerification the user verification
* @return the {@link PublicKeyCredentialRequestOptionsBuilder} * @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/ */
public PublicKeyCredentialRequestOptionsBuilder userVerification(UserVerificationRequirement userVerification) { public PublicKeyCredentialRequestOptionsBuilder userVerification(
@Nullable UserVerificationRequirement userVerification) {
this.userVerification = userVerification; this.userVerification = userVerification;
return this; return this;
} }
@@ -91,7 +91,7 @@ public final class PublicKeyCredentialRpEntity {
* @param name the name property * @param name the name property
* @return the {@link PublicKeyCredentialRpEntityBuilder} * @return the {@link PublicKeyCredentialRpEntityBuilder}
*/ */
public PublicKeyCredentialRpEntityBuilder name(String name) { public PublicKeyCredentialRpEntityBuilder name(@Nullable String name) {
this.name = name; this.name = name;
return this; return this;
} }
@@ -101,7 +101,7 @@ public final class PublicKeyCredentialRpEntity {
* @param id the id * @param id the id
* @return the {@link PublicKeyCredentialRpEntityBuilder} * @return the {@link PublicKeyCredentialRpEntityBuilder}
*/ */
public PublicKeyCredentialRpEntityBuilder id(String id) { public PublicKeyCredentialRpEntityBuilder id(@Nullable String id) {
this.id = id; this.id = id;
return this; return this;
} }