vaadin - 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
您可以通过为听众添加 upcast 来解决此问题:
ComponentUtil.addListener(label, ClickEvent.class,
(ComponentEventListener) e -> Notification.show("Clicked"));
推荐阅读
- ssh - Mobaxterm:Ctrl 键似乎被锁定
- python - Python内部类赋值
- python - 在python中一次执行10个函数,然后使用线程重新启动作业
- r - 当我尝试包含位置时,R 中“对”的非数字参数
- javascript - 在应用数字格式时如何避免这种情况我将最后一位数字的一部分替换为 0?
- amazon-web-services - 如何将现有的 Elasticsearch 数据从字符串转换为数字
- javascript - 创建新的城市状态对象
- sharepoint-online - Power Apps 在 SharePoint 列表列中存储图像的最佳方法
- wpf - 当我用鼠标拖动窗口时如何调整整个窗口的大小
- wordpress - 主题中的未知 CSS 代码导致图像模糊