Java编译器错误:实际和正式参数列表的长度不同

时间:2018-05-25 10:45:25

标签: java compiler-errors

在进行maven构建时,我收到了以下错误:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project SimplyAuth: Compilation failure
[ERROR] /C:/Users/Admin/Project/dev/workspaces/Java/Auth/src/test/java/com/data/sAuth/JwtClaimsBuilderTest.java:[13,36] method generateToken in class com.comdata.sAuth.util.JwtClaimsBuilder cannot be applied to given types;
[ERROR] required: com.comdata.simplyAuth.model.ICDUserDetails
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

这是控制器类中的方法:

@Autowired
private JwtClaimsBuilder jwtBuilder;
@RequestMapping("/GetUser")
public String getToken(@RequestBody ICDUserDetails details) {
    return jwtBuilder.generateToken(details);
}

public String generateToken(ICDUserDetails userDetails) {
    JwtClaims claims = new JwtClaims();
    claims.setStringClaim("username", userDetails.getUserName());
    claims.setStringClaim("userCulture", userDetails.getUserCulture());
}


public class ICDUserDetails {
    private String UserName;
    private String UserCulture;
    private List<ICDAccount> AccountCodes;

    public ICDUserDetails() {

    }

    public ICDUserDetails(String userName, String userCulture, List<ICDAccount> accountCodes) {
        this.UserName = userName;
        this.UserCulture = userCulture;
        this.AccountCodes = accountCodes;
    }
    //getters, setters
}

为什么模型类不是这里要使用的有效类型?

FIX: 它只是工作空间中的一个小故障,重启IDE适合我。

0 个答案:

没有答案