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

Posted buguge - Keep it simple,stupid

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 -1
Information: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 sources
Information:2023/3/20 20:57 - Build completed with 1 error and 0 warnings in 5 s 993 ms
Error:java: Compilation failed: internal java compiler error

 

以上是关于IDEA Rebuild项目错误:Information:java: java.lang.AssertionError: Value of x -1的主要内容,如果未能解决你的问题,请参考以下文章

IDEA——已建立的项目换了电脑环境,在本地点电脑上击build没有反应或者rebuild没有编译新的class输出解决方法(重新进行相关的设置)

idea中运行了算编译吗

idea 启动springcloud项目报找不到主类

在drupal模板项目上运行Lando start或rebuild后如何阻止此错误返回

IDEA 报错 (自己写的)程序包不存在

IDEA启动项目之乱码问题