Wrong number of Arguments with Lombok

Bleach :

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

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;

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

    public abstract T operate();
}
Vinay Prajapati :

The issue is at line public class FetchFollowersOperation extends Operation<List<InstagramUserSummary>>. You must specify one type only i.e. T not it's inner generic type here i.e. replace it with 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.

Hope it helps!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=322830&siteId=1
Recommended