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
No known key found for this signature in database
10 changed files with 30 additions and 25 deletions

View File

@ -122,7 +122,7 @@ public final class RequiredFactor {
* @param authority the authority.
* @return the builder.
*/
public Builder authority(String authority) {
public Builder authority(@Nullable String authority) {
this.authority = authority;
return this;
}
@ -205,7 +205,7 @@ public final class RequiredFactor {
* @param validDuration the {@link Duration}.
* @return
*/
public Builder validDuration(Duration validDuration) {
public Builder validDuration(@Nullable Duration validDuration) {
this.validDuration = validDuration;
return this;
}

View File

@ -155,7 +155,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param authenticatorData the authenticator data.
* @return the {@link AuthenticatorAssertionResponseBuilder}
*/
public AuthenticatorAssertionResponseBuilder authenticatorData(Bytes authenticatorData) {
public AuthenticatorAssertionResponseBuilder authenticatorData(@Nullable Bytes authenticatorData) {
this.authenticatorData = authenticatorData;
return this;
}
@ -165,7 +165,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param signature the signature
* @return the {@link AuthenticatorAssertionResponseBuilder}
*/
public AuthenticatorAssertionResponseBuilder signature(Bytes signature) {
public AuthenticatorAssertionResponseBuilder signature(@Nullable Bytes signature) {
this.signature = signature;
return this;
}
@ -175,7 +175,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param userHandle the user handle
* @return the {@link AuthenticatorAssertionResponseBuilder}
*/
public AuthenticatorAssertionResponseBuilder userHandle(Bytes userHandle) {
public AuthenticatorAssertionResponseBuilder userHandle(@Nullable Bytes userHandle) {
this.userHandle = userHandle;
return this;
}
@ -185,7 +185,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param attestationObject the attestation object
* @return the {@link AuthenticatorAssertionResponseBuilder}
*/
public AuthenticatorAssertionResponseBuilder attestationObject(Bytes attestationObject) {
public AuthenticatorAssertionResponseBuilder attestationObject(@Nullable Bytes attestationObject) {
this.attestationObject = attestationObject;
return this;
}
@ -195,7 +195,7 @@ public final class AuthenticatorAssertionResponse extends AuthenticatorResponse
* @param clientDataJSON the client data JSON
* @return the {@link AuthenticatorAssertionResponseBuilder}
*/
public AuthenticatorAssertionResponseBuilder clientDataJSON(Bytes clientDataJSON) {
public AuthenticatorAssertionResponseBuilder clientDataJSON(@Nullable Bytes clientDataJSON) {
this.clientDataJSON = clientDataJSON;
return this;
}

View File

@ -120,7 +120,7 @@ public final class AuthenticatorAttestationResponse extends AuthenticatorRespons
* @param transports the transports
* @return the {@link AuthenticatorAttestationResponseBuilder}
*/
public AuthenticatorAttestationResponseBuilder transports(List<AuthenticatorTransport> transports) {
public AuthenticatorAttestationResponseBuilder transports(@Nullable List<AuthenticatorTransport> transports) {
this.transports = transports;
return this;
}

View File

@ -133,7 +133,7 @@ public final class AuthenticatorSelectionCriteria {
* @return the {@link AuthenticatorSelectionCriteriaBuilder}
*/
public AuthenticatorSelectionCriteriaBuilder authenticatorAttachment(
AuthenticatorAttachment authenticatorAttachment) {
@Nullable AuthenticatorAttachment authenticatorAttachment) {
this.authenticatorAttachment = authenticatorAttachment;
return this;
}
@ -143,7 +143,7 @@ public final class AuthenticatorSelectionCriteria {
* @param residentKey the resident key
* @return the {@link AuthenticatorSelectionCriteriaBuilder}
*/
public AuthenticatorSelectionCriteriaBuilder residentKey(ResidentKeyRequirement residentKey) {
public AuthenticatorSelectionCriteriaBuilder residentKey(@Nullable ResidentKeyRequirement residentKey) {
this.residentKey = residentKey;
return this;
}
@ -153,7 +153,8 @@ public final class AuthenticatorSelectionCriteria {
* @param userVerification the user verification requirement
* @return the {@link AuthenticatorSelectionCriteriaBuilder}
*/
public AuthenticatorSelectionCriteriaBuilder userVerification(UserVerificationRequirement userVerification) {
public AuthenticatorSelectionCriteriaBuilder userVerification(
@Nullable UserVerificationRequirement userVerification) {
this.userVerification = userVerification;
return this;
}

View File

@ -179,7 +179,7 @@ public final class ImmutablePublicKeyCredentialUserEntity implements PublicKeyCr
* @param displayName the display name
* @return the {@link PublicKeyCredentialUserEntityBuilder}
*/
public PublicKeyCredentialUserEntityBuilder displayName(String displayName) {
public PublicKeyCredentialUserEntityBuilder displayName(@Nullable String displayName) {
this.displayName = displayName;
return this;
}

View File

@ -176,7 +176,7 @@ public final class PublicKeyCredential<R extends AuthenticatorResponse> implemen
* @param type the type
* @return the PublicKeyCredentialBuilder
*/
public PublicKeyCredentialBuilder type(PublicKeyCredentialType type) {
public PublicKeyCredentialBuilder type(@Nullable PublicKeyCredentialType type) {
this.type = type;
return this;
}
@ -206,7 +206,8 @@ public final class PublicKeyCredential<R extends AuthenticatorResponse> implemen
* @param authenticatorAttachment the authenticator attachment
* @return the PublicKeyCredentialBuilder
*/
public PublicKeyCredentialBuilder authenticatorAttachment(AuthenticatorAttachment authenticatorAttachment) {
public PublicKeyCredentialBuilder authenticatorAttachment(
@Nullable AuthenticatorAttachment authenticatorAttachment) {
this.authenticatorAttachment = authenticatorAttachment;
return this;
}
@ -217,7 +218,7 @@ public final class PublicKeyCredential<R extends AuthenticatorResponse> implemen
* @return the PublicKeyCredentialBuilder
*/
public PublicKeyCredentialBuilder clientExtensionResults(
AuthenticationExtensionsClientOutputs clientExtensionResults) {
@Nullable AuthenticationExtensionsClientOutputs clientExtensionResults) {
this.clientExtensionResults = clientExtensionResults;
return this;
}

View File

@ -265,7 +265,7 @@ public final class PublicKeyCredentialCreationOptions {
* @param timeout the timeout
* @return the PublicKeyCredentialCreationOptionsBuilder
*/
public PublicKeyCredentialCreationOptionsBuilder timeout(Duration timeout) {
public PublicKeyCredentialCreationOptionsBuilder timeout(@Nullable Duration timeout) {
this.timeout = timeout;
return this;
}
@ -297,7 +297,8 @@ public final class PublicKeyCredentialCreationOptions {
* @param attestation the attestation
* @return the PublicKeyCredentialCreationOptionsBuilder
*/
public PublicKeyCredentialCreationOptionsBuilder attestation(AttestationConveyancePreference attestation) {
public PublicKeyCredentialCreationOptionsBuilder attestation(
@Nullable AttestationConveyancePreference attestation) {
this.attestation = attestation;
return this;
}
@ -307,7 +308,8 @@ public final class PublicKeyCredentialCreationOptions {
* @param extensions the extensions
* @return the PublicKeyCredentialCreationOptionsBuilder
*/
public PublicKeyCredentialCreationOptionsBuilder extensions(AuthenticationExtensionsClientInputs extensions) {
public PublicKeyCredentialCreationOptionsBuilder extensions(
@Nullable AuthenticationExtensionsClientInputs extensions) {
this.extensions = extensions;
return this;
}

View File

@ -124,7 +124,7 @@ public final class PublicKeyCredentialDescriptor implements Serializable {
* @param id the id
* @return the {@link PublicKeyCredentialDescriptorBuilder}
*/
public PublicKeyCredentialDescriptorBuilder id(Bytes id) {
public PublicKeyCredentialDescriptorBuilder id(@Nullable Bytes id) {
this.id = id;
return this;
}
@ -134,7 +134,7 @@ public final class PublicKeyCredentialDescriptor implements Serializable {
* @param transports the transports
* @return the {@link PublicKeyCredentialDescriptorBuilder}
*/
public PublicKeyCredentialDescriptorBuilder transports(Set<AuthenticatorTransport> transports) {
public PublicKeyCredentialDescriptorBuilder transports(@Nullable Set<AuthenticatorTransport> transports) {
this.transports = transports;
return this;
}

View File

@ -169,7 +169,7 @@ public final class PublicKeyCredentialRequestOptions implements Serializable {
* @param challenge the challenge
* @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/
public PublicKeyCredentialRequestOptionsBuilder challenge(Bytes challenge) {
public PublicKeyCredentialRequestOptionsBuilder challenge(@Nullable Bytes challenge) {
this.challenge = challenge;
return this;
}
@ -190,7 +190,7 @@ public final class PublicKeyCredentialRequestOptions implements Serializable {
* @param rpId the rpId property
* @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/
public PublicKeyCredentialRequestOptionsBuilder rpId(String rpId) {
public PublicKeyCredentialRequestOptionsBuilder rpId(@Nullable String rpId) {
this.rpId = rpId;
return this;
}
@ -212,7 +212,8 @@ public final class PublicKeyCredentialRequestOptions implements Serializable {
* @param userVerification the user verification
* @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/
public PublicKeyCredentialRequestOptionsBuilder userVerification(UserVerificationRequirement userVerification) {
public PublicKeyCredentialRequestOptionsBuilder userVerification(
@Nullable UserVerificationRequirement userVerification) {
this.userVerification = userVerification;
return this;
}

View File

@ -91,7 +91,7 @@ public final class PublicKeyCredentialRpEntity {
* @param name the name property
* @return the {@link PublicKeyCredentialRpEntityBuilder}
*/
public PublicKeyCredentialRpEntityBuilder name(String name) {
public PublicKeyCredentialRpEntityBuilder name(@Nullable String name) {
this.name = name;
return this;
}
@ -101,7 +101,7 @@ public final class PublicKeyCredentialRpEntity {
* @param id the id
* @return the {@link PublicKeyCredentialRpEntityBuilder}
*/
public PublicKeyCredentialRpEntityBuilder id(String id) {
public PublicKeyCredentialRpEntityBuilder id(@Nullable String id) {
this.id = id;
return this;
}