apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.67k stars 854 forks source link

java.lang.AssertionError: Unexpected tree #6348

Open sullivanbs opened 1 year ago

sullivanbs commented 1 year ago

Apache NetBeans version

Apache NetBeans 18

What happened


Annotation: An error occurred during parsing of 'MVELHandler.java'. Please report a bug against java/source and attach dump file 'MVELHandler_13.dump'.
Annotation: An error occurred during parsing of 'MVELHandler.java'. Please report a bug against java/source and attach dump file 'MVELHandler_13.dump'.
An error occurred during parsing of 'MVELHandler.java'. Please report a bug against java/source and attach dump file 'MVELHandler_13.dump'.
An error occurred during parsing of 'MVELHandler.java'. Please report a bug against java/source and attach dump file 'MVELHandler_13.dump'.
Caused: java.lang.AssertionError: Unexpected tree: (ERROR) ? (ERROR) : (ERROR) with kind: CONDITIONAL_EXPRESSION within: (ERROR) ? (ERROR) : (ERROR) with kind: CONDITIONAL_EXPRESSION
    at com.sun.tools.javac.util.Assert.error(Assert.java:162)
    at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.validateAnnotatedType(Attr.java:5855)
    at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitVarDef(Attr.java:5701)
    at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1018)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
    at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitMethodDef(Attr.java:5691)
    at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:912)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
    at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitClassDef(Attr.java:5754)
    at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:810)
    at com.sun.tools.javac.comp.Attr.validateTypeAnnotations(Attr.java:5651)
    at com.sun.tools.javac.code.TypeAnnotations.lambda$validateTypeAnnotationsSignatures$1(TypeAnnotations.java:144)
    at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:199)
    at com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:143)
    at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:156)
    at com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1787)
    at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1058)
    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:747)
    at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:540)
    at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:141)
    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:577)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1419)
    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:2034)

How to reproduce

No response

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 10 professional 22H2

JDK

java version "20.0.1" 2023-04-18

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

Yes

mbien commented 7 months ago

typing something invalid can sometimes cause javac parsing exceptions but those typically won't cause any problems. We should probably change the log level on that catch block to a warning.