如何解决Vaadin Maven 编译错误 (ComponentUtil.addListener))
很遗憾,无法为我的 Vaadin 应用程序执行 maven 安装。我在 Eclipse 中没有错误。也可以通过 Eclipse 运行应用程序。但是 maven 安装总是在这个错误中运行:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project lunchlist: Compilation failure: Compilation failure:
[ERROR] /C:/Users/thomas/workspace/test/src/main/java/TestView.java:[214,42] incompatible types: cannot infer type-variable(s) T
[ERROR] (argument mismatch; cannot infer functional interface descriptor for com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent>)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors,re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
以下代码导致编译错误:
ComponentUtil.addListener(label,ClickEvent.class,e -> {
xxxxx
});
有人有想法吗?提前致谢! :)
最好的问候, 托马斯
解决方法
您可以通过为您的听众向 ComponentEventListener
添加向上广播来解决这个问题:
ComponentUtil.addListener(label,ClickEvent.class,(ComponentEventListener) e -> Notification.show("Clicked"));
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。