`

自己测试GWT的RemoteService时遇到的一个不常见的错误

    博客分类:
  • GWT
阅读更多
Error Info:
The method onFailure(Throwable) of type new AsyncCallback<String>(){} must override a superclass method

有错误的代码:
image.addClickListener(new ClickListener() {
						public void onClick(Widget sender) {
							MyFirstService.Util.getInstance().sayHelloTo("shansun123", 
									new AsyncCallback<String>()
									{
										@Override
										public void onFailure(Throwable caught) {
											Window.alert(caught.getMessage());
										}
										@Override
										public void onSuccess(String result) {
											Window.alert("Return from MyRemoteService: " + result);
										}
									});
						}
					});


出现这种错误是因为在使用googlipse的时候,由IDE自动生成了上面的代码,在两个方法前添加了不该有的@override元数据造成的。去掉这两个元数据,即可。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics