Skip to content

Commit daefcd6

Browse files
committed
[java] JSpecify annotations for org.openqa.selenium.federatedcredentialmanagement
1 parent 16049f8 commit daefcd6

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementAccount.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package org.openqa.selenium.federatedcredentialmanagement;
1919

2020
import java.util.Map;
21+
import org.jspecify.annotations.NullMarked;
22+
import org.jspecify.annotations.Nullable;
2123

2224
/**
2325
* Represents an account displayed in a FedCM account list.
@@ -27,29 +29,30 @@
2729
* @see <a href="https://w3c-fedid.github.io/FedCM/#webdriver-accountlist">
2830
* https://w3c-fedid.github.io/FedCM/#webdriver-accountlist</a>
2931
*/
32+
@NullMarked
3033
public class FederatedCredentialManagementAccount {
31-
private final String accountId;
32-
private final String email;
33-
private final String name;
34-
private final String givenName;
35-
private final String pictureUrl;
34+
private final @Nullable String accountId;
35+
private final @Nullable String email;
36+
private final @Nullable String name;
37+
private final @Nullable String givenName;
38+
private final @Nullable String pictureUrl;
3639

3740
/**
3841
* The config URL of the identity provider that provided this account.
3942
*
4043
* <p>This allows identifying the IDP in multi-IDP cases.
4144
*/
42-
private final String idpConfigUrl;
45+
private final @Nullable String idpConfigUrl;
4346

4447
/**
4548
* The login state for this account.
4649
*
4750
* <p>One of LOGIN_STATE_SIGNIN and LOGIN_STATE_SIGNUP.
4851
*/
49-
private final String loginState;
52+
private final @Nullable String loginState;
5053

51-
private final String termsOfServiceUrl;
52-
private final String privacyPolicyUrl;
54+
private final @Nullable String termsOfServiceUrl;
55+
private final @Nullable String privacyPolicyUrl;
5356

5457
public static final String LOGIN_STATE_SIGNIN = "SignIn";
5558
public static final String LOGIN_STATE_SIGNUP = "SignUp";
@@ -66,39 +69,39 @@ public FederatedCredentialManagementAccount(Map<String, String> dict) {
6669
privacyPolicyUrl = (String) dict.getOrDefault("privacyPolicyUrl", null);
6770
}
6871

69-
public String getAccountid() {
72+
public @Nullable String getAccountid() {
7073
return accountId;
7174
}
7275

73-
public String getEmail() {
76+
public @Nullable String getEmail() {
7477
return email;
7578
}
7679

77-
public String getName() {
80+
public @Nullable String getName() {
7881
return name;
7982
}
8083

81-
public String getGivenName() {
84+
public @Nullable String getGivenName() {
8285
return givenName;
8386
}
8487

85-
public String getPictureUrl() {
88+
public @Nullable String getPictureUrl() {
8689
return pictureUrl;
8790
}
8891

89-
public String getIdpConfigUrl() {
92+
public @Nullable String getIdpConfigUrl() {
9093
return idpConfigUrl;
9194
}
9295

93-
public String getLoginState() {
96+
public @Nullable String getLoginState() {
9497
return loginState;
9598
}
9699

97-
public String getTermsOfServiceUrl() {
100+
public @Nullable String getTermsOfServiceUrl() {
98101
return termsOfServiceUrl;
99102
}
100103

101-
public String getPrivacyPolicyUrl() {
104+
public @Nullable String getPrivacyPolicyUrl() {
102105
return privacyPolicyUrl;
103106
}
104107
}

java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818
package org.openqa.selenium.federatedcredentialmanagement;
1919

2020
import java.util.List;
21+
import org.jspecify.annotations.NullMarked;
22+
import org.jspecify.annotations.Nullable;
2123

2224
/**
2325
* Represents an open dialog of the Federated Credential Management API.
2426
*
2527
* @see <a href="https://w3c-fedid.github.io/FedCM/">https://w3c-fedid.github.io/FedCM/</a>
2628
*/
29+
@NullMarked
2730
public interface FederatedCredentialManagementDialog {
2831

2932
String DIALOG_TYPE_ACCOUNT_LIST = "AccountChooser";
@@ -44,13 +47,13 @@ public interface FederatedCredentialManagementDialog {
4447
*
4548
* <p>One of DIALOG_TYPE_ACCOUNT_LIST and DIALOG_TYPE_AUTO_REAUTH.
4649
*/
47-
String getDialogType();
50+
@Nullable String getDialogType();
4851

4952
/** Returns the title of the dialog. */
50-
String getTitle();
53+
@Nullable String getTitle();
5154

5255
/** Returns the subtitle of the dialog or null if none. */
53-
String getSubtitle();
56+
@Nullable String getSubtitle();
5457

5558
void clickDialog();
5659

java/src/org/openqa/selenium/federatedcredentialmanagement/HasFederatedCredentialManagement.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717

1818
package org.openqa.selenium.federatedcredentialmanagement;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.Beta;
2123

2224
/** Used by classes to indicate that they can interact with FedCM dialogs. */
2325
@Beta
26+
@NullMarked
2427
public interface HasFederatedCredentialManagement {
2528
/**
2629
* Disables the promise rejection delay.
@@ -45,5 +48,5 @@ public interface HasFederatedCredentialManagement {
4548
* <p>Can be used with WebDriverWait like: wait.until(driver ->
4649
* ((HasFederatedCredentialManagement) driver). getFederatedCredentialManagementDialog() != null);
4750
*/
48-
FederatedCredentialManagementDialog getFederatedCredentialManagementDialog();
51+
@Nullable FederatedCredentialManagementDialog getFederatedCredentialManagementDialog();
4952
}

0 commit comments

Comments
 (0)