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

Assertion error in javac when saving file with missing comma in method parameter list

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 11.3
    • None
    • java - Source
    • NetBeans 11.3 with nbjavac plugin installed

    Description

      If, during editing, a method parameter list occurs with a missing comma (in certain cases), an error dialog shows up showing an assertion error in javac every time the Java source file is saved, interrupting the user. A minimized example exhibiting this behavior is as follows:

      public class BugErrorUncaught {
        private Object testMethod(String param1 final String param2) {
          return null;
        }
      }
      

      This is a variation of the example in NETBEANS-4095, but filed here as a separate bug since the two cause different exceptions at different levels (inside javac here vs. at the semantic highlighting layer in NETBEANS-4095). This example causes the IDE to throw the following exception:

      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.Flow$FlowAnalyzer.errorUncaught(Flow.java:918)
      	at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitClassDef(Flow.java:1008)
      	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:788)
      	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      	at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:422)
      	at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1456)
      	at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1446)
      	at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:219)
      	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1499)
      	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1473)
      	at com.sun.tools.javac.api.JavacTaskImpl$1.process(JavacTaskImpl.java:504)
      	at com.sun.tools.javac.api.JavacTaskImpl$Filter.run(JavacTaskImpl.java:651)
      	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:507)
      [catch] at org.netbeans.modules.java.source.nbjavac.indexing.MultiPassCompileWorker.compile(MultiPassCompileWorker.java:261)
      	at org.netbeans.modules.java.source.indexing.JavaCustomIndexer.index(JavaCustomIndexer.java:361)
      	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$2.run(Indexable.java:138)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runIndexer(RepositoryUpdater.java:275)
      	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.index(Indexable.java:136)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2750)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
      	at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$3.call(RepositoryUpdater.java:3300)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$3.call(RepositoryUpdater.java:3255)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
      	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.scanFiles(RepositoryUpdater.java:3255)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$FileListWork.getDone(RepositoryUpdater.java:3785)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
      	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
      	at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
      	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
      	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
      	at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
      	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
      	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
      	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)
      

      Another example that produces the same stack trace:

      public final class BugErrorUncaught {
        public Object testMethod(//Object someArg) {
          if (someArg == null) {
            return "foo";
          } else {
            return "bar";
          }
        }
      }
      
      

      This one produces an error on every single edit.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mjayan Meghna Jayan
            ebakke Eirik Bakke

            Dates

              Created:
              Updated:

              Slack

                Issue deployment