Add reader intention for the thread operation (EA-36906)

This commit is contained in:
Nikolay Krasko
2012-06-26 19:22:55 +04:00
parent e7d6263a58
commit 2c77a0941d
6 changed files with 49 additions and 22 deletions
@@ -16,6 +16,8 @@
package org.jetbrains.jet.codegen;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -51,15 +53,20 @@ public class CompilationException extends RuntimeException {
@Override
public String getMessage() {
StringBuilder message = new StringBuilder("Back-end (JVM) Internal error: ").append(super.getMessage()).append("\n");
Throwable cause = getCause();
if (cause != null) {
String causeMessage = cause.getMessage();
message.append("Cause: ").append(causeMessage == null ? cause.toString() : causeMessage).append("\n");
}
message.append("File being compiled and position: ").append(DiagnosticUtils.atLocation(element)).append("\n");
message.append("The root cause was thrown at: ").append(where());
return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Override
public String compute() {
StringBuilder message = new StringBuilder("Back-end (JVM) Internal error: ").append(CompilationException.super.getMessage()).append("\n");
Throwable cause = getCause();
if (cause != null) {
String causeMessage = cause.getMessage();
message.append("Cause: ").append(causeMessage == null ? cause.toString() : causeMessage).append("\n");
}
message.append("File being compiled and position: ").append(DiagnosticUtils.atLocation(element)).append("\n");
message.append("The root cause was thrown at: ").append(where());
return message.toString();
return message.toString();
}
});
}
}