-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] several packages marks jspecify nullmarked #16802
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
[java] several packages marks jspecify nullmarked #16802
Conversation
…og level handling
…ckage-info.java for devtools
… package-info.java for nullability specification
…tting in ConverterFunctions.java
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds package-level @NullMarked annotations to three Selenium Java packages (org.openqa.selenium, org.openqa.selenium.devtools, and org.openqa.selenium.chromium) and adds explicit @Nullable annotations to methods and parameters that can return or accept null values. The change moves nullability semantics from individual class-level annotations to package-level annotations, while classes that previously had @NullMarked annotations now inherit this behavior from their package. Additionally, it adds explicit @Nullable markers where nullability needs to be explicitly declared.
- Added package-level
@NullMarkedannotations via newpackage-info.javafiles for three packages - Added
@Nullableannotations to methods/parameters in devtools and chromium packages that can handle null values - Removed individual
@NullMarkedannotations from 20+ classes/interfaces since they now inherit from package-level annotations - Updated build dependencies to include jspecify for compilation
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| java/src/org/openqa/selenium/package-info.java | Adds package-level @NullMarked annotation for the selenium core package |
| java/src/org/openqa/selenium/devtools/package-info.java | Adds package-level @NullMarked annotation for the devtools package |
| java/src/org/openqa/selenium/chromium/package-info.java | Adds package-level @NullMarked annotation for the chromium package |
| java/src/org/openqa/selenium/devtools/ConverterFunctions.java | Adds @Nullable annotations to return types and parameters that can be null |
| java/src/org/openqa/selenium/devtools/CdpClientGenerator.java | Adds @Nullable annotation to method that returns null |
| java/src/org/openqa/selenium/chromium/ChromiumOptions.java | Adds @Nullable annotation to method that can return null |
| java/src/org/openqa/selenium/chromium/ChromiumDriverLogLevel.java | Adds @Nullable annotation to method that can return null |
| java/src/org/openqa/selenium/devtools/BUILD.bazel | Adds jspecify dependency for devtools build |
| java/src/dev/selenium/tools/javadoc/BUILD.bazel | Adds selenium core dependency for javadoc build |
| Various core selenium classes | Removes redundant @NullMarked annotations now inherited from package-level |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…m, devtools, and selenium packages after review
…chromium, devtools, and selenium packages after review" This reverts commit 52ad8fe.
|
@asolntsev any suggestions here ? |
asolntsev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
User description
🔗 Related Issues
relates to #14291
💥 What does this PR do?
This pull request primarily removes the use of the
@NullMarkedannotation from several classes and interfaces in the Selenium Java codebase. The@NullMarkedannotation, which is part of the jspecify library, was previously used to indicate that all types in the annotated scope are non-null by default unless otherwise specified. Its removal simplifies the code and may reflect a change in how nullability is handled or annotated in the project. Additionally, there is a minor build dependency update.Key changes:
Nullability annotation removal:
@NullMarkedannotation and related import statements from key classes and interfaces, including but not limited to:By,Capabilities,Cookie,Dimension,HasCapabilities,ImmutableCapabilities,InvalidCookieDomainException,JavascriptExecutor,Keys,MutableCapabilities,NoSuchElementException,NotFoundException,OutputType,PageLoadStrategy,PersistentCapabilities,Platform,Point,Proxy, andRectangle. This change affects both the class/interface declarations and the import sections. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24]Build configuration:
//java/src/org/openqa/selenium:coreto thejava_binarytarget injava/src/dev/selenium/tools/javadoc/BUILD.bazel.🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Remove
@NullMarkedannotations from 30+ classes and interfacesAdd package-level
@NullMarkedannotations viapackage-info.javafilesAdd explicit
@Nullableannotations to specific method return typesUpdate build dependencies to include jspecify artifact
Diagram Walkthrough
File Walkthrough
33 files
Remove @NullMarked annotation from By classRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from Cookie classRemove @NullMarked annotation from Dimension classRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from classRemove @NullMarked annotation from exceptionRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from enumRemove @NullMarked annotation from classRemove @NullMarked annotation from exceptionRemove @NullMarked annotation from exceptionRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from enumRemove @NullMarked annotation from classRemove @NullMarked annotation from enumRemove @NullMarked annotation from classRemove @NullMarked annotation from classRemove @NullMarked annotation from classRemove @NullMarked annotation from classRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from exceptionRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from exceptionRemove @NullMarked annotation from enumRemove @NullMarked annotation from classRemove @NullMarked annotation from classRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from classRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from enumRemove @NullMarked annotation from interfaceRemove @NullMarked annotation from interface7 files
Add @Nullable to fromString method return typeAdd @Nullable to getExtraCapability method returnCreate package-info with @NullMarked annotationAdd @Nullable to toTypeDeclaration method returnAdd @Nullable annotations to map and empty methodsCreate package-info with @NullMarked annotationCreate package-info with @NullMarked annotation1 files
Add core dependency to javadoc binary1 files
Add jspecify artifact dependency to generator