[java] JSpecify annotations for wrappers
User description
Description
In this PR I'm adding nullness annotations for interfaces:
-
WrapsDriver -
WrapsElement
None of the methods in these wrappers can return a null value
Motivation and Context
The JSpecify nullness annotations will give developers better exposure to potential problems with their code to avoid NullPointerExceptions. Related issue: https://github.com/SeleniumHQ/selenium/issues/14291
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [x] I have read the contributing document.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
PR Type
enhancement, documentation
Description
- Added JSpecify
@NullMarkedannotations to theWrapsDriverandWrapsElementinterfaces. - These annotations help developers identify potential nullability issues, enhancing code safety and preventing NullPointerExceptions.
Changes walkthrough 📝
| Relevant files | |||||
|---|---|---|---|---|---|
| Enhancement |
|
💡 PR-Agent usage: Comment
/helpon the PR to get a list of all available PR-Agent tools and their descriptions
PR Reviewer Guide 🔍
| ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪ |
| 🧪 No relevant tests |
| 🔒 No security concerns identified |
| ⚡ No key issues to review |
PR Code Suggestions ✨
| Category | Suggestion | Score |
| Maintainability |
Add a brief explanation for the NullMarked annotation in the JavaDocConsider adding a brief JavaDoc comment to explain the purpose of the java/src/org/openqa/selenium/WrapsDriver.java [20-26]
Suggestion importance[1-10]: 8Why: Providing a JavaDoc comment explaining the | 8 |
Add a JavaDoc comment to the interface method explaining its purpose and return valueConsider adding a brief JavaDoc comment to the java/src/org/openqa/selenium/WrapsElement.java [23-27]
Suggestion importance[1-10]: 8Why: Adding a JavaDoc comment enhances maintainability by clearly documenting the method's purpose and expected behavior, which is valuable for developers interacting with this interface. | 8 | |
| Enhancement |
Add a nullable annotation to the return type of the interface methodConsider adding a java/src/org/openqa/selenium/WrapsDriver.java [26-30]
Suggestion importance[1-10]: 7Why: Adding a | 7 |
Add a non-null annotation to the return type of the interface methodConsider adding a java/src/org/openqa/selenium/WrapsElement.java [23-27]
Suggestion importance[1-10]: 7Why: Adding a | 7 |