简体   繁体   English

龙目岛Arguments号码错误

[英]Wrong number of Arguments with Lombok

I am trying to use @SuperBuilder of Lombok, yet for some reason I am having the issue in compile time Error:(14, 1) java: wrong number of type arguments; required 3我正在尝试使用 Lombok 的 @SuperBuilder,但由于某种原因,我在编译时遇到了问题Error:(14, 1) java: wrong number of type arguments; required 3 Error:(14, 1) java: wrong number of type arguments; required 3

That's my subclass;那是我的子类;

@SuperBuilder
public class FetchFollowersOperation extends Operation<List<InstagramUserSummary>> {

    private String userName;

    public List<InstagramUserSummary> operate() {

        InstagramSearchUsernameResult userResult = null;
        try {
            userResult = instagram4j.sendRequest(new InstagramSearchUsernameRequest(this.userName));
            InstagramGetUserFollowersResult followers = instagram4j.sendRequest(new InstagramGetUserFollowersRequest(userResult.getUser().getPk()));
            return followers.getUsers();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

And the parent class is below;下面是父 class;

@SuperBuilder
public abstract class Operation<T> {
    protected Instagram4j instagram4j;

    public abstract T operate();
}

The issue is at line public class FetchFollowersOperation extends Operation<List<InstagramUserSummary>> .问题在于public class FetchFollowersOperation extends Operation<List<InstagramUserSummary>>行。 You must specify one type only ie T not it's inner generic type here ie replace it with public class FetchFollowersOperation extends Operation<List> .您必须仅指定一种类型,即 T 而不是它的内部泛型类型,即将其替换为public class FetchFollowersOperation extends Operation<List>

This solves your problem.这解决了你的问题。 Though I went through lombok documentation and other details on what causes this issue, but didn't get any information on that.尽管我浏览了 lombok 文档和其他有关导致此问题的详细信息,但没有得到任何相关信息。

Hope it helps!希望能帮助到你!

It's a bug, as @Jan Rieke mentioned.正如@Jan Rieke 提到的,这是一个错误。 Reported via https://github.com/rzwitserloot/lombok/issues/2262 ;通过https://github.com/rzwitserloot/lombok/issues/2262报告; it's been fixed and will be in the upcoming lombok release.它已经修复,将在即将发布的 lombok 版本中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM