diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ExternalCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ExternalCompiler.java
index c882cc2c27de..9223cbd95a35 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ExternalCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ExternalCompiler.java
@@ -19,6 +19,7 @@ import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.EnvironmentUtil;
import com.intellij.util.StringBuilderSpinAllocator;
import org.jetbrains.annotations.NonNls;
@@ -41,6 +42,18 @@ public abstract class ExternalCompiler implements BackendCompiler {
return COMPILABLE_TYPES;
}
+ /**
+ * Checks if the compiler can compile the specified file.
+ *
+ * @param file the file to check.
+ * @param context the context for the current compile operation.
+ * @return true if can compile the file, false otherwise. If the method returns false, file
+ * will not be included in the list of files passed to {@link #compile(CompileContext, com.intellij.util.Chunk < com.intellij.openapi.module.Module >,com.intellij.openapi.vfs.VirtualFile[], com.intellij.openapi.compiler.TranslatingCompiler.OutputSink)}.
+ */
+ public boolean isCompilableFile(VirtualFile file, CompileContext context) {
+ return getCompilableFileTypes().contains(file.getFileType());
+ }
+
@NotNull
public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
final String[] commands = createStartupCommand(chunk, compileContext, outputDir);
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/JavaCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/JavaCompiler.java
index ffa69c25927a..8384fbc0bb18 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/JavaCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/JavaCompiler.java
@@ -50,7 +50,11 @@ public class JavaCompiler implements TranslatingCompiler {
}
public boolean isCompilableFile(VirtualFile file, CompileContext context) {
- return getBackEndCompiler().getCompilableFileTypes().contains(file.getFileType());
+ final BackendCompiler backEndCompiler = getBackEndCompiler();
+ if (backEndCompiler instanceof ExternalCompiler) {
+ return ((ExternalCompiler)backEndCompiler).isCompilableFile(file, context);
+ }
+ return backEndCompiler.getCompilableFileTypes().contains(file.getFileType());
}
public void compile(CompileContext context, Chunk moduleChunk, VirtualFile[] files, OutputSink sink) {