[java] remove @Nullable from return value for ExpectedConditions that never return null#17149
Conversation
PR Type(Describe updated until commit 8e135bd)Bug fix Description
|
| Relevant files | |||||
|---|---|---|---|---|---|
| Bug fix |
| ||||
| Code cleanup |
|
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:
|
|||||||||||
... and <V> type of Function both nullable and non-nullable. Expression `wait.until(condition)` never returns null. It either returns an Object or true, or throws TimeoutException. While `Function<T, V> isTrue` can return null. Fixes SeleniumHQ#17122 P.S. This is a crazy trick to satisfy Kotlin compiler: ```java <V extends @nullable Object> @nonnull V until(Function<? super F, ? extends V> isTrue); ``` Thanks to `<V extends @nullable Object>`, Kotlin compiler accepts both nullable and non-nullable functions: * `(Function<? super T, V> isTrue)` * `(Function<? super T, @nullable V> isTrue)`
f5e6ad3 to
8e135bd
Compare
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:
|
||||||||||||||
|
changes came from #16489 . |
🔗 Related Issues
Fixes #17122
💥 What does this PR do?
@Nullableannotation from several return value forExpectedConditionsthat never return null<V extends @Nullable Object>).🔧 Implementation Notes
ExpectedConditionscan return null.wait.until(ExpectedConditions.visibilityOf(...))never returns null. It either returns Object or true, or throwsTimeoutException.💡 Additional Considerations
Probably we should create a test suite in Kotlin, so that nullability problems arise earlier.
🔄 Types of changes