gpt4 book ai didi

eclipse - 方法必须具有签名 "String method() ...[etc]..."但具有签名 "void method()"

转载 作者:行者123 更新时间:2023-12-02 11:01:51 26 4
gpt4 key购买 nike

我有一个数据表,每行都有一个按钮:

<ice:dataTable ... var="item">
<ice:column>
<h:commandButton value="Download" action="#{mybean.downloadItem(item)}" />
</ice:column>
</ice:dataTable>

在支持 bean 中有这个方法:

public void downloadItem(Item item) {
// ...
}

一切正常(单击时执行该方法),但是Eclipse 验证失败并显示以下奇怪消息:

Method must have signature "String method(), String method(), String method(String), String method(String, String), String method(String, String, String), String method(String, String, String, String), String method(String, String, String, String, String), String method(String, String, String, String, String, String), String method(String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String)" but has signature "void method()"

我能做什么?

如果相关的话,我正在 Tomcat 7 上使用 Eclipse Indigo SR1。

最佳答案

忽略它。 Eclipse 是个 SCSS 。您可以通过将“窗口 > 首选项 > Web > JavaServer Faces 工具 > 验证 > 类型分配问题 > 方法表达式签名不兼容”设置为“警告”或“忽略”来调整它>(默认为错误)。

enter image description here

图片借自this blog出于礼貌。

原因是,Eclipse 希望 action 属性始终返回 String,而不是 void。虽然 JSF action 属性中确实未指定,但 EL 方法表达式本身实际上也支持 void 方法。过分热心的消息反过来表明,负责此验证的底层逻辑无法确定各个方法参数,因此它尝试将原始方法签名与允许的签名集合进行比较,如果没有匹配,则最终会在消息中显示成立。根据消息,当方法有 20 个或更多参数时,此问题也可能消失;)

在问题报告近 6 年后,该问题已在 Eclipse Luna SR1 中得到修复。严重性已从错误降低到警告。您可能仍希望将其设置为忽略

另请参阅:

关于eclipse - 方法必须具有签名 "String method() ...[etc]..."但具有签名 "void method()",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8083469/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com