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

Child Widget extends another non-abstract parent Widget would throw NoSuchMethodException if child using parent method #395

Closed
truebit opened this issue May 25, 2016 · 2 comments
Milestone

Comments

@truebit
Copy link
Contributor

truebit commented May 25, 2016

Description

Child Widget extends another non-abstract parent Widget would throw NoSuchMethodException if child using parent method

Details

For example:
I only tried in OverrideWidget scenario. Below example could reproduce the issue:

There is an abstract Widget named AbstractWidget, I implemented two widgets AndroidParentWidget and IOSParentWidget to extends AbstractWidget.

Then I implemented another widget named AndroidChildWidget extends AndroidParentWidget. in AndroidChildWidget, I only added one more method. Other existing methods such like parentMethod() in AndroidChildWidget just being extended directly without override.

When invoking AndroidChildWidget.parentMethod() in test code, it would throw NoSuchMethodException.

I found a workaround: override parentMethod in AndroidChildWidget explicitly with super.parentMethod(). it would work

@TikhomirovSergey TikhomirovSergey added this to the 4.1.0 milestone May 30, 2016
@truebit
Copy link
Contributor Author

truebit commented Jun 17, 2016

Sometimes I would got NoSuchMethodException in OverrideWidget scenario with plain standard usage.
After applying #418 (comment),
the exception chagned to IllegalArgumentException: Constructor not found: ( it seems more accurate)

java.lang.IllegalArgumentException: Constructor not found
at com.changba.mobile.uitest.widgets.HottestPageTopListCell$$EnhancerByCGLIB$$33a838b0.newInstance()
at net.sf.cglib.proxy.Enhancer.createUsingFactory(Enhancer.java:777)
at net.sf.cglib.proxy.Enhancer.nextInstance(Enhancer.java:650)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:282)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:433)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:324)
at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:56)
at io.appium.java_client.pagefactory.WidgetListInterceptor.getObject(WidgetListInterceptor.java:66)
at io.appium.java_client.pagefactory.interceptors.InterceptorOfAListOfElements.intercept(InterceptorOfAListOfElements.java:51)
at $java.util.ArrayList$$EnhancerByCGLIB$$c0a2d785.get()

It seems that the enhancer trying to new an instance of the abstract widget class caused failure.

@TikhomirovSergey any suggestion? The OverrideWidget implementation is too complex, I debugged a long time and found nothing.

@TikhomirovSergey
Copy link
Contributor

@truebit
If there had been any problem then it seems it was fixed there #392. I can't find a way to reproduce it. Please provide the code sample as a gist and reapen this one.

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

No branches or pull requests

2 participants