当我尝试将@Data
注释与lombok 0.10.1
一起使用时。在Eclipse中:3.7.0.v20110504-0800-7b7qFVpFEx2XnmYtj_9RfO7
我收到此错误,有人可以提出建议吗?
Lombok annotation handler class lombok.eclipse.handlers.HandleData failed
java.lang.NoSuchMethodError: java/util/Arrays.copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;
at lombok.eclipse.handlers.EclipseHandlerUtil.createSuppressWarningsAll(EclipseHandlerUtil.java:514)
at lombok.eclipse.handlers.EclipseHandlerUtil.injectMethod(EclipseHandlerUtil.java:451)
at lombok.eclipse.handlers.HandleEqualsAndHashCode.generateMethods(HandleEqualsAndHashCode.java:227)
at lombok.eclipse.handlers.HandleEqualsAndHashCode.generateEqualsAndHashCodeForType(HandleEqualsAndHashCode.java:116)
at lombok.eclipse.handlers.HandleData.handle(HandleData.java:63)
at lombok.eclipse.HandlerLibrary$AnnotationHandlerContainer.handle(HandlerLibrary.java:73)
at lombok.eclipse.HandlerLibrary.handleAnnotation(HandlerLibrary.java:191)
at lombok.eclipse.TransformEclipseAST$AnnotationVisitor.visitAnnotationOnType(TransformEclipseAST.java:204)
at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:96)
at lombok.eclipse.EclipseAST.traverseChildren(EclipseAST.java:94)
at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:63)
at lombok.eclipse.EclipseAST.traverseChildren(EclipseAST.java:94)
at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:58)
at lombok.eclipse.EclipseAST.traverse(EclipseAST.java:89)
at lombok.eclipse.TransformEclipseAST.go(TransformEclipseAST.java:166)
at lombok.eclipse.TransformEclipseAST.transform(TransformEclipseAST.java:132)
at lombok.eclipse.TransformEclipseAST.transform_swapped(TransformEclipseAST.java:85)
at org.eclipse.jdt.internal.compiler.parser.Parser.endParse(Parser.java:8506)
at org.eclipse.jdt.internal.core.util.CommentRecorderParser.endParse(CommentRecorderParser.java:116)
at org.eclipse.jdt.internal.compiler.SourceElementParser.endParse(SourceElementParser.java:727)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9515)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9731)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9688)
at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:921)
at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexDocument(SourceIndexer.java:68)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:72)
at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:453)
at org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java:853)
at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:405)
at java.lang.Thread.run(Thread.java:799)
答案 0 :(得分:2)
这个问题的原因是lombok的那个版本使用了java6 API,我想你正在使用java5来运行eclipse。这已在0.10.4版本中修复。目前的版本是0.10.6。
披露:我是核心贡献者之一。