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

Framework not identifying the undeclared UiHandler. #6

Closed
shivakumarkn opened this issue Sep 17, 2012 · 2 comments
Closed

Framework not identifying the undeclared UiHandler. #6

shivakumarkn opened this issue Sep 17, 2012 · 2 comments
Assignees
Labels

Comments

@shivakumarkn
Copy link

One of my views have an handler as follows -
@UiHandler("myHomePageAnchor")
void onMyHomePageAnchorClick(ClickEvent event) {
listener.onMyHomePageAnchorClicked();
}

Unless "myHomePageAnchor" is declared as an Anchor in my view (current code doesn't have it declared but works fine), the gwt-test-utils fails.

The stack trace in version .41 doesn't give much info and we don't even know the error is due to undeclared UiHandler. But the jar "gwt-test-utils-0.41-20120905.060017-3.jar" I downloaded from sonatype is good with some useful info shed on. i.e., it pinpoints to the view class. See the two different versions throwing different errors.

Stacktrace with 0.41-20120905.060017-3. The last two lines takes me directly to my error class.
java.lang.ExceptionInInitializerError
...<>
Caused by: com.googlecode.gwt.test.exceptions.ReflectionException: Unable to find field, class 'class mypackage.MyViewImpl', fieldName 'myHomePageAnchor'
at com.googlecode.gwt.test.utils.GwtReflectionUtils.getUniqueFieldByName(GwtReflectionUtils.java:692)
at com.googlecode.gwt.test.utils.GwtReflectionUtils.getPrivateFieldValue(GwtReflectionUtils.java:457)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.addHandlers(UiBinderInvocationHandler.java:47)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.createAndBindUi(UiBinderInvocationHandler.java:85)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.invoke(UiBinderInvocationHandler.java:34)
at mypackage.MyViewImpl.$Proxy93.createAndBindUi(Unknown Source)
at mypackage.MyViewImpl.(MyViewImpl.java:40)
... 40 more

Stacktrace with 0.41.

com.googlecode.gwt.test.exceptions.GwtTestException: Error while generating gwt-test-utils prerequisites
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:113)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:299)
at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:105)
... 21 more

This is something I mentioned as an issue 150 @ https://code.google.com/p/gwt-test-utils/issues/detail?id=150. Though I am not looking for the immediate fix, it would be great if the framework throws the error it used to throw earlier. That helps to identify the cause and just declare the troublesome field as a workaround.

Thanks
Shivakumar

@ghost ghost assigned Gael Sep 19, 2012
@Danny02
Copy link

Danny02 commented Jan 13, 2013

encountered the same problem, should be easy to fix?

@shivakumarkn
Copy link
Author

Not worked on this framework for last few months. So not sure whether it is fixed. But the workaround is to declare the component in the view whether you use it or not.

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

No branches or pull requests

3 participants