Skip to content

Conversation

@iampopovich
Copy link
Contributor

@iampopovich iampopovich commented Jul 8, 2025

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 jspecify annotations. The changes include marking classes with @NullMarked and updating method parameters to use @Nullable where applicable.

💡 Additional Considerations

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Enhancement


Description

  • Add @NullMarked annotations to 7 exception classes

  • Add @Nullable annotations to constructor parameters

  • Improve null safety with jspecify annotations

  • Part of larger effort to annotate all exception classes


Changes diagram

flowchart LR
  A["Exception Classes"] --> B["Add @NullMarked"]
  A --> C["Add @Nullable to parameters"]
  B --> D["Improved null safety"]
  C --> D
Loading

Changes walkthrough 📝

Relevant files
Enhancement
7 files
DetachedShadowRootException.java
Add null safety annotations                                                           
+6/-2     
ElementClickInterceptedException.java
Add null safety annotations                                                           
+6/-2     
HealthCheckFailedException.java
Add nullable parameter annotations                                             
+3/-1     
InsecureCertificateException.java
Add null safety annotations                                                           
+7/-3     
InvalidArgumentException.java
Add null safety annotations                                                           
+6/-2     
InvalidElementStateException.java
Add null safety annotations                                                           
+7/-3     
UnsupportedCommandException.java
Add null safety annotations                                                           
+7/-3     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @qodo-merge-pro
    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 8, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Missing Annotation

    This class is missing the @NullMarked annotation that is present in all other exception classes in this PR, which creates inconsistency in the null safety approach.

    public class HealthCheckFailedException extends WebDriverException {

    @qodo-merge-pro
    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 8, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Add missing NullMarked annotation

    Add the @NullMarked annotation to the class to maintain consistency with other
    exception classes in this PR. This ensures uniform null safety annotation
    coverage across all exception classes.

    java/src/org/openqa/selenium/HealthCheckFailedException.java [20-23]

    +import org.jspecify.annotations.NullMarked;
     import org.jspecify.annotations.Nullable;
     
     /** Indicates that a Node health check failed. */
    +@NullMarked
     public class HealthCheckFailedException extends WebDriverException {
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion correctly identifies that the @NullMarked annotation is missing on the HealthCheckFailedException class, which is inconsistent with all other exception classes modified in this PR.

    Medium
    • Update

    Copy link
    Contributor

    @pujagani pujagani left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Thank you! @iampopovich

    @iampopovich
    Copy link
    Contributor Author

    @pujagani check please🙏

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    [🚀 Feature]: JSpecify Nullness annotations for Java

    3 participants