lombok 引起的编译时 java.lang.stackoverflowerror 问题

今天工程编译遇到以下报错:

java.lang.StackOverflowError
	at java.lang.Class.getSimpleName(Class.java:1306)
	at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:384)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:196)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
	at lombok.core.AST.buildWithField0(AST.java:394)
	at lombok.core.AST.buildWithField(AST.java:292)
	at lombok.javac.JavacAST.drill(JavacAST.java:421)
	at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:387)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:196)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
	at lombok.core.AST.buildWithField0(AST.java:394)
	at lombok.core.AST.buildWithField(AST.java:292)
	at lombok.javac.JavacAST.drill(JavacAST.java:421)
	at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:387)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:196)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
	at lombok.core.AST.buildWithField0(AST.java:394)
	at lombok.core.AST.buildWithField(AST.java:292)
	at lombok.javac.JavacAST.drill(JavacAST.java:421)

解决方法:
1、
根据IDEA版本,将依赖的Lombok版本修改

dependency("org.projectlombok:lombok:1.18.10")

改为

dependency("org.projectlombok:lombok:1.18.0")

或者:
2、
修改注解
@Data ----> @Getter + @Setter

你可能感兴趣的:(工具箱,java)