Skip to content

Commit dd85cbb

Browse files
mk868diemol
authored andcommitted
[java] Add nullness for virtualauthenticator (SeleniumHQ#15082)
Co-authored-by: Diego Molina <[email protected]>
1 parent 1e7c07f commit dd85cbb

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

java/src/org/openqa/selenium/virtualauthenticator/Credential.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.util.Collections;
2424
import java.util.HashMap;
2525
import java.util.Map;
26+
import org.jspecify.annotations.NullMarked;
27+
import org.jspecify.annotations.Nullable;
2628
import org.openqa.selenium.internal.Require;
2729

2830
/**
@@ -31,13 +33,14 @@
3133
* @see <a
3234
* href="https://w3c.github.io/webauthn/#credential-parameters">https://w3c.github.io/webauthn/#credential-parameters</a>
3335
*/
36+
@NullMarked
3437
public class Credential {
3538

3639
private final byte[] id;
3740
private final boolean isResidentCredential;
3841
private final String rpId;
3942
private final PKCS8EncodedKeySpec privateKey;
40-
private final byte[] userHandle;
43+
private final byte @Nullable [] userHandle;
4144
private final int signCount;
4245

4346
/** Creates a non resident (i.e. stateless) credential. */
@@ -75,7 +78,7 @@ private Credential(
7578
boolean isResidentCredential,
7679
String rpId,
7780
PKCS8EncodedKeySpec privateKey,
78-
byte[] userHandle,
81+
byte @Nullable [] userHandle,
7982
int signCount) {
8083
this.id = Require.nonNull("Id", id);
8184
this.isResidentCredential = isResidentCredential;
@@ -101,7 +104,7 @@ public PKCS8EncodedKeySpec getPrivateKey() {
101104
return privateKey;
102105
}
103106

104-
public byte[] getUserHandle() {
107+
public byte @Nullable [] getUserHandle() {
105108
return userHandle == null ? null : Arrays.copyOf(userHandle, userHandle.length);
106109
}
107110

java/src/org/openqa/selenium/virtualauthenticator/HasVirtualAuthenticator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
package org.openqa.selenium.virtualauthenticator;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
2022
/** Interface implemented by each driver that allows access to the virtual authenticator API. */
23+
@NullMarked
2124
public interface HasVirtualAuthenticator {
2225
/**
2326
* Adds a virtual authenticator with the given options.

java/src/org/openqa/selenium/virtualauthenticator/VirtualAuthenticator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
package org.openqa.selenium.virtualauthenticator;
1919

2020
import java.util.List;
21+
import org.jspecify.annotations.NullMarked;
2122

2223
/** Represents a virtual authenticator. */
24+
@NullMarked
2325
public interface VirtualAuthenticator {
2426

2527
/**

java/src/org/openqa/selenium/virtualauthenticator/VirtualAuthenticatorOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
import java.util.Collections;
2121
import java.util.HashMap;
2222
import java.util.Map;
23+
import org.jspecify.annotations.NullMarked;
2324

2425
/**
2526
* Options for the creation of virtual authenticators.
2627
*
2728
* @see <a
2829
* href="https://w3c.github.io/webauthn/#sctn-automation">https://w3c.github.io/webauthn/#sctn-automation</a>
2930
*/
31+
@NullMarked
3032
public class VirtualAuthenticatorOptions {
3133

3234
public enum Protocol {

0 commit comments

Comments
 (0)