Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8270833

Information:java: java.lang.AssertionError: Value of x -1

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      windows_10
    • Verification:
      Not verified

      Description

      A DESCRIPTION OF THE PROBLEM :
      在注解处理器中,如果先通过如下方式处理某个元素:
      processingEnv.getElementUtils().getAllMembers(element).forEach(v -> {
                        print("==> " + v.toString());
                  });
      ,可以正常打印输出,然后访问TypeElement typeEle = (TypeElement) e;
      目的式为了给使用指定注解的类自动生成方法, 在生成的过程中打印元素信息最终报错:


      Information:java: 进入注解处理器: com.jjf.study.annotations.processor.MyGetterProcessor
      Information:java: ==> getClass()
      Information:java: ==> hashCode()
      Information:java: ==> equals(java.lang.Object)
      Information:java: ==> clone()
      Information:java: ==> toString()
      Information:java: ==> notify()
      Information:java: ==> notifyAll()
      Information:java: ==> wait(long)
      Information:java: ==> wait(long,int)
      Information:java: ==> wait()
      Information:java: ==> finalize()
      Information:java: ==> id
      Information:java: ==> createTime
      Information:java: ==> operator
      Information:java: ==> LogEntity()
      Information:java: ==> logType
      Information:java: ==> sysCode
      Information:java: ==> message
      Information:java: {
         包名称: com.jjf.study.test.annotationstest.entity
         导入列表: [import com.jjf.study.annotations.annotation.MyGetter;
        ]
         定义语句: [
        @MyGetter()
        public class LogEntity extends BaseEntity {
            
            public LogEntity() {
                super();
            }
            private Byte logType;
            private String sysCode;
            private String message;
        }]
         .getTag ==> TOPLEVEL
         .getKind ==> COMPILATION_UNIT
        }
      Information:java: 父类信息: {
         包名称: com.jjf.study.test.annotationstest.entity
         导入列表: [import com.jjf.study.annotations.annotation.MyGetter;
        , import java.math.BigDecimal;
        , import java.util.Date;
        ]
         定义语句: [
        public class BaseEntity {
            
            public BaseEntity() {
                super();
            }
            protected BigDecimal id;
            protected Date createTime;
            protected String operator;
        }]
         .getTag ==> TOPLEVEL
         .getKind ==> COMPILATION_UNIT
        }
      Information:java: logType has been processed
      Information:java: sysCode has been processed
      Information:java: message has been processed
      Information:java: 编译器 (1.8.0_111) 中出现异常错误。如果在 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:1142)
      Information:java: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      Information:java: at java.lang.Thread.run(Thread.java:745)
      Information:java: Errors occurred while compiling module 'annotations-test'
      Information:javac 1.8.0_111 was used to compile java sources
      Information:2021/7/16 17:01 - Build completed with 1 error and 0 warnings in 5 s 255 ms
      Error:java: Compilation failed: internal java compiler error


      REGRESSION : Last worked in version 8u291


      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              adev ANUPAM DEV
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: