Skip to content
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

Compile-time issues when upgrading to 4.1.2 #474

Closed
ssynix opened this issue Sep 20, 2016 · 3 comments
Closed

Compile-time issues when upgrading to 4.1.2 #474

ssynix opened this issue Sep 20, 2016 · 3 comments

Comments

@ssynix
Copy link

ssynix commented Sep 20, 2016

Description

I'm trying to upgrade java-client 3.4.1 to 4.1.2.

Details

Our framework is built on top of Selenium and Appium's java-client. With the recent update, a simplified version of our interfaces below is failing to compile. I've tried multiple modifications to our code with no result, especially since I don't understand why the error is happening.

Code To Reproduce Issue

I've managed to narrow down the problem to this set of interfaces on Ideone. I believe this change is what is causing the issue for us.

  • For some reason, if we continue to extend MobileDriver without a generic parameter, the compiler is not able to override execute. This completely baffles me...
  • If I extend MobileDriver<WebElement> or change all our interfaces to generic (IFrameworkMobileDriver<T extends WebElement> extends MobileDriver<T>), the Java compiler pulls two versions of FindsByXPath into the our class with what it thinks are non-covariant return types (List<T> and List<WebElement> are not covariant?).

Any idea what I'm missing here?

@TikhomirovSergey
Copy link
Contributor

Hi @ssynix
It is known issue. There are many details provided here #413
Also there are many details how to resolve it. You need to use eclipse compiler.
If you use maven then https://github.com/appium/java-client/blob/master/archive/pom.xml#L217
if you use gradle then https://github.com/appium/java-client/blob/master/build.gradle#L31
I'm waiting for your response.

@ssynix
Copy link
Author

ssynix commented Sep 21, 2016

It seems I haven't been as thorough in my searching! Unfortunately, the current set up at our company gets in the way of using a different compiler.

I read most of the issues that you linked, and I see there have been a lot of development going on into refactoring these interfaces, but I still fail to understand why this issue is happening. Are we facing a bug in the java compiler?

I managed to fix the problem by changing our override from
public void execute(String driverCommand, Map<String, ?> parameters) {}
to
public void execute(String driverCommand, Map parameters) {}

I still have no idea why making MobileDriver generic would suddenly necessitate removing the type parameters from our overridden methods.

I have given up on trying to understand this issue for now and will probably resort to the fix/workaround above.

Thanks for the additional details!

@ssynix ssynix closed this as completed Sep 21, 2016
@TikhomirovSergey
Copy link
Contributor

@ssynix Yes. It is probably javac issue. But I'm not sure.

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

No branches or pull requests

2 participants