Skip to content

Commit 0dbe296

Browse files
authored
Check for thread interruption in Parser::parse (#4302)
Since this method might be expensive, checking for interruption is a way to allow expensive tasks to be aborted.
1 parent 01240db commit 0dbe296

File tree

1 file changed

+5
-0
lines changed
  • org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser

1 file changed

+5
-0
lines changed

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11605,6 +11605,11 @@ protected void parse() {
1160511605
try {
1160611606
this.scanner.setActiveParser(this);
1160711607
ProcessTerminals : for (;;) {
11608+
if (Thread.currentThread().isInterrupted()) {
11609+
Thread.currentThread().interrupt();
11610+
throw new RuntimeException("[" + Thread.currentThread().getName() + "] Task interrupted", new InterruptedException()); //$NON-NLS-1$ //$NON-NLS-2$
11611+
}
11612+
1160811613
int stackLength = this.stack.length;
1160911614
if (++this.stateStackTop >= stackLength) {
1161011615
System.arraycopy(

0 commit comments

Comments
 (0)