最新要闻

广告

手机

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

家电

今头条!IDEA Rebuild项目错误:Information:java: java.lang.AssertionError: Value of x -1

来源:博客园


【资料图】

模仿lombok工具,我的enumgen工具写完了。

公司的项目emax-rpcapi-list依赖了enumgen后,IDEARebuild Project时,或者maven package/install的时候,出现报错→Information:java: java.lang.AssertionError: Value of x -1

这个错误让我有点摸不着头脑。因为我自己的demo项目在依赖了enumgen是可以正常使用的。

仔细分析错误堆栈,注意到 visitClassDef、visitMethodDef 这些关键字,我去修改我的注解处理器实现逻辑,去尝试解决,未能修复。中间排查过程相当曲折。最后在比对emax-rpcapi-list和我的demo工程时,才有了转机。

各种排查、各种试错,最后的解决办法有2个。

  • 第一个是调整maven dependencies依赖顺序。我的要在lombok的前面先行依赖enumgen。
  • 第二个是lombok版本兼容性。lombok版本1.18.20是有问题的,升级lombok的版本到1.18.24,就可以了。

此问题网上资料较少,在sun平台有提问,但是没有结果。

下面贴出来build时关于这个错误的详细信息:

Information:java: 编译器 (1.8.0_241) 中出现异常错误。如果在 Bug Database (http://bugs.java.com) 中没有找到该错误, 请通过 Java Bug 报告页 (http://bugreport.java.com) 建立该 Java 编译器 Bug。请在报告中附上您的程序和以下诊断信息。谢谢。Information:java: java.lang.AssertionError: Value of x -1Information:java:     at com.sun.tools.javac.util.Assert.error(Assert.java:133)Information:java:     at com.sun.tools.javac.util.Assert.check(Assert.java:94)Information:java:     at com.sun.tools.javac.util.Bits.incl(Bits.java:186)Information:java:     at com.sun.tools.javac.comp.Flow$AssignAnalyzer.initParam(Flow.java:1858)Information:java:     at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitMethodDef(Flow.java:1807)Information:java:     at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)Information:java:     at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)Information:java:     at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)Information:java:     at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)Information:java:     at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitClassDef(Flow.java:1749)Information:java:     at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)Information:java:     at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:2446)Information:java:     at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:2429)Information:java:     at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:211)Information:java:     at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1327)Information:java:     at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)Information:java:     at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)Information:java:     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)Information:java:     at com.sun.tools.javac.main.Main.compile(Main.java:523)Information:java:     at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)Information:java:     at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)Information:java:     at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:207)Information:java:     at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:493)Information:java:     at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:345)Information:java:     at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:270)Information:java:     at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:223)Information:java:     at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1414)Information:java:     at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1092)Information:java:     at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1159)Information:java:     at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1053)Information:java:     at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:882)Information:java:     at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:449)Information:java:     at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:190)Information:java:     at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)Information:java:     at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:297)Information:java:     at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:130)Information:java:     at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218)Information:java:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)Information:java:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)Information:java:     at java.lang.Thread.run(Thread.java:748)Information:java: Errors occurred while compiling module "zhenghe-rpcapistyle"Information:javac 1.8.0_241 was used to compile java sourcesInformation:2023/3/20 20:57 - Build completed with 1 error and 0 warnings in 5 s 993 msError:java: Compilation failed: internal java compiler error

关键词: