-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] JSpecify annotations for By locators #14372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
cd8a687 to
dfcc439
Compare
dfcc439 to
10a7219
Compare
|
/help |
PR Agent Walkthrough 🤖Welcome to the PR Agent, an AI-powered tool for automated pull request analysis, feedback, suggestions and more. Here is a list of tools you can use to interact with the PR Agent:
(1) Note that each tool be triggered automatically when a new PR is opened, or called manually by commenting on a PR. (2) Tools marked with [*] require additional parameters to be passed. For example, to invoke the |
|
/describe |
|
PR Description updated to latest commit (10a7219)
|
|
Is there a way to check in the CI that the annotations are correct? |
|
Yes, adding a null checker plugin to the CI building is a natural follow-up for nullness annotations. |
|
Could we add a check in the CI to verify the annotations are correct before merging more PRs? |
|
Sure! I'll play with it and share the results, I think I'll have something to show and merge next week |
|
@mk868, will you add unit test for this? |
|
@VietND96 the plan is to test nullness annotations using the NullAway.
|
|
@mk868, the dependent PR is merged, you can go ahead with others |
|
@diemol, do you think this is good to merge? |
User description
Description
In this PR I'm adding nullness annotations for classes
ByByIdOrNameByAllByChainedCommon
boolean equals(Object o)- accepts null -> an argument marked with@NullableMap<String, Object> toJson()- the value in map can be null (basis on theBy.Remotable.Parameters#toJson()-> value type marked with@NullableByRemotable.Parameterscan contain null value - based on the comment "There may be subclasses where the value is optional. Allow for this." in theParametersconstructor -> value field marked with@NullableByIdOrNameNo null values
ByAllNo null values
ByChainedNo null values
Motivation and Context
The JSpecify nullness annotations will give developers better exposure to potential problems with their code to avoid NullPointerExceptions.
Related issue: #14291
Types of changes
Checklist
PR Type
Enhancement
Description
@NullMarkedand@Nullable) toBy,ByIdOrName,ByAll, andByChainedclasses to improve null safety.toJsonmethods to handle nullable values.org.jspecify:jspecifydependency to the Bazel build file.Changes walkthrough 📝
By.java
Add JSpecify nullness annotations to `By` classjava/src/org/openqa/selenium/By.java
@NullMarkedannotation to theByclass.Objectparameters and return types with@Nullablewhereapplicable.
toJsonmethod to handle nullable values.ByIdOrName.java
Add JSpecify nullness annotations to `ByIdOrName` classjava/src/org/openqa/selenium/support/ByIdOrName.java
@NullMarkedannotation to theByIdOrNameclass.ByAll.java
Add JSpecify nullness annotations to `ByAll` classjava/src/org/openqa/selenium/support/pagefactory/ByAll.java
@NullMarkedannotation to theByAllclass.ByChained.java
Add JSpecify nullness annotations to `ByChained` classjava/src/org/openqa/selenium/support/pagefactory/ByChained.java
@NullMarkedannotation to theByChainedclass.BUILD.bazel
Add JSpecify dependency to Bazel build filejava/src/org/openqa/selenium/support/BUILD.bazel
org.jspecify:jspecifyartifact dependency.