Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4296

Assertion error in javac when enum definition follows incomplete method

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 11.3
    • Fix Version/s: None
    • Component/s: java - Source
    • Labels:
    • Environment:
      NetBeans 11.3 on Java 14 with nbjavac plugin installed

      Description

      Here is another case where, in the normal course of editing a Java file, the IDE pops up an assertion failure error:

      public final class SomeClass {
        public SomeClass.SomeEnum getSomeEnum(//) { return null; }
      
        public enum SomeEnum {
          ELEM1, ELEM2, ELEM3
        }
      }
      

      The error is as follows:

      Annotation: An error occurred during parsing of 'C:\Users\ebakke\[etc.]\SomeClass.java'. Please report a bug against java/source and attach dump file 'C:\Users\ebakke\AppData\Roaming\NetBeans\dev\var\log\SomeClass_12.dump'.
      Annotation: An error occurred during parsing of 'C:\Users\ebakke\[etc.]\SomeClass.java'. Please report a bug against java/source and attach dump file 'C:\Users\ebakke\AppData\Roaming\NetBeans\dev\var\log\SomeClass_12.dump'.
      An error occurred during parsing of 'C:\Users\ebakke\[etc.]\SomeClass.java'. Please report a bug against java/source and attach dump file 'C:\Users\ebakke\AppData\Roaming\NetBeans\dev\var\log\SomeClass_12.dump'.
      An error occurred during parsing of 'C:\Users\ebakke\[etc.]\SomeClass.java'. Please report a bug against java/source and attach dump file 'C:\Users\ebakke\AppData\Roaming\NetBeans\dev\var\log\SomeClass_12.dump'.
      Caused: java.lang.AssertionError
      	at com.sun.tools.javac.util.Assert.error(Assert.java:155)
      	at com.sun.tools.javac.util.Assert.check(Assert.java:46)
      	at com.sun.tools.javac.comp.Attr.attribIdentAsEnumType(Attr.java:958)
      	at com.sun.tools.javac.comp.MemberEnter.visitVarDef(MemberEnter.java:412)
      	at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:972)
      	at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:172)
      	at com.sun.tools.javac.comp.MemberEnter.signature(MemberEnter.java:120)
      	at com.sun.tools.javac.comp.MemberEnter.visitMethodDef(MemberEnter.java:255)
      	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:882)
      	at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:172)
      	at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:184)
      	at com.sun.tools.javac.comp.TypeEnter$MembersPhase.finishClass(TypeEnter.java:979)
      	at com.sun.tools.javac.comp.TypeEnter$MembersPhase.runPhase(TypeEnter.java:959)
      	at com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:298)
      	at com.sun.tools.javac.comp.TypeEnter$MembersPhase.doCompleteEnvs(TypeEnter.java:888)
      	at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:267)
      	at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:282)
      	at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:282)
      	at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:282)
      	at com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:214)
      	at com.sun.tools.javac.code.Symbol.complete(Symbol.java:660)
      	at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1382)
      	at com.sun.tools.javac.comp.Enter.complete(Enter.java:820)
      	at com.sun.tools.javac.comp.Enter.main(Enter.java:797)
      	at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1147)
      	at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:399)
      	at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:327)
      	at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:660)
      	at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:488)
      	at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:140)
      	at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)
      	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:239)
      	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)
      	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
      	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
      [catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
      	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
      	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
      	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
      

      The error pops up every time a single edit is made, and there's usually two of them every time (viewable via the next/previous buttons in the error dialog that pops up).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ebakke Eirik Bakke
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: