[java] added jspecify annotations Nullable and NullMarked to exception classes#16024
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
pujagani
left a comment
There was a problem hiding this comment.
Thank you! @iampopovich
|
@pujagani check please🙏 |
There was a problem hiding this comment.
Pull request overview
This PR adds jspecify null safety annotations to 7 exception classes in the Selenium Java package, continuing a larger effort to improve type safety across all exception classes. The changes apply the @NullMarked annotation at the class level and @Nullable annotations to constructor parameters that accept nullable String messages and Throwable causes, matching the pattern already established in the parent WebDriverException class.
Key Changes:
- Applied
@NullMarkedclass-level annotation to 6 exception classes - Added
@Nullableannotations to constructor parameters accepting nullable messages and causes - Added appropriate jspecify import statements
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| DetachedShadowRootException.java | Added @NullMarked class annotation and @Nullable to String/Throwable constructor parameters |
| ElementClickInterceptedException.java | Added @NullMarked class annotation and @Nullable to String/Throwable constructor parameters |
| HealthCheckFailedException.java | Added @Nullable to constructor parameters (missing @NullMarked annotation) |
| InsecureCertificateException.java | Added @NullMarked class annotation and @Nullable to String/Throwable constructor parameters |
| InvalidArgumentException.java | Added @NullMarked class annotation and @Nullable to String/Throwable constructor parameters |
| InvalidElementStateException.java | Added @NullMarked class annotation and @Nullable to String/Throwable constructor parameters |
| UnsupportedCommandException.java | Added @NullMarked class annotation and @Nullable to String/Throwable constructor parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
User description
🔗 Related Issues
partially fixes #14291
💥 What does this PR do?
This pull request adds annotations to classes that extend WebDriverException.
To make the changes easier to review, I have split the task of annotating all exception classes into several smaller pull requests. This PR contains updates for 5-7 classes.
🔧 Implementation Notes
This pull request introduces updates to exception classes in the Selenium Java package to improve null safety by integrating
jspecifyannotations. The changes include marking classes with@NullMarkedand updating method parameters to use@Nullablewhere applicable.💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Add
@NullMarkedannotations to 7 exception classesAdd
@Nullableannotations to constructor parametersImprove null safety with jspecify annotations
Part of larger effort to annotate all exception classes
Changes diagram
Changes walkthrough 📝
7 files
Add null safety annotationsAdd null safety annotationsAdd nullable parameter annotationsAdd null safety annotationsAdd null safety annotationsAdd null safety annotationsAdd null safety annotations