本文介绍了使用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()时,我得到:

When trying to reference isMatch(), I get:

Ambiguous method call. Both

isMatch () in Response and
isMatch () in Response match

我也尝试过删除@Builder批注,但这无济于事.

I have also tried removing the @Builder annotation, but this doesn't help.

推荐答案

除了Project Lombok插件外,我似乎还安装了Hrisey Intellij插件.在寻找Project Lombok插件时,我一定是不小心安装了此软件.

It looks like I had the Hrisey Intellij plugin installed in addition to the Project Lombok plugin. I must have accidentally installed this when I was looking for the Project Lombok plugin.

禁用此插件后,该问题不再存在.

After disabling this plugin, the issue was no longer present.

这篇关于使用Project Lombok进行模棱两可的方法调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 14:26