matthiasblaesing commented on issue #6790: URL: https://github.com/apache/netbeans/issues/6790#issuecomment-1858925319
@lahodaj this might be a bug in javac. `com.sun.tools.javac.util.Abort` (super class of `CancelAbort`) says: > Throwing an instance of this class causes (silent) termination of the main compiler method. I see though: https://github.com/openjdk/jdk/blob/34351b7a7950a3b563748f40f2619374f62f9b16/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java#L247-L253 Line 252 wraps the `CancelAbort`/`Abort` we are prepared to handle into an `IllegalStateException`, which hits the hard error path. Given the description in `Abort`, I would expect something like this: ``` @Override @DefinedBy(Api.COMPILER_TREE) public Iterable<? extends CompilationUnitTree> parse() { Pair<Iterable<? extends CompilationUnitTree>, Throwable> result = invocationHelper(this::parseInternal); if (result.snd == null) { return result.fst; } else if(result.snd instanceof Abort) { throw (Abort) result.snd; } else { throw new IllegalStateException(result.snd); } } ``` The alternative would be to check the exception chain in `VanillaCompileWorker` and see if either the original throwable is `CancelAbort` or one of the causes higher up in the chain is. If `CancelAbort` is found, the same behavior would be invoked, that the current direct catch of `CancelAbort` shows. What do you think? -- 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
