使用 Project Lombok 的模糊方法调用
Ambiguous method call using Project Lombok
我有以下代码:
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
public class NameParserResponse {
private boolean match;
}
public class Main {
public static void main(String[] args) {
NameParserResponse nameParserResponse = NameParserResponse.builder().build();
nameParserResponse.isMatch();
}
}
尝试引用 isMatch() 时,我得到:
Ambiguous method call. Both
isMatch () in Response and
isMatch () in Response match
我也试过删除 @Builder
注释,但这没有帮助。
IntelliJ 对 "de-Lombok" 代码进行了重构,这会将 Lombok 魔法扩展到它在幕后自动生成的更冗长的代码中。当我以前遇到过这样的怪事时,查看实际生成的代码,而不是仅仅猜测它,有助于使问题更清楚。 YMMV.
祝你好运。
除了 Project Lombok
插件外,我还安装了 Hrisey
Intellij 插件。我一定是在寻找 Project Lombok
插件时不小心安装了这个。
禁用此插件后,问题不再存在。
我有以下代码:
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
public class NameParserResponse {
private boolean match;
}
public class Main {
public static void main(String[] args) {
NameParserResponse nameParserResponse = NameParserResponse.builder().build();
nameParserResponse.isMatch();
}
}
尝试引用 isMatch() 时,我得到:
Ambiguous method call. Both
isMatch () in Response and
isMatch () in Response match
我也试过删除 @Builder
注释,但这没有帮助。
IntelliJ 对 "de-Lombok" 代码进行了重构,这会将 Lombok 魔法扩展到它在幕后自动生成的更冗长的代码中。当我以前遇到过这样的怪事时,查看实际生成的代码,而不是仅仅猜测它,有助于使问题更清楚。 YMMV.
祝你好运。
除了 Project Lombok
插件外,我还安装了 Hrisey
Intellij 插件。我一定是在寻找 Project Lombok
插件时不小心安装了这个。
禁用此插件后,问题不再存在。