mbien commented on issue #7437: URL: https://github.com/apache/netbeans/issues/7437#issuecomment-2283012665
> Well, NetBeans uses javac for parsing, and the same `Unexpected tree` error is shown in a notification. I'm curious that the `JavacParser` call at https://github.com/apache/netbeans/blob/master/java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java#L742 doesn't catch the `AssertionError` and wrap it in an `IOException`, which is possibly how to read the documentation for that method?? cc/ @lahodaj @mbien - thoughts? @neilcsmith-net this doesn't seem to make a (big) difference unfortunately since IOEs are caught and rethrown as `ParseExceptions`, e.g https://github.com/apache/netbeans/blob/f6e767325d4c98363794065ba60e559424ae1c2a/java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java#L535-L539 I quickly tested this using the reproducer and it would still end up in the notifications instead of the editor error annotations. <details> ``` SEVERE [org.openide.util.Exceptions] java.lang.AssertionError: Unexpected tree: switch (this) { case CLASSIC: return "Classic"; case CONTEMPORARY: return "Contemporary"; default: return "None"; } with kind: SWITCH_EXPRESSION within: switch (this) { case CLASSIC: return "Classic"; case CONTEMPORARY: return "Contemporary"; default: return "None"; } with kind: SWITCH_EXPRESSION at com.sun.tools.javac.util.Assert.error(Assert.java:162) at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.validateAnnotatedType(Attr.java:5911) at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitVarDef(Attr.java:5750) at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1063) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50) at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitClassDef(Attr.java:5803) at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:855) at com.sun.tools.javac.comp.Attr.validateTypeAnnotations(Attr.java:5700) at com.sun.tools.javac.code.TypeAnnotations.lambda$validateTypeAnnotationsSignatures$1(TypeAnnotations.java:146) at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:200) at com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:144) at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:157) at com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1810) at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1079) at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:345) at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:282) at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:742) Caused: java.io.IOException at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:800) at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:536) Caused: org.netbeans.modules.parsing.spi.ParseException: JavacParser failure at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:538) 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:241) at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:288) 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:572) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018) ``` </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
