You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/12/12 16:22:47 UTC
[GitHub] [netbeans] SBasalaev opened a new issue, #5090: Fails to parse a file with incomplete switch expression, freezes when trying to save
SBasalaev opened a new issue, #5090:
URL: https://github.com/apache/netbeans/issues/5090
### Apache NetBeans version
Apache NetBeans 16
### What happened
When I add a case with a block to the switch expression, exception notification appears and completion stops working. If I try to save a file after that the whole application freezes.
### How to reproduce
Suppose I have a class
```java
class Switch {
public boolean test(Object value) {
return switch (value) {
default -> false;
}
}
}
```
Then I start adding a new case. The issue happens right after I type the opening brace
```java
class Switch {
public boolean test(Object value) {
return switch (value) {
case Boolean b -> { // <- this line added
default -> false;
}
}
}
```
Creating file with that contents does not always cause the issue but typing the line in editor always does. This also happened in previous versions of NetBeans and with previous JDK versions.
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Ubuntu Linux 22.04 amd64
### JDK
OpenJDK 16 (system provided)
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
Stack trace reported by NetBeans
```
Caused: java.lang.NullPointerException: Cannot read field "type" because "tree" is null
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanCond(Flow.java:2145)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitYield(Flow.java:2785)
at com.sun.tools.javac.tree.JCTree$JCYield.accept(JCTree.java:1660)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scanSyntheticBreak(Flow.java:459)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.handleSwitch(Flow.java:2597)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitSwitchExpression(Flow.java:2565)
at com.sun.tools.javac.tree.JCTree$JCSwitchExpression.accept(JCTree.java:1382)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanExpr(Flow.java:2118)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitReturn(Flow.java:2818)
at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1711)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitBlock(Flow.java:2402)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1082)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitMethodDef(Flow.java:2305)
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.Flow$BaseAnalyzer.scan(Flow.java:447)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitClassDef(Flow.java:2243)
at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:810)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:3031)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:3013)
at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:224)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1377)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1341)
at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:404)
at com.sun.tools.javac.api.JavacTaskImpl.lambda$analyze$1(JavacTaskImpl.java:379)
at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:379)
Caused: java.lang.IllegalStateException
at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:383)
at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:770)
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: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:577)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
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)
```
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
--
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: notifications-unsubscribe@netbeans.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Knusende-Ro commented on issue #5090: Fails to parse a file with incomplete switch expression
Posted by "Knusende-Ro (via GitHub)" <gi...@apache.org>.
Knusende-Ro commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-1668374817
Yes, it's still a valid issue. I get exactly the same stack trace as SBasalaev.
NetBeans 18 (binary from zip), Debian Bookworm (12.1), OpenJDK-17 (Debian supplied). LXDE desktop.
Peter
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Fails to parse a file with incomplete switch expression [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-2079094469
checked and this is still reproducible with 22-rc1
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on issue #5090: Fails to parse a file with incomplete switch expression, freezes when trying to save
Posted by GitBox <gi...@apache.org>.
mbien commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-1351692550
right, just wanted to make sure this applies here too. The other issue is tracked under #4054.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Fails to parse a file with incomplete switch expression [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-1751684481
i am wondering why issues like this don't show up when javac is ran from CLI. NPEs in javac seem to be more common now. Going to start using the nb-javac label for issues like this.
cc @lahodaj
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] neilcsmith-net commented on issue #5090: Fails to parse a file with incomplete switch expression
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-1665170672
Is this still a valid issue?
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on issue #5090: Fails to parse a file with incomplete switch expression, freezes when trying to save
Posted by GitBox <gi...@apache.org>.
mbien commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-1349512622
any on-save action enabled? Organize imports or formatting etc?
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] SBasalaev commented on issue #5090: Fails to parse a file with incomplete switch expression, freezes when trying to save
Posted by GitBox <gi...@apache.org>.
SBasalaev commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-1351688229
Yes, "Remove unused imports". After disabling it I can save, so this is actually two separate issues.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Fails to parse a file with incomplete switch expression [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on issue #5090:
URL: https://github.com/apache/netbeans/issues/5090#issuecomment-2080051646
FWIW, I've filled:
https://bugs.openjdk.org/browse/JDK-8331212
have a (potential) fix, will open a PR sometime soon.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists