mbien commented on code in PR #5384:
URL: https://github.com/apache/netbeans/pull/5384#discussion_r1090006555
##########
java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchSearch.java:
##########
@@ -246,8 +247,15 @@ public void run(CompilationController parameter) throws
Exception {
boolean cont = true;
try {
- if
(parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0)
+ if
(parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) {
+ if (currentInputList.size() == 1) {
+ //the javac crashed while
processing the (single) file, we must ensure progress, otherwise infinite loop
in processing would happen:
+ problems.add(new
MessageImpl(MessageKind.WARNING, "An error occurred while processing file: " +
FileUtil.getFileDisplayName(parameter.getFileObject()) + ", please see the IDE
log for more information."));
+ currentPointer.incrementAndGet();
+ }
+
return ;
+ }
Review Comment:
~~this means that this can't happen when `BatchSearch` is used on multiple
files because it wouldn't reuse javac instances there?~~
~~So the only reason it tries again with the same file when `Phase.RESOLVED`
can't be reached is because of a possible OOM situation?~~
If that is the case we should add some kind of per-file retry counter.
`while(true)` loops are always a bit of a danger zone.
--
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