diff --git a/jps/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.java b/jps/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.java index c99ce3f55c9..ae45d220ab5 100644 --- a/jps/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.java +++ b/jps/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.java @@ -16,7 +16,6 @@ package org.jetbrains.jet.jps.build; -import com.google.common.collect.Maps; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; @@ -288,7 +287,7 @@ public class KotlinBuilder extends ModuleLevelBuilder { context.processMessage(new CompilerMessage( CompilerRunnerConstants.KOTLIN_COMPILER_NAME, kind(severity), - prefix + message, + prefix + message + renderLocationIfNeeded(location), location.getPath(), -1, -1, -1, location.getLine(), @@ -296,6 +295,16 @@ public class KotlinBuilder extends ModuleLevelBuilder { )); } + private static String renderLocationIfNeeded(@NotNull CompilerMessageLocation location) { + if (location == NO_LOCATION) return ""; + + // Sometimes we report errors in JavaScript library stubs, i.e. files like core/javautil.kt + // IDEA can't find these files, and does not display paths in Messages View, so we add the position information + // to the error message itself: + String pathname = String.valueOf(location.getPath()); + return new File(pathname).exists() ? "" : " (" + location + ")"; + } + @NotNull private static BuildMessage.Kind kind(@NotNull CompilerMessageSeverity severity) { switch (severity) {