[java] Add @Nullable annotations to InternetExplorerDriverService parameters #16001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
🔗 Related Issues
fixes #14291
💥 What does this PR do?
🔧 Implementation Notes
This pull request introduces nullable annotations (
@Nullable) to theInternetExplorerDriverServiceclass and its nestedBuilderclass in order to improve type safety and clarify the handling of potentially null values. These changes ensure better compatibility with tools that analyze nullability and enhance code robustness.Enhancements to nullability:
@Nullableannotations to constructor parameters: Updated the constructor ofInternetExplorerDriverServiceto markFile,Duration,List<String>, andMap<String, String>parameters as nullable, reflecting their potential to hold null values. ([java/src/org/openqa/selenium/ie/InternetExplorerDriverService.javaL81-R86](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677L81-R86))Builderclass: Marked thelogLevel,host,extractPath, andsilentfields as nullable in theBuilderclass to align with their optional nature. ([java/src/org/openqa/selenium/ie/InternetExplorerDriverService.javaL131-R135](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677L131-R135))withLogLevel,withHost,withExtractPath, andwithSilentin theBuilderclass to accept nullable parameters, ensuring flexibility in their usage. ([[1]](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677L157-R158),[[2]](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677L168-R169),[[3]](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677L179-R180),[[4]](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677L190-R191))createDriverServicemethod: Added@Nullableannotations to parameters of thecreateDriverServicemethod to account for cases where null values might be passed. ([java/src/org/openqa/selenium/ie/InternetExplorerDriverService.javaL247-R252](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677L247-R252))General improvements:
@Nullableannotation: Added theorg.jspecify.annotations.Nullableimport to enable the use of nullable annotations throughout the class. ([java/src/org/openqa/selenium/ie/InternetExplorerDriverService.javaR33](https://github.com/SeleniumHQ/selenium/pull/16001/files#diff-617a4c6d0ef39b1c4febbc83065a223bcd42281a33498df32b5e3cef6cb71677R33))💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Add
@Nullableannotations to InternetExplorerDriverService constructor parametersMark Builder class fields as nullable for type safety
Update method parameters with nullable annotations
Import JSpecify annotations for better null handling
Changes diagram
Changes walkthrough 📝
InternetExplorerDriverService.java
Add nullable annotations for type safetyjava/src/org/openqa/selenium/ie/InternetExplorerDriverService.java
@Nullableannotation@Nullableto constructor parameters (executable, timeout, args,environment)
silent)
@Nullableannotations