-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change SearchContext
so that findElements
can return a list that sub-classes WebElement
#604
Conversation
…turn a list of any class to sub-classes WebElement (e.g. MobileElement).
…turn a list of any class to sub-classes WebElement (e.g. MobileElement).
…turn a list of any class to sub-classes WebElement (e.g. MobileElement). This make SearchContext generic on <E extends WebElement>. To prevent "yellow" markers in IntelliJ, subclasses needed to be updated as well. This is API compatible for all subclasses, but more flexible for implementations of WebElement and WebDriver when we might want to return decorated versions of a WebElement.
Hi @alexec I think that your change is not sufficient because there are interfaces like FindsById, FindsByClassName and so on. I think they should be generic too... |
First of all, there is the That said, please don't make |
@lqc I agree. |
…indElements(By by);
@TikhomirovSergey @lqc thank you for taking a look at this. I'm not actually using Appium for the work I'm doing, it's for another project that wraps Naturally, I want to make the minimally invasive changes to such a key interface, and to maintain complete backwards compatibility with existing code. This may very well not be possible! |
@alexec Can't check right now, so the compiler in my head can be mistaken, but if you make And of course Out of 3 options, only changing PS. I feel your pain - we also tried a solution which decorated some of the Selenium APIs and extended @TikhomirovSergey I'm not a Appium user, so I don't care much if you add tons of generics and |
@lqc. Sorry about the delay in getting back to you. I'd experimented around a bit, and in the last commit I've found a solution that seems to avoid raw types, and avoid have to change code to due to the signature change. However, it put "yellow warnings" in various places.
It like the lesser of two evils. |
@@ -19,7 +19,7 @@ | |||
|
|||
import java.util.List; | |||
|
|||
public interface SearchContext { | |||
public interface SearchContext{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
This PR duplicates #863. I'll close. |
Firstly, I apologize for the commit comment. I only just read the "guidelines for contributing", and promptly failed to be able to squash the commits successfully.
This makes SearchContext generic on
<E extends WebElement>
. To prevent "yellow" markers in IntelliJ due to "rawtypes", I updated subclasses as well. This is API compatible for all subclasses, but allows for more flexible for implementations of WebElement and WebDriver when we might want to return decorated versions of a WebElement.This is related to: