summaryrefslogtreecommitdiff
path: root/java/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'java/compiler')
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java4
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java2
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java11
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java180
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java79
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java219
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java34
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java343
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java47
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java92
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java72
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java44
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java60
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java33
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java76
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java55
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java77
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java283
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java3
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java15
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java16
-rw-r--r--java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java2
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java86
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java103
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java52
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java30
-rw-r--r--java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java85
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java27
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java30
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java33
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java37
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java30
32 files changed, 85 insertions, 2175 deletions
diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
index 5cb7a2477315..ceebef6ac8f0 100644
--- a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
@@ -309,7 +309,9 @@ public class CompilerManagerImpl extends CompilerManager {
}
public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
- myEventPublisher.compilationFinished(aborted, errors, warnings, compileContext);
+ if (!myProject.isDisposed()) {
+ myEventPublisher.compilationFinished(aborted, errors, warnings, compileContext);
+ }
if (myDelegate != null) {
myDelegate.finished(aborted, errors, warnings, compileContext);
}
diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
index b8a27b7818dc..5a957a28c2d3 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
@@ -61,7 +61,7 @@ public class GenerateAntApplication {
GenerateAntApplication.LOG.error(e);
}
finally {
- application.exit(true);
+ application.exit(true, true);
}
}
});
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
index 46584ef9c8bf..406d16574955 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
@@ -176,17 +176,6 @@ public class CompileDriver {
}
}
- private static boolean containsFileIndexScopes(CompileScope scope) {
- if (scope instanceof CompositeScope) {
- for (CompileScope childScope : ((CompositeScope)scope).getScopes()) {
- if (containsFileIndexScopes(childScope)) {
- return true;
- }
- }
- }
- return scope instanceof FileIndexCompileScope;
- }
-
private void doRebuild(CompileStatusNotification callback, CompilerMessage message, final CompileScope compileScope) {
if (validateCompilerConfiguration(compileScope)) {
startup(compileScope, true, false, callback, message);
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java
index 9b227da1dbf8..67bdb5209f39 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java
@@ -20,36 +20,24 @@
*/
package com.intellij.compiler.impl;
-import com.intellij.CommonBundle;
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.RefreshQueue;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.util.ThrowableRunnable;
-import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.io.File;
-import java.io.FileFilter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
public class CompilerUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompilerUtil");
@@ -62,51 +50,6 @@ public class CompilerUtil {
return path;
}
- public static void collectFiles(Collection<File> container, File rootDir, FileFilter fileFilter) {
- final File[] files = rootDir.listFiles(fileFilter);
- if (files == null) {
- return;
- }
- for (File file : files) {
- if (file.isDirectory()) {
- collectFiles(container, file, fileFilter);
- }
- else {
- container.add(file);
- }
- }
- }
-
- public static Map<Module, List<VirtualFile>> buildModuleToFilesMap(CompileContext context, VirtualFile[] files) {
- return buildModuleToFilesMap(context, Arrays.asList(files));
- }
-
-
- public static Map<Module, List<VirtualFile>> buildModuleToFilesMap(final CompileContext context, final List<VirtualFile> files) {
- //assertion: all files are different
- final Map<Module, List<VirtualFile>> map = new THashMap<Module, List<VirtualFile>>();
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- public void run() {
- for (VirtualFile file : files) {
- final Module module = context.getModuleByFile(file);
-
- if (module == null) {
- continue; // looks like file invalidated
- }
-
- List<VirtualFile> moduleFiles = map.get(module);
- if (moduleFiles == null) {
- moduleFiles = new ArrayList<VirtualFile>();
- map.put(module, moduleFiles);
- }
- moduleFiles.add(file);
- }
- }
- });
- return map;
- }
-
-
/**
* must not be called inside ReadAction
* @param files
@@ -167,58 +110,6 @@ public class CompilerUtil {
}
}
- public static void addLocaleOptions(final List<String> commandLine, final boolean launcherUsed) {
- // need to specify default encoding so that javac outputs messages in 'correct' language
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-D" + CharsetToolkit.FILE_ENCODING_PROPERTY + "=" + CharsetToolkit.getDefaultSystemCharset().name());
- // javac's VM should use the same default locale that IDEA uses in order for javac to print messages in 'correct' language
- //noinspection HardCodedStringLiteral
- final String lang = System.getProperty("user.language");
- if (lang != null) {
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-Duser.language=" + lang);
- }
- //noinspection HardCodedStringLiteral
- final String country = System.getProperty("user.country");
- if (country != null) {
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-Duser.country=" + country);
- }
- //noinspection HardCodedStringLiteral
- final String region = System.getProperty("user.region");
- if (region != null) {
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-Duser.region=" + region);
- }
- }
-
- public static void addTargetCommandLineSwitch(final ModuleChunk chunk, final List<String> commandLine) {
- String optionValue = null;
- CompilerConfiguration config = null;
- final Module[] modules = chunk.getModules();
- for (Module module : modules) {
- if (config == null) {
- config = CompilerConfiguration.getInstance(module.getProject());
- }
- final String moduleTarget = config.getBytecodeTargetLevel(module);
- if (moduleTarget == null) {
- continue;
- }
- if (optionValue == null) {
- optionValue = moduleTarget;
- }
- else {
- if (moduleTarget.compareTo(optionValue) < 0) {
- optionValue = moduleTarget; // use the lower possible target among modules that form the chunk
- }
- }
- }
- if (optionValue != null) {
- commandLine.add("-target");
- commandLine.add(optionValue);
- }
- }
-
public static void addSourceCommandLineSwitch(final Sdk jdk, LanguageLevel chunkLanguageLevel, @NonNls final List<String> commandLine) {
final String versionString = jdk.getVersionString();
if (StringUtil.isEmpty(versionString)) {
@@ -312,67 +203,4 @@ public class CompilerUtil {
public static void logDuration(final String activityName, long duration) {
LOG.info(activityName + " took " + duration + " ms: " + duration /60000 + " min " +(duration %60000)/1000 + "sec");
}
-
- public static void clearOutputDirectories(final Collection<File> outputDirectories) {
- final long start = System.currentTimeMillis();
- // do not delete directories themselves, or we'll get rootsChanged() otherwise
- final Collection<File> filesToDelete = new ArrayList<File>(outputDirectories.size() * 2);
- for (File outputDirectory : outputDirectories) {
- File[] files = outputDirectory.listFiles();
- if (files != null) {
- ContainerUtil.addAll(filesToDelete, files);
- }
- }
- if (filesToDelete.size() > 0) {
- FileUtil.asyncDelete(filesToDelete);
-
- // ensure output directories exist
- for (final File file : outputDirectories) {
- file.mkdirs();
- }
- final long clearStop = System.currentTimeMillis();
-
- refreshIODirectories(outputDirectories);
-
- final long refreshStop = System.currentTimeMillis();
-
- logDuration("Clearing output dirs", clearStop - start);
- logDuration("Refreshing output directories", refreshStop - clearStop);
- }
- }
-
- public static void computeIntersectingPaths(final Project project,
- final Collection<VirtualFile> outputPaths,
- final Collection<VirtualFile> result) {
- for (Module module : ModuleManager.getInstance(project).getModules()) {
- final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
- final VirtualFile[] sourceRoots = rootManager.getSourceRoots();
- for (final VirtualFile outputPath : outputPaths) {
- for (VirtualFile sourceRoot : sourceRoots) {
- if (VfsUtilCore.isAncestor(outputPath, sourceRoot, true) || VfsUtilCore.isAncestor(sourceRoot, outputPath, false)) {
- result.add(outputPath);
- }
- }
- }
- }
- }
-
- public static boolean askUserToContinueWithNoClearing(Project project, Collection<VirtualFile> affectedOutputPaths) {
- final StringBuilder paths = new StringBuilder();
- for (final VirtualFile affectedOutputPath : affectedOutputPaths) {
- if (paths.length() > 0) {
- paths.append(",\n");
- }
- paths.append(affectedOutputPath.getPath().replace('/', File.separatorChar));
- }
- final int answer = Messages.showOkCancelDialog(project,
- CompilerBundle.message("warning.sources.under.output.paths", paths.toString()),
- CommonBundle.getErrorTitle(), Messages.getWarningIcon());
- if (answer == Messages.OK) { // ok
- return true;
- }
- else {
- return false;
- }
- }
}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java b/java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java
deleted file mode 100644
index 7914dc29c2c1..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl;
-
-import com.intellij.util.StringBuilderSpinAllocator;
-import com.intellij.util.containers.StringInterner;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Jun 21, 2006
- */
-public class InternedPath {
- private final @NotNull List<String> myValue;
-
- public InternedPath(StringInterner interner, String url, final char separator) {
- myValue = convert(interner, url, separator);
- }
-
- public String toString() {
- return join(myValue, '/');
- }
-
- public static List<String> convert(StringInterner interner, String value, char delim) {
- final List<String> result = new ArrayList<String>();
- int start = 0;
- final int len = value.length();
- for (int idx = 0; idx < len; idx++) {
- if (value.charAt(idx) == delim) {
- result.add(interner.intern(value.substring(start, idx)));
- start = idx + 1;
- }
- }
- if (start < value.length()) {
- result.add(interner.intern(value.substring(start)));
- }
- if (len > 0 && value.charAt(len-1) == delim) { // ends with delimiter
- result.add("");
- }
- return result;
- }
-
- public static String join(List<String> value, char separator) {
- final int size = value.size();
- if (size > 1) {
- final StringBuilder builder = StringBuilderSpinAllocator.alloc();
- try {
- builder.append(value.get(0));
- for (int idx = 1; idx < size; idx++) {
- builder.append(separator).append(value.get(idx));
- }
- return builder.toString();
- }
- finally {
- StringBuilderSpinAllocator.dispose(builder);
- }
- }
- else if (size == 1){
- return value.get(0);
- }
- return "";
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java b/java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java
deleted file mode 100644
index 6a712d131711..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.io.FileUtil;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Apr 6, 2009
- */
-public class OutputPathFinder {
- private final Node myRoot = new Node("");
-
- public OutputPathFinder(Set<File> outputDirs) {
- for (File dir : outputDirs) {
- final String path = FileUtil.toSystemIndependentName(dir.getPath());
- Node node = myRoot;
- int idx = path.startsWith("/")? 1 : 0;
- int slashIndex = path.indexOf('/', idx);
-
- for (; slashIndex >= 0; slashIndex = path.indexOf('/', idx)) {
- final String name = path.substring(idx, slashIndex);
- node = node.addChild(name);
- idx = slashIndex + 1;
- }
-
- if (idx < path.length()) {
- node = node.addChild(path.substring(idx));
- }
-
- node.setData(path);
- }
- }
-
- @Nullable
- public String lookupOutputPath(File outputFile) {
- return lookupOutputPath(outputFile.getPath());
- }
-
- @Nullable
- public String lookupOutputPath(String filePath) {
- final String path = FileUtil.toSystemIndependentName(filePath);
- Node node = myRoot;
- int idx = path.startsWith("/")? 1 : 0;
-
- return findOutputPath(path, idx, node);
- }
-
- private static @Nullable String findOutputPath(final String path, int idx, Node node) {
- while (true) {
- final int slashIndex = path.indexOf('/', idx);
- final String name = slashIndex < idx? path.substring(idx) : path.substring(idx, slashIndex);
- node = node.getChild(name);
- if (node == null) {
- return null;
- }
- if (node.isOutputRoot()) {
- if (node.hasChildren() && slashIndex > idx) {
- final String candidate = findOutputPath(path, slashIndex + 1, node);
- if (candidate != null) {
- return candidate;
- }
- }
- return node.getData();
- }
- if (slashIndex < 0) {
- return null; // end of path reached
- }
- idx = slashIndex + 1;
- }
- }
-
- private static class Node {
- private final String myName;
- @Nullable
- private Object myChildren; // either a Node or a Map<String, Node> or a String or a Pair<String, Node or NodeMap>
-
- private Node(String name) {
- myName = name;
- }
-
- public String getName() {
- return myName;
- }
-
- public boolean isOutputRoot() {
- return myChildren instanceof String || myChildren instanceof Pair;
- }
-
- public boolean hasChildren() {
- return myChildren instanceof Map || myChildren instanceof Pair;
- }
-
- @Nullable
- public String getData() {
- if (myChildren instanceof String) {
- return (String)myChildren;
- }
- if (myChildren instanceof Pair) {
- //noinspection unchecked
- return (String)((Pair)myChildren).first;
- }
- return null;
- }
-
- public void setData(String path) {
- if (myChildren != null) {
- if (myChildren instanceof String) {
- myChildren = path;
- }
- else {
- myChildren = new Pair(path, myChildren instanceof Pair? ((Pair)myChildren).second : myChildren);
- }
- }
- else {
- myChildren = path;
- }
- }
-
- public Node addChild(String childName) {
- if (myChildren == null) {
- final Node node = new Node(childName);
- myChildren = node;
- return node;
- }
- if (myChildren instanceof String) {
- final Node node = new Node(childName);
- myChildren = new Pair(myChildren, node);
- return node;
- }
-
- final Map<String, Node> map;
- if (myChildren instanceof Map) {
- map = (Map<String, Node>)myChildren;
- }
- else if (myChildren instanceof Node) {
- final Node existingChild = (Node)myChildren;
- myChildren = map = new HashMap<String, Node>();
- map.put(existingChild.getName(), existingChild);
- }
- else { // myChildren is a Pair
- Object children = ((Pair)myChildren).second;
- if (children instanceof Map) {
- map = (Map<String, Node>)children;
- }
- else {
- final Node existingChild = (Node)children;
- myChildren = new Pair(((Pair)myChildren).first, map = new HashMap<String, Node>());
- map.put(existingChild.getName(), existingChild);
- }
- }
-
- Node node = map.get(childName);
- if (node == null) {
- map.put(childName, node = new Node(childName));
- }
- return node;
- }
-
- @Nullable
- public Node getChild(String childName) {
- final Object children = myChildren instanceof Pair? ((Pair)myChildren).second : myChildren;
- if (children instanceof Node) {
- final Node childNode = (Node)children;
- return childName.equals(childNode.getName())? childNode : null;
- }
- if (children instanceof Map) {
- return ((Map<String, Node>)myChildren).get(childName);
- }
- return null;
- }
- }
-
-
- public static void main(String[] args) {
- final Set<File> set = new HashSet<File>();
- set.add(new File("/a/b/c"));
- set.add(new File("a/b/d"));
- set.add(new File("a/b/e"));
- set.add(new File("/a/b/f/g"));
- set.add(new File("/a/b/f/g/zzz"));
-
- final OutputPathFinder finder = new OutputPathFinder(set);
-
- System.out.println(finder.lookupOutputPath(new File("a/b")));
- System.out.println(finder.lookupOutputPath(new File("a/b/c/dir1/dir2/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/d/dir1/dir2/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/jjjjj/dir1/dir2/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/e/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/File.class")));
-
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/File.class")));
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/ttt/yy/File.class")));
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/zzz/File.class")));
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/zzz/mmm/ttt/File.class")));
-
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java b/java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java
deleted file mode 100644
index d2f7826a1704..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.PackagingCompiler;
-import com.intellij.openapi.compiler.ValidityState;
-import org.jetbrains.annotations.Nullable;
-
-public class PackagingCompilerAdapter extends FileProcessingCompilerAdapter{
- private final PackagingCompiler myCompiler;
-
- public PackagingCompilerAdapter(CompileContext compileContext, PackagingCompiler compiler) {
- super(compileContext, compiler);
- myCompiler = compiler;
- }
-
- public void processOutdatedItem(CompileContext context, String url, @Nullable ValidityState state) {
- myCompiler.processOutdatedItem(context, url, state);
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java
deleted file mode 100644
index 513c5dad5102..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl.javaCompiler;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.JdkOrderEntry;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.OrderEntry;
-import com.intellij.openapi.roots.OrderEnumerator;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.util.Chunk;
-import com.intellij.util.PathsList;
-import com.intellij.util.StringBuilderSpinAllocator;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.OrderedSet;
-import gnu.trove.THashMap;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.util.*;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Sep 29, 2004
- */
-public class ModuleChunk extends Chunk<Module> {
- private final CompileContextEx myContext;
- private final Map<Module, List<VirtualFile>> myModuleToFilesMap = new THashMap<Module, List<VirtualFile>>();
- private final Map<VirtualFile, VirtualFile> myTransformedToOriginalMap = new THashMap<VirtualFile, VirtualFile>();
- private int mySourcesFilter = ALL_SOURCES;
-
- public ModuleChunk(CompileContextEx context, Chunk<Module> chunk, Map<Module, List<VirtualFile>> moduleToFilesMap) {
- super(chunk.getNodes());
- myContext = context;
- for (final Module module : chunk.getNodes()) {
- final List<VirtualFile> files = moduleToFilesMap.get(module);
- // Important!!! Collections in the myModuleToFilesMap must be modifiable copies of the corresponding collections
- // from the moduleToFilesMap. This is needed to support SourceTransforming compilers
- myModuleToFilesMap.put(module, files == null ? Collections.<VirtualFile>emptyList() : new ArrayList<VirtualFile>(files));
- }
- }
-
- public static final int SOURCES = 0x1;
- public static final int TEST_SOURCES = 0x2;
- public static final int ALL_SOURCES = SOURCES | TEST_SOURCES;
-
- public void setSourcesFilter(int filter) {
- mySourcesFilter = filter;
- }
-
- public int getSourcesFilter() {
- return mySourcesFilter;
- }
-
- public void substituteWithTransformedVersion(Module module, int fileIndex, VirtualFile transformedFile) {
- final List<VirtualFile> moduleFiles = getFilesToCompile(module);
- final VirtualFile currentFile = moduleFiles.get(fileIndex);
- moduleFiles.set(fileIndex, transformedFile);
- VirtualFile originalFile = myTransformedToOriginalMap.remove(currentFile);
- if (originalFile == null) {
- originalFile = currentFile;
- }
- myTransformedToOriginalMap.put(transformedFile, originalFile);
- }
-
- public VirtualFile getOriginalFile(VirtualFile file) {
- final VirtualFile original = myTransformedToOriginalMap.get(file);
- return original != null? original : file;
- }
-
- @NotNull
- public List<VirtualFile> getFilesToCompile(Module forModule) {
- return myModuleToFilesMap.get(forModule);
- }
-
- @NotNull
- public List<VirtualFile> getFilesToCompile() {
- if (getModuleCount() == 0) {
- return Collections.emptyList();
- }
- final Set<Module> modules = getNodes();
-
- final List<VirtualFile> filesToCompile = new ArrayList<VirtualFile>();
- for (final Module module : modules) {
- final List<VirtualFile> moduleCompilableFiles = getFilesToCompile(module);
- if (mySourcesFilter == ALL_SOURCES) {
- filesToCompile.addAll(moduleCompilableFiles);
- }
- else {
- for (final VirtualFile file : moduleCompilableFiles) {
- VirtualFile originalFile = myTransformedToOriginalMap.get(file);
- if (originalFile == null) {
- originalFile = file;
- }
- if (mySourcesFilter == TEST_SOURCES) {
- if (myContext.isInTestSourceContent(originalFile)) {
- filesToCompile.add(file);
- }
- }
- else {
- if (!myContext.isInTestSourceContent(originalFile)) {
- filesToCompile.add(file);
- }
- }
- }
- }
- }
- return filesToCompile;
- }
-
- /**
- * @return the jdk. Assumes that the jdk is the same for all modules
- */
- public Sdk getJdk() {
- final Module module = getNodes().iterator().next();
- return ModuleRootManager.getInstance(module).getSdk();
- }
-
- public VirtualFile[] getSourceRoots() {
- return getSourceRoots(mySourcesFilter);
- }
-
- private VirtualFile[] getSourceRoots(final int sourcesFilter) {
- return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
- public VirtualFile[] compute() {
- return filterRoots(getAllSourceRoots(), getNodes().iterator().next().getProject(), sourcesFilter);
- }
- });
- }
-
- public VirtualFile[] getSourceRoots(final Module module) {
- if (!getNodes().contains(module)) {
- return VirtualFile.EMPTY_ARRAY;
- }
- return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
- public VirtualFile[] compute() {
- return filterRoots(myContext.getSourceRoots(module), module.getProject(), mySourcesFilter);
- }
- });
- }
-
- private VirtualFile[] filterRoots(VirtualFile[] roots, Project project, final int sourcesFilter) {
- final List<VirtualFile> filteredRoots = new ArrayList<VirtualFile>(roots.length);
- final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
- for (final VirtualFile root : roots) {
- if (sourcesFilter != ALL_SOURCES) {
- if (myContext.isInTestSourceContent(root)) {
- if ((sourcesFilter & TEST_SOURCES) == 0) {
- continue;
- }
- }
- else {
- if ((sourcesFilter & SOURCES) == 0) {
- continue;
- }
- }
- }
- if (compilerConfiguration.isExcludedFromCompilation(root)) {
- continue;
- }
- filteredRoots.add(root);
- }
- return VfsUtil.toVirtualFileArray(filteredRoots);
- }
-
- private VirtualFile[] getAllSourceRoots() {
- final Set<Module> modules = getNodes();
- Set<VirtualFile> roots = new HashSet<VirtualFile>();
- for (final Module module : modules) {
- ContainerUtil.addAll(roots, myContext.getSourceRoots(module));
- }
- return VfsUtil.toVirtualFileArray(roots);
- }
-
- public String getCompilationClasspath() {
- final OrderedSet<VirtualFile> cpFiles = getCompilationClasspathFiles();
- return convertToStringPath(cpFiles);
-
- }
-
- public OrderedSet<VirtualFile> getCompilationClasspathFiles() {
- return getCompilationClasspathFiles(true);
- }
-
- public OrderedSet<VirtualFile> getCompilationClasspathFiles(final boolean exportedOnly) {
- final Set<Module> modules = getNodes();
-
- OrderedSet<VirtualFile> cpFiles = new OrderedSet<VirtualFile>();
- for (final Module module : modules) {
- Collections.addAll(cpFiles, orderEnumerator(module, exportedOnly, new AfterJdkOrderEntryCondition()).getClassesRoots());
- }
- return cpFiles;
- }
-
- private OrderEnumerator orderEnumerator(Module module, boolean exportedOnly, Condition<OrderEntry> condition) {
- OrderEnumerator enumerator = OrderEnumerator.orderEntries(module).compileOnly().satisfying(condition);
- if ((mySourcesFilter & TEST_SOURCES) == 0) {
- enumerator = enumerator.productionOnly();
- }
- enumerator = enumerator.recursively();
- return exportedOnly ? enumerator.exportedOnly() : enumerator;
- }
-
- public String getCompilationBootClasspath() {
- return convertToStringPath(getCompilationBootClasspathFiles());
- }
-
- public OrderedSet<VirtualFile> getCompilationBootClasspathFiles() {
- return getCompilationBootClasspathFiles(true);
- }
-
- public OrderedSet<VirtualFile> getCompilationBootClasspathFiles(final boolean exportedOnly) {
- final Set<Module> modules = getNodes();
- final OrderedSet<VirtualFile> cpFiles = new OrderedSet<VirtualFile>();
- final OrderedSet<VirtualFile> jdkFiles = new OrderedSet<VirtualFile>();
- for (final Module module : modules) {
- Collections.addAll(cpFiles, orderEnumerator(module, exportedOnly, new BeforeJdkOrderEntryCondition(module)).getClassesRoots());
- Collections.addAll(jdkFiles, OrderEnumerator.orderEntries(module).sdkOnly().getClassesRoots());
- }
- cpFiles.addAll(jdkFiles);
- return cpFiles;
- }
-
- private static String convertToStringPath(final OrderedSet<VirtualFile> cpFiles) {
- PathsList classpath = new PathsList();
- classpath.addVirtualFiles(cpFiles);
- return classpath.getPathsString();
- }
-
- //private String tryZipFor(String outputDir) {
- // final File zip = CompilerPathsEx.getZippedOutputPath(myContext.getProject(), outputDir);
- // if (zip.exists()) {
- // try {
- // myContext.commitZip(outputDir); // flush unsaved data if any
- // }
- // catch (IOException e) {
- // LOG.info(e);
- // }
- // return zip.getPath();
- // }
- // return outputDir;
- //}
-
- public int getModuleCount() {
- return getNodes().size();
- }
-
- public Module[] getModules() {
- final Set<Module> nodes = getNodes();
- return nodes.toArray(new Module[nodes.size()]);
- }
-
- public String getSourcePath() {
- return getSourcePath(mySourcesFilter);
- }
-
- public String getSourcePath(final int sourcesFilter) {
- if (getModuleCount() == 0) {
- return "";
- }
- final VirtualFile[] filteredRoots = getSourceRoots(sourcesFilter);
- final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
- try {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- public void run() {
- for (VirtualFile root : filteredRoots) {
- if (buffer.length() > 0) {
- buffer.append(File.pathSeparatorChar);
- }
- buffer.append(root.getPath().replace('/', File.separatorChar));
- }
- }
- });
- return buffer.toString();
- }
- finally {
- StringBuilderSpinAllocator.dispose(buffer);
- }
- }
-
- //the check for equal language levels is done elsewhere
- public LanguageLevel getLanguageLevel() {
- return EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(getNodes().iterator().next());
- }
-
- public Project getProject() {
- return myContext.getProject();
- }
-
- private static class BeforeJdkOrderEntryCondition implements Condition<OrderEntry> {
- private boolean myJdkFound;
- private final Module myOwnerModule;
-
- private BeforeJdkOrderEntryCondition(Module ownerModule) {
- myOwnerModule = ownerModule;
- }
-
- @Override
- public boolean value(OrderEntry orderEntry) {
- if (orderEntry instanceof JdkOrderEntry && myOwnerModule.equals(orderEntry.getOwnerModule())) {
- myJdkFound = true;
- }
- return !myJdkFound;
- }
- }
-
- private static class AfterJdkOrderEntryCondition implements Condition<OrderEntry> {
- private boolean myJdkFound;
-
- @Override
- public boolean value(OrderEntry orderEntry) {
- if (orderEntry instanceof JdkOrderEntry) {
- myJdkFound = true;
- return false;
- }
- return myJdkFound;
- }
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java
deleted file mode 100644
index 7748223d0eac..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2000-2012 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl.javaCompiler.eclipse;
-
-import com.intellij.compiler.impl.javaCompiler.javac.JavacSettingsBuilder;
-import com.intellij.openapi.module.Module;
-import com.intellij.util.Chunk;
-import org.jetbrains.jps.model.java.compiler.EclipseCompilerOptions;
-
-import java.util.Collection;
-
-/**
- * @author Eugene Zhuravlev
- * Date: 9/27/12
- */
-public class EclipseSettingsBuilder extends JavacSettingsBuilder {
- public EclipseSettingsBuilder(final EclipseCompilerOptions options) {
- super(options);
- }
-
- @Override
- public EclipseCompilerOptions getOptions() {
- return (EclipseCompilerOptions)super.getOptions();
- }
-
- @Override
- public Collection<String> getOptions(Chunk<Module> chunk) {
- final Collection<String> options = super.getOptions(chunk);
- if (getOptions().PROCEED_ON_ERROR) {
- options.add("-proceedOnError");
- }
- return options;
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java
deleted file mode 100644
index 7be8e1da9fd4..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl.javaCompiler.javac;
-
-import com.intellij.compiler.CompilerEncodingService;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.openapi.module.Module;
-import com.intellij.util.Chunk;
-import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions;
-
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.StringTokenizer;
-
-public class JavacSettingsBuilder {
- private final JpsJavaCompilerOptions myOptions;
-
- public JavacSettingsBuilder(JpsJavaCompilerOptions options) {
- myOptions = options;
- }
-
- protected JpsJavaCompilerOptions getOptions() {
- return myOptions;
- }
-
- public Collection<String> getOptions(Chunk<Module> chunk) {
- List<String> options = new ArrayList<String>();
- if (getOptions().DEBUGGING_INFO) {
- options.add("-g");
- }
- if (getOptions().DEPRECATION) {
- options.add("-deprecation");
- }
- if (getOptions().GENERATE_NO_WARNINGS) {
- options.add("-nowarn");
- }
- boolean isEncodingSet = false;
- final StringTokenizer tokenizer = new StringTokenizer(getOptions().ADDITIONAL_OPTIONS_STRING, " \t\r\n");
- while(tokenizer.hasMoreTokens()) {
- final String token = tokenizer.nextToken();
- if(!acceptUserOption(token)) {
- continue;
- }
- options.add(token);
- if ("-encoding".equals(token)) {
- isEncodingSet = true;
- }
- }
- if (!isEncodingSet && acceptEncoding()) {
- final Charset charset = CompilerEncodingService.getPreferredModuleEncoding(chunk);
- if (charset != null) {
- options.add("-encoding");
- options.add(charset.name());
- }
- }
- return options;
- }
-
- protected boolean acceptUserOption(String token) {
- return !("-g".equals(token) || "-deprecation".equals(token) || "-nowarn".equals(token));
- }
-
- protected boolean acceptEncoding() {
- return true;
- }
-
- public String getOptionsString(final ModuleChunk chunk) {
- final StringBuilder options = new StringBuilder();
- for (String option : getOptions(chunk)) {
- if (options.length() > 0) {
- options.append(" ");
- }
- options.append(option);
- }
- return options.toString();
- }
-} \ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java
deleted file mode 100644
index 446dd2e37b28..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @author cdr
- */
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.compiler.make.BuildInstruction;
-import com.intellij.openapi.util.UserDataHolderBase;
-import com.intellij.openapi.util.io.FileUtil;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.NonNls;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-
-public abstract class BuildInstructionBase extends UserDataHolderBase implements BuildInstruction, Cloneable {
- private final String myOutputRelativePath;
- private Collection<File> myFilesToDelete;
-
- protected BuildInstructionBase(String outputRelativePath) {
- myOutputRelativePath = outputRelativePath;
- }
-
- public String getOutputRelativePath() {
- return myOutputRelativePath;
- }
-
- public BuildInstructionBase clone() {
- return (BuildInstructionBase)super.clone();
- }
-
- public void addFileToDelete(File file) {
- if (myFilesToDelete == null) {
- myFilesToDelete = new THashSet<File>();
- }
- myFilesToDelete.add(file);
- }
-
- public void collectFilesToDelete(Collection<File> filesToDelete) {
- if (myFilesToDelete != null) {
- filesToDelete.addAll(myFilesToDelete);
- }
- myFilesToDelete = null;
- }
-
- @NonNls
- public String toString() {
- return super.toString();
- }
-
- protected File createTempFile(final String prefix, final String suffix) throws IOException {
- final File tempFile = FileUtil.createTempFile(prefix + "___", suffix);
- addFileToDelete(tempFile);
- return tempFile;
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java
deleted file mode 100644
index 9fa4e2c63de9..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.util.Pair;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author nik
- */
-public class DependentJarsEvaluator {
- private final Set<JarInfo> myJars = new LinkedHashSet<JarInfo>();
-
- public void addJarWithDependencies(final JarInfo jarInfo) {
- if (myJars.add(jarInfo)) {
- for (JarDestinationInfo destination : jarInfo.getJarDestinations()) {
- addJarWithDependencies(destination.getJarInfo());
- }
- for (Pair<String, JarInfo> pair : jarInfo.getPackedJars()) {
- addJarWithDependencies(pair.getSecond());
- }
- }
- }
-
- public Set<JarInfo> getJars() {
- return myJars;
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java
deleted file mode 100644
index abda98227402..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author nik
- */
-public abstract class DestinationInfo {
- private VirtualFile myOutputFile;
- private final String myOutputPath;
- private final String myOutputFilePath;
-
- protected DestinationInfo(@NotNull final String outputPath, @Nullable final VirtualFile outputFile, @NotNull String outputFilePath) {
- myOutputFilePath = outputFilePath;
- myOutputFile = outputFile;
- myOutputPath = outputPath;
- }
-
- @NotNull
- public String getOutputPath() {
- return myOutputPath;
- }
-
- @Nullable
- public VirtualFile getOutputFile() {
- return myOutputFile;
- }
-
- @NotNull
- public String getOutputFilePath() {
- return myOutputFilePath;
- }
-
- public void update() {
- if (myOutputFile != null && !myOutputFile.isValid()) {
- myOutputFile = null;
- }
- if (myOutputFile == null) {
- myOutputFile = LocalFileSystem.getInstance().findFileByPath(myOutputFilePath);
- }
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java
deleted file mode 100644
index 33a3a8e8da11..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author nik
- */
-public class ExplodedDestinationInfo extends DestinationInfo {
- public ExplodedDestinationInfo(final String outputPath, @Nullable final VirtualFile outputFile) {
- super(outputPath, outputFile, outputPath);
- }
-
- public String toString() {
- return getOutputPath();
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java
deleted file mode 100644
index 64b58555f151..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.compiler.make.BuildInstructionVisitor;
-import com.intellij.openapi.compiler.make.FileCopyInstruction;
-import com.intellij.openapi.util.io.FileUtil;
-
-import java.io.File;
-
-public class FileCopyInstructionImpl extends BuildInstructionBase implements FileCopyInstruction {
- private File myFile;
- private boolean myIsDirectory;
-
- public FileCopyInstructionImpl(File source, boolean isDirectory, String outputRelativePath) {
- super(outputRelativePath);
- setFile(source, isDirectory);
- }
-
- public boolean accept(BuildInstructionVisitor visitor) throws Exception {
- return visitor.visitFileCopyInstruction(this);
- }
-
- public String toString() {
- return "Copy " + getFile() + "->" + getOutputRelativePath();
- }
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof FileCopyInstruction)) return false;
-
- final FileCopyInstruction item = (FileCopyInstruction) o;
-
- if (getFile() != null ? !FileUtil.filesEqual(getFile(), item.getFile()) : item.getFile() != null) return false;
-
- if (getOutputRelativePath() != null) {
- if (!getOutputRelativePath().equals( item.getOutputRelativePath() )) return false;
- } else if ( item.getOutputRelativePath() != null ) {
- return false;
- }
-
- return true;
- }
-
- public int hashCode() {
- return (getFile() != null ? getFile().hashCode() : 0) +
- (getOutputRelativePath() != null ? getOutputRelativePath().hashCode():0);
- }
-
- public File getFile() {
- return myFile;
- }
-
- public boolean isDirectory() {
- return myIsDirectory;
- }
-
- private void setFile(File file, boolean isDirectory) {
- myFile = file;
- myIsDirectory = isDirectory;
- }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java
deleted file mode 100644
index 5cc45c19278e..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-
-/**
- * @author nik
- */
-public class JarDestinationInfo extends DestinationInfo {
- private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.packagingCompiler.JarDestinationInfo");
- private final String myPathInJar;
- private final JarInfo myJarInfo;
-
- public JarDestinationInfo(final String pathInJar, final JarInfo jarInfo, DestinationInfo jarDestination) {
- super(appendPathInJar(jarDestination.getOutputPath(), pathInJar), jarDestination.getOutputFile(), jarDestination.getOutputFilePath());
- LOG.assertTrue(!pathInJar.startsWith(".."), pathInJar);
- myPathInJar = StringUtil.startsWithChar(pathInJar, '/') ? pathInJar : "/" + pathInJar;
- myJarInfo = jarInfo;
- }
-
- private static String appendPathInJar(String outputPath, String pathInJar) {
- LOG.assertTrue(outputPath.length() > 0 && outputPath.charAt(outputPath.length() - 1) != '/');
- LOG.assertTrue(pathInJar.length() > 0 && pathInJar.charAt(0) != '/');
- return outputPath + JarFileSystem.JAR_SEPARATOR + pathInJar;
- }
-
- public String getPathInJar() {
- return myPathInJar;
- }
-
- public JarInfo getJarInfo() {
- return myJarInfo;
- }
-
- public String toString() {
- return myPathInJar + "(" + getOutputPath() + ")";
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java
deleted file mode 100644
index 7626ca13469b..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.vfs.VirtualFile;
-
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-/**
- * @author nik
- */
-public class JarInfo {
- private final List<Pair<String, VirtualFile>> myPackedFiles;
- private final LinkedHashSet<Pair<String, JarInfo>> myPackedJars;
- private final List<DestinationInfo> myDestinations;
-
- public JarInfo() {
- myDestinations = new ArrayList<DestinationInfo>();
- myPackedFiles = new ArrayList<Pair<String, VirtualFile>>();
- myPackedJars = new LinkedHashSet<Pair<String, JarInfo>>();
- }
-
- public void addDestination(DestinationInfo info) {
- myDestinations.add(info);
- if (info instanceof JarDestinationInfo) {
- JarDestinationInfo destinationInfo = (JarDestinationInfo)info;
- destinationInfo.getJarInfo().myPackedJars.add(Pair.create(destinationInfo.getPathInJar(), this));
- }
- }
-
- public void addContent(String pathInJar, VirtualFile sourceFile) {
- myPackedFiles.add(Pair.create(pathInJar, sourceFile));
- }
-
- public List<Pair<String, VirtualFile>> getPackedFiles() {
- return myPackedFiles;
- }
-
- public LinkedHashSet<Pair<String, JarInfo>> getPackedJars() {
- return myPackedJars;
- }
-
- public List<JarDestinationInfo> getJarDestinations() {
- final ArrayList<JarDestinationInfo> list = new ArrayList<JarDestinationInfo>();
- for (DestinationInfo destination : myDestinations) {
- if (destination instanceof JarDestinationInfo) {
- list.add((JarDestinationInfo)destination);
- }
- }
- return list;
- }
-
- public List<DestinationInfo> getAllDestinations() {
- return myDestinations;
- }
-
- public String getPresentableDestination() {
- return !myDestinations.isEmpty() ? myDestinations.get(0).getOutputPath() : "";
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java
deleted file mode 100644
index c543abe674cc..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.deployment.DeploymentUtil;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Couple;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.graph.CachingSemiGraph;
-import com.intellij.util.graph.DFSTBuilder;
-import com.intellij.util.graph.GraphGenerator;
-import com.intellij.util.io.ZipUtil;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-/**
- * @author nik
- */
-public class JarsBuilder {
- private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.packagingCompiler.JarsBuilder");
- private final Set<JarInfo> myJarsToBuild;
- private final FileFilter myFileFilter;
- private final CompileContext myContext;
- private Map<JarInfo, File> myBuiltJars;
-
- public JarsBuilder(Set<JarInfo> jarsToBuild, FileFilter fileFilter, CompileContext context) {
- DependentJarsEvaluator evaluator = new DependentJarsEvaluator();
- for (JarInfo jarInfo : jarsToBuild) {
- evaluator.addJarWithDependencies(jarInfo);
- }
- myJarsToBuild = evaluator.getJars();
- myFileFilter = fileFilter;
- myContext = context;
- }
-
- public boolean buildJars(Set<String> writtenPaths) throws IOException {
- myContext.getProgressIndicator().setText(CompilerBundle.message("packaging.compiler.message.building.archives"));
-
- final JarInfo[] sortedJars = sortJars();
- if (sortedJars == null) {
- return false;
- }
-
- myBuiltJars = new HashMap<JarInfo, File>();
- try {
- for (JarInfo jar : sortedJars) {
- myContext.getProgressIndicator().checkCanceled();
- buildJar(jar);
- }
-
- myContext.getProgressIndicator().setText(CompilerBundle.message("packaging.compiler.message.copying.archives"));
- copyJars(writtenPaths);
- }
- finally {
- deleteTemporaryJars();
- }
-
-
- return true;
- }
-
- private void deleteTemporaryJars() {
- for (File file : myBuiltJars.values()) {
- FileUtil.delete(file);
- }
- }
-
- private void copyJars(final Set<String> writtenPaths) throws IOException {
- for (Map.Entry<JarInfo, File> entry : myBuiltJars.entrySet()) {
- File fromFile = entry.getValue();
- boolean first = true;
- for (DestinationInfo destination : entry.getKey().getAllDestinations()) {
- if (destination instanceof ExplodedDestinationInfo) {
- File toFile = new File(FileUtil.toSystemDependentName(destination.getOutputPath()));
-
- if (first) {
- first = false;
- renameFile(fromFile, toFile, writtenPaths);
- fromFile = toFile;
- }
- else {
- DeploymentUtil.getInstance().copyFile(fromFile, toFile, myContext, writtenPaths, myFileFilter);
- }
-
- }
- }
- }
- }
-
- private static void renameFile(final File fromFile, final File toFile, final Set<String> writtenPaths) throws IOException {
- FileUtil.rename(fromFile, toFile);
- writtenPaths.add(toFile.getPath());
- }
-
- @Nullable
- private JarInfo[] sortJars() {
- final DFSTBuilder<JarInfo> builder = new DFSTBuilder<JarInfo>(GraphGenerator.create(CachingSemiGraph.create(new JarsGraph())));
- if (!builder.isAcyclic()) {
- final Couple<JarInfo> dependency = builder.getCircularDependency();
- String message = CompilerBundle.message("packaging.compiler.error.cannot.build.circular.dependency.found.between.0.and.1",
- dependency.getFirst().getPresentableDestination(),
- dependency.getSecond().getPresentableDestination());
- myContext.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
- return null;
- }
-
- JarInfo[] jars = myJarsToBuild.toArray(new JarInfo[myJarsToBuild.size()]);
- Arrays.sort(jars, builder.comparator());
- jars = ArrayUtil.reverseArray(jars);
- return jars;
- }
-
- public Set<JarInfo> getJarsToBuild() {
- return myJarsToBuild;
- }
-
- private void buildJar(final JarInfo jar) throws IOException {
- if (jar.getPackedFiles().isEmpty() && jar.getPackedJars().isEmpty()) {
- myContext.addMessage(CompilerMessageCategory.WARNING, "Archive '" + jar.getPresentableDestination() + "' has no files so it won't be created", null, -1, -1);
- return;
- }
-
- myContext.getProgressIndicator()
- .setText(CompilerBundle.message("packaging.compiler.message.building.0", jar.getPresentableDestination()));
- File jarFile = FileUtil.createTempFile("artifactCompiler", "tmp");
- myBuiltJars.put(jar, jarFile);
-
- FileUtil.createParentDirs(jarFile);
-
- VirtualFile manifestFile = null;
- for (Pair<String, VirtualFile> pair : jar.getPackedFiles()) {
- if (pair.getFirst().equals(JarFile.MANIFEST_NAME)) {
- manifestFile = pair.getSecond();
- }
- }
- final JarOutputStream jarOutputStream = createJarOutputStream(jarFile, manifestFile);
-
- try {
- final THashSet<String> writtenPaths = new THashSet<String>();
- for (Pair<String, VirtualFile> pair : jar.getPackedFiles()) {
- if (pair.getFirst().equals(JarFile.MANIFEST_NAME)) continue;
- final VirtualFile sourceFile = pair.getSecond();
- if (sourceFile.isInLocalFileSystem()) {
- File file = VfsUtil.virtualToIoFile(sourceFile);
- addFileToJar(jarOutputStream, file, pair.getFirst(), writtenPaths);
- }
- else {
- extractFileAndAddToJar(jarOutputStream, sourceFile, pair.getFirst(), writtenPaths);
- }
- }
-
- for (Pair<String, JarInfo> nestedJar : jar.getPackedJars()) {
- File nestedJarFile = myBuiltJars.get(nestedJar.getSecond());
- if (nestedJarFile != null) {
- addFileToJar(jarOutputStream, nestedJarFile, nestedJar.getFirst(), writtenPaths);
- }
- else {
- LOG.debug("nested jar file " + nestedJar.getFirst() + " for " + jar.getPresentableDestination() + " not found");
- }
- }
- }
- finally {
- jarOutputStream.close();
- }
- }
-
- private static JarOutputStream createJarOutputStream(File jarFile, VirtualFile manifestFile) throws IOException {
- final BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(jarFile));
- final JarOutputStream jarOutputStream;
- if (manifestFile != null) {
- final InputStream manifestStream = manifestFile.getInputStream();
- try {
- jarOutputStream = new JarOutputStream(outputStream, new Manifest(manifestStream));
- }
- finally {
- manifestStream.close();
- }
- }
- else {
- jarOutputStream = new JarOutputStream(outputStream);
- }
- return jarOutputStream;
- }
-
- private void extractFileAndAddToJar(JarOutputStream jarOutputStream, VirtualFile sourceFile, String relativePath, THashSet<String> writtenPaths)
- throws IOException {
- relativePath = addParentDirectories(jarOutputStream, writtenPaths, relativePath);
- myContext.getProgressIndicator().setText2(relativePath);
- if (!writtenPaths.add(relativePath)) return;
-
- final BufferedInputStream input = ArtifactCompilerUtil.getJarEntryInputStream(sourceFile, myContext);
- if (input == null) return;
-
- ZipEntry entry = new ZipEntry(relativePath);
- entry.setTime(ArtifactCompilerUtil.getJarFile(sourceFile).lastModified());
- jarOutputStream.putNextEntry(entry);
- FileUtil.copy(input, jarOutputStream);
- jarOutputStream.closeEntry();
- }
-
- private void addFileToJar(final @NotNull JarOutputStream jarOutputStream, final @NotNull File file, @NotNull String relativePath,
- final @NotNull THashSet<String> writtenPaths) throws IOException {
- if (!file.exists()) {
- return;
- }
-
- relativePath = addParentDirectories(jarOutputStream, writtenPaths, relativePath);
- myContext.getProgressIndicator().setText2(relativePath);
- ZipUtil.addFileToZip(jarOutputStream, file, relativePath, writtenPaths, myFileFilter);
- }
-
- private static String addParentDirectories(JarOutputStream jarOutputStream, THashSet<String> writtenPaths, String relativePath) throws IOException {
- while (StringUtil.startsWithChar(relativePath, '/')) {
- relativePath = relativePath.substring(1);
- }
- int i = relativePath.indexOf('/');
- while (i != -1) {
- String prefix = relativePath.substring(0, i+1);
- if (!writtenPaths.contains(prefix) && prefix.length() > 1) {
- addEntry(jarOutputStream, prefix);
- writtenPaths.add(prefix);
- }
- i = relativePath.indexOf('/', i + 1);
- }
- return relativePath;
- }
-
- private static void addEntry(final ZipOutputStream output, @NonNls final String relativePath) throws IOException {
- ZipEntry e = new ZipEntry(relativePath);
- e.setMethod(ZipEntry.STORED);
- e.setSize(0);
- e.setCrc(0);
- output.putNextEntry(e);
- output.closeEntry();
- }
-
- private class JarsGraph implements GraphGenerator.SemiGraph<JarInfo> {
- public Collection<JarInfo> getNodes() {
- return myJarsToBuild;
- }
-
- public Iterator<JarInfo> getIn(final JarInfo n) {
- Set<JarInfo> ins = new HashSet<JarInfo>();
- for (JarDestinationInfo destination : n.getJarDestinations()) {
- ins.add(destination.getJarInfo());
- }
- return ins.iterator();
- }
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
index 395a7a711398..f568f2d06364 100644
--- a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
+++ b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
@@ -463,6 +463,9 @@ public class CompilerTask extends Task.Backgroundable {
}
private void removeAllContents(Project project, Content notRemove) {
+ if (project.isDisposed()) {
+ return;
+ }
final MessageView messageView = MessageView.SERVICE.getInstance(project);
Content[] contents = messageView.getContentManager().getContents();
for (Content content : contents) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
index c32d9ecda313..03ff006eea40 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
@@ -28,6 +28,7 @@ import com.intellij.execution.process.*;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.ide.DataManager;
import com.intellij.ide.PowerSaveMode;
+import com.intellij.ide.file.BatchFileChangeListener;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.Application;
@@ -246,7 +247,13 @@ public class BuildManager implements ApplicationComponent{
for (VFileEvent event : events) {
final VirtualFile eventFile = event.getFile();
- if (eventFile == null || ProjectCoreUtil.isProjectOrWorkspaceFile(eventFile)) {
+ if (eventFile == null) {
+ continue;
+ }
+ if (!eventFile.isValid()) {
+ return true; // should be deleted
+ }
+ if (ProjectCoreUtil.isProjectOrWorkspaceFile(eventFile)) {
continue;
}
@@ -268,6 +275,12 @@ public class BuildManager implements ApplicationComponent{
});
+ conn.subscribe(BatchFileChangeListener.TOPIC, new BatchFileChangeListener.Adapter() {
+ public void batchChangeStarted(Project project) {
+ cancelAutoMakeTasks(project);
+ }
+ });
+
EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java b/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
index e4df975348d9..6a8c9740df80 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
@@ -48,8 +48,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
*/
public abstract class DefaultMessageHandler implements BuilderMessageHandler {
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.DefaultMessageHandler");
+ public static final long CONSTANT_SEARCH_TIME_LIMIT = 60 * 1000L; // one minute
private final Project myProject;
private final SequentialTaskExecutor myTaskExecutor = new SequentialTaskExecutor(PooledThreadExecutor.INSTANCE);
+ private volatile long myConstantSearchTime = 0L;
protected DefaultMessageHandler(Project project) {
myProject = project;
@@ -119,14 +121,25 @@ public abstract class DefaultMessageHandler implements BuilderMessageHandler {
boolean canceled = false;
final Ref<Boolean> isSuccess = Ref.create(Boolean.TRUE);
final Set<String> affectedPaths = Collections.synchronizedSet(new HashSet<String>()); // PsiSearchHelper runs multiple threads
+ final long searchStart = System.currentTimeMillis();
try {
- if (isDumbMode()) {
+ if (myConstantSearchTime > CONSTANT_SEARCH_TIME_LIMIT) {
+ // skipping constant search and letting the build rebuild dependent modules
+ isSuccess.set(Boolean.FALSE);
+ LOG.debug("Total constant search time exceeded time limit for this build session");
+ }
+ else if(isDumbMode()) {
// do not wait until dumb mode finishes
isSuccess.set(Boolean.FALSE);
LOG.debug("Constant search task: cannot search in dumb mode");
}
else {
final String qualifiedName = ownerClassName.replace('$', '.');
+
+ handleCompileMessage(sessionId, CmdlineProtoUtil.createCompileProgressMessageResponse(
+ "Searching for usages of changed/removed constants for class " + qualifiedName
+ ).getCompileMessage());
+
final PsiClass[] classes = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
public PsiClass[] compute() {
return JavaPsiFacade.getInstance(myProject).findClasses(qualifiedName, GlobalSearchScope.allScope(myProject));
@@ -202,6 +215,7 @@ public abstract class DefaultMessageHandler implements BuilderMessageHandler {
throw e;
}
finally {
+ myConstantSearchTime += (System.currentTimeMillis() - searchStart);
if (!canceled) {
notifyConstantSearchFinished(channel, sessionId, ownerClassName, fieldName, isSuccess, affectedPaths);
}
diff --git a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
index c5b6c66754f2..779df52e49e3 100644
--- a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
+++ b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
@@ -93,7 +93,7 @@ public final class MockJdkWrapper implements Sdk {
@NotNull
public SdkModificator getSdkModificator() {
- return null;
+ return myDelegate.getSdkModificator();
}
public Sdk getDelegate() {
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java
deleted file mode 100644
index b4e1865f46ff..000000000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2000-2010 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.packaging.impl.compiler;
-
-import com.intellij.openapi.compiler.generic.VirtualFileCompileItem;
-import com.intellij.compiler.impl.packagingCompiler.DestinationInfo;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.SmartList;
-import com.intellij.util.io.DataExternalizer;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * @author nik
- */
-public class ArtifactCompilerCompileItem extends VirtualFileCompileItem<ArtifactPackagingItemOutputState> {
- public static final DataExternalizer<ArtifactPackagingItemOutputState> OUTPUT_EXTERNALIZER = new ArtifactPackagingItemExternalizer();
- private final List<DestinationInfo> myDestinations = new SmartList<DestinationInfo>();
-
- public ArtifactCompilerCompileItem(VirtualFile file) {
- super(file);
- }
-
- public void addDestination(DestinationInfo info) {
- myDestinations.add(info);
- }
-
- public List<DestinationInfo> getDestinations() {
- return myDestinations;
- }
-
- @NotNull
- @Override
- public ArtifactPackagingItemOutputState computeOutputState() {
- final SmartList<Pair<String, Long>> pairs = new SmartList<Pair<String, Long>>();
- for (DestinationInfo destination : myDestinations) {
- destination.update();
- final VirtualFile outputFile = destination.getOutputFile();
- long timestamp = outputFile != null ? outputFile.getTimeStamp() : -1;
- pairs.add(Pair.create(destination.getOutputPath(), timestamp));
- }
- return new ArtifactPackagingItemOutputState(pairs);
- }
-
- @Override
- public boolean isOutputUpToDate(@NotNull ArtifactPackagingItemOutputState state) {
- final SmartList<Pair<String, Long>> cachedDestinations = state.myDestinations;
- if (cachedDestinations.size() != myDestinations.size()) {
- return false;
- }
-
- for (DestinationInfo info : myDestinations) {
- final VirtualFile outputFile = info.getOutputFile();
- long timestamp = outputFile != null ? outputFile.getTimeStamp() : -1;
- final String path = info.getOutputPath();
- boolean found = false;
- //todo[nik] use map if list contains many items
- for (Pair<String, Long> cachedDestination : cachedDestinations) {
- if (cachedDestination.first.equals(path)) {
- if (cachedDestination.second != timestamp) return false;
- found = true;
- break;
- }
- }
- if (!found) return false;
- }
-
- return true;
- }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
index 0c2a15172c99..d4070de6b844 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
@@ -15,129 +15,26 @@
*/
package com.intellij.packaging.impl.compiler;
-import com.intellij.facet.Facet;
-import com.intellij.facet.FacetManager;
-import com.intellij.facet.FacetRootsProvider;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.Result;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
-import com.intellij.packaging.elements.PackagingElement;
-import com.intellij.packaging.elements.PackagingElementResolvingContext;
-import com.intellij.packaging.impl.artifacts.ArtifactUtil;
-import com.intellij.packaging.impl.elements.FileOrDirectoryCopyPackagingElement;
-import com.intellij.util.Processor;
-import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;
import org.jetbrains.jps.incremental.artifacts.ArtifactBuildTargetType;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
/**
* @author nik
*/
public class ArtifactCompilerUtil {
- private static final Logger LOG = Logger.getInstance("#com.intellij.packaging.impl.compiler.ArtifactCompilerUtil");
-
private ArtifactCompilerUtil() {
}
- @Nullable
- public static BufferedInputStream getJarEntryInputStream(VirtualFile sourceFile, final CompileContext context) throws IOException {
- final String fullPath = sourceFile.getPath();
- final int jarEnd = fullPath.indexOf(JarFileSystem.JAR_SEPARATOR);
- LOG.assertTrue(jarEnd != -1, fullPath);
- String pathInJar = fullPath.substring(jarEnd + JarFileSystem.JAR_SEPARATOR.length());
- String jarPath = fullPath.substring(0, jarEnd);
- final ZipFile jarFile = new ZipFile(new File(FileUtil.toSystemDependentName(jarPath)));
- final ZipEntry entry = jarFile.getEntry(pathInJar);
- if (entry == null) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot extract '" + pathInJar + "' from '" + jarFile.getName() + "': entry not found", null, -1, -1);
- return null;
- }
-
- return new BufferedInputStream(jarFile.getInputStream(entry)) {
- @Override
- public void close() throws IOException {
- super.close();
- jarFile.close();
- }
- };
- }
-
- public static File getJarFile(VirtualFile jarEntry) {
- String fullPath = jarEntry.getPath();
- return new File(FileUtil.toSystemDependentName(fullPath.substring(fullPath.indexOf(JarFileSystem.JAR_SEPARATOR))));
- }
-
-
- @NotNull
- public static Set<VirtualFile> getArtifactOutputsContainingSourceFiles(final @NotNull Project project) {
- final List<VirtualFile> allOutputs = new ArrayList<VirtualFile>();
- for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
- ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);
- }
-
- final Set<VirtualFile> roots = new HashSet<VirtualFile>();
- final PackagingElementResolvingContext context = ArtifactManager.getInstance(project).getResolvingContext();
- for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
- Processor<PackagingElement<?>> processor = new Processor<PackagingElement<?>>() {
- @Override
- public boolean process(@NotNull PackagingElement<?> element) {
- if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
- final VirtualFile file = ((FileOrDirectoryCopyPackagingElement)element).findFile();
- if (file != null) {
- roots.add(file);
- }
- }
- return true;
- }
- };
- ArtifactUtil.processRecursivelySkippingIncludedArtifacts(artifact, processor, context);
- }
-
- final Module[] modules = ModuleManager.getInstance(project).getModules();
- for (Module module : modules) {
- final Facet[] facets = FacetManager.getInstance(module).getAllFacets();
- for (Facet facet : facets) {
- if (facet instanceof FacetRootsProvider) {
- roots.addAll(((FacetRootsProvider)facet).getFacetRoots());
- }
- }
- }
-
- final Set<VirtualFile> affectedOutputPaths = new HashSet<VirtualFile>();
- for (VirtualFile output : allOutputs) {
- for (VirtualFile root : roots) {
- if (VfsUtilCore.isAncestor(output, root, false)) {
- affectedOutputPaths.add(output);
- }
- }
- }
- return affectedOutputPaths;
- }
public static boolean containsArtifacts(List<TargetTypeBuildScope> scopes) {
for (TargetTypeBuildScope scope : scopes) {
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java
deleted file mode 100644
index 175cdca3ea9e..000000000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.packaging.impl.compiler;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.util.SmartList;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.IOUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-/**
-* @author nik
-*/
-public class ArtifactPackagingItemExternalizer implements DataExternalizer<ArtifactPackagingItemOutputState> {
- @Override
- public void save(@NotNull DataOutput out, ArtifactPackagingItemOutputState value) throws IOException {
- out.writeInt(value.myDestinations.size());
- for (Pair<String, Long> pair : value.myDestinations) {
- IOUtil.writeUTF(out, pair.getFirst());
- out.writeLong(pair.getSecond());
- }
- }
-
- @Override
- public ArtifactPackagingItemOutputState read(@NotNull DataInput in) throws IOException {
- int size = in.readInt();
- SmartList<Pair<String, Long>> destinations = new SmartList<Pair<String, Long>>();
- while (size-- > 0) {
- String path = IOUtil.readUTF(in);
- long outputTimestamp = in.readLong();
- destinations.add(Pair.create(path, outputTimestamp));
- }
- return new ArtifactPackagingItemOutputState(destinations);
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java
deleted file mode 100644
index 29ac0ae91918..000000000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2010 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.packaging.impl.compiler;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.util.SmartList;
-
-/**
-* @author nik
-*/
-public class ArtifactPackagingItemOutputState {
- public final SmartList<Pair<String, Long>> myDestinations;
-
- public ArtifactPackagingItemOutputState(SmartList<Pair<String, Long>> destinations) {
- myDestinations = destinations;
- }
-}
diff --git a/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java b/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java
index 3bc0dc093fc8..686791e94c04 100644
--- a/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java
+++ b/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java
@@ -15,11 +15,11 @@
*/
package com.intellij.compiler.notNullVerification;
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
import org.jetbrains.org.objectweb.asm.*;
-import java.util.ArrayList;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
/**
@@ -100,6 +100,15 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
myClassName = name;
}
+ private static class NotNullState {
+ @Nullable String message;
+ @NotNull String exceptionType;
+
+ NotNullState(String exceptionType) {
+ this.exceptionType = exceptionType;
+ }
+ }
+
@Override
public MethodVisitor visitMethod(final int access, final String name, String desc, String signature, String[] exceptions) {
final Type[] args = Type.getArgumentTypes(desc);
@@ -107,29 +116,32 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
final MethodVisitor v = cv.visitMethod(access, name, desc, signature, exceptions);
final Map<Integer, String> paramNames = myMethodParamNames.get(myClassName + '.' + name + desc);
return new MethodVisitor(Opcodes.ASM5, v) {
-
- private final List<Integer> myNotNullParams = new ArrayList<Integer>();
+ private final Map<Integer, NotNullState> myNotNullParams = new LinkedHashMap<Integer, NotNullState>();
private int mySyntheticCount = 0;
- private boolean myIsNotNull = false;
- private String myMessage = null;
+ private NotNullState myMethodNotNull;
private Label myStartGeneratedCodeLabel;
+ private AnnotationVisitor collectNotNullArgs(AnnotationVisitor base, final NotNullState state) {
+ return new AnnotationVisitor(Opcodes.ASM5, base) {
+ @Override
+ public void visit(String methodName, Object o) {
+ if (ANNOTATION_DEFAULT_METHOD.equals(methodName) && !((String) o).isEmpty()) {
+ state.message = (String) o;
+ }
+ else if ("exception".equals(methodName) && o instanceof Type && !((Type)o).getClassName().equals(Exception.class.getName())) {
+ state.exceptionType = ((Type)o).getInternalName();
+ }
+ super.visit(methodName, o);
+ }
+ };
+ }
+
public AnnotationVisitor visitParameterAnnotation(final int parameter, final String anno, final boolean visible) {
AnnotationVisitor av = mv.visitParameterAnnotation(parameter, anno, visible);
if (isReferenceType(args[parameter]) && anno.equals(NOT_NULL_TYPE)) {
- myNotNullParams.add(new Integer(parameter));
- av = new AnnotationVisitor(Opcodes.ASM5, av) {
- @Override
- public void visit(String methodName, Object o) {
- if(ANNOTATION_DEFAULT_METHOD.equals(methodName)) {
- String message = (String) o;
- if(!message.isEmpty()) {
- myMessage = message;
- }
- }
- super.visit(methodName, o);
- }
- };
+ NotNullState state = new NotNullState(IAE_CLASS_NAME);
+ myNotNullParams.put(new Integer(parameter), state);
+ av = collectNotNullArgs(av, state);
}
else if (anno.equals(SYNTHETIC_TYPE)) {
// see http://forge.ow2.org/tracker/?aid=307392&group_id=23&atid=100023&func=detail
@@ -143,19 +155,8 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
public AnnotationVisitor visitAnnotation(String anno, boolean isRuntime) {
AnnotationVisitor av = mv.visitAnnotation(anno, isRuntime);
if (isReferenceType(returnType) && anno.equals(NOT_NULL_TYPE)) {
- myIsNotNull = true;
- av = new AnnotationVisitor(Opcodes.ASM5, av) {
- @Override
- public void visit(String methodName, Object o) {
- if(ANNOTATION_DEFAULT_METHOD.equals(methodName)) {
- String message = (String) o;
- if(!message.isEmpty()) {
- myMessage = message;
- }
- }
- super.visit(methodName, o);
- }
- };
+ myMethodNotNull = new NotNullState(ISE_CLASS_NAME);
+ av = collectNotNullArgs(av, myMethodNotNull);
}
return av;
@@ -167,7 +168,8 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
myStartGeneratedCodeLabel = new Label();
mv.visitLabel(myStartGeneratedCodeLabel);
}
- for (Integer param : myNotNullParams) {
+ for (Map.Entry<Integer, NotNullState> entry : myNotNullParams.entrySet()) {
+ Integer param = entry.getKey();
int var = ((access & ACC_STATIC) == 0) ? 1 : 0;
for (int i = 0; i < param; ++i) {
var += args[i].getSize();
@@ -177,14 +179,15 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
Label end = new Label();
mv.visitJumpInsn(IFNONNULL, end);
+ NotNullState state = entry.getValue();
String paramName = paramNames == null ? null : paramNames.get(param);
- String descrPattern = myMessage != null
- ? myMessage
+ String descrPattern = state.message != null
+ ? state.message
: paramName != null ? NULL_ARG_MESSAGE_NAMED : NULL_ARG_MESSAGE_INDEXED;
- String[] args = myMessage != null
+ String[] args = state.message != null
? EMPTY_STRING_ARRAY
: new String[]{paramName != null ? paramName : String.valueOf(param - mySyntheticCount), myClassName, name};
- generateThrow(IAE_CLASS_NAME, end, descrPattern, args);
+ generateThrow(state.exceptionType, end, descrPattern, args);
}
}
@@ -199,13 +202,13 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
@Override
public void visitInsn(int opcode) {
if (opcode == ARETURN) {
- if (myIsNotNull) {
+ if (myMethodNotNull != null) {
mv.visitInsn(DUP);
final Label skipLabel = new Label();
mv.visitJumpInsn(IFNONNULL, skipLabel);
- String descrPattern = myMessage != null ? myMessage : NULL_RESULT_MESSAGE;
- String[] args = myMessage != null ? EMPTY_STRING_ARRAY : new String[]{myClassName, name};
- generateThrow(ISE_CLASS_NAME, skipLabel, descrPattern, args);
+ String descrPattern = myMethodNotNull.message != null ? myMethodNotNull.message : NULL_RESULT_MESSAGE;
+ String[] args = myMethodNotNull.message != null ? EMPTY_STRING_ARRAY : new String[]{myClassName, name};
+ generateThrow(myMethodNotNull.exceptionType, skipLabel, descrPattern, args);
}
}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java
deleted file mode 100644
index eed2e77c8030..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.compiler.make;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public interface BuildInstruction {
- String getOutputRelativePath();
-
- boolean accept(BuildInstructionVisitor visitor) throws Exception;
-}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java
deleted file mode 100644
index 0bd62be958f7..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.compiler.make;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public abstract class BuildInstructionVisitor {
- public boolean visitInstruction(BuildInstruction instruction) throws Exception {
- return true;
- }
- public boolean visitFileCopyInstruction(FileCopyInstruction instruction) throws Exception {
- return visitInstruction(instruction);
- }
-} \ No newline at end of file
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java
deleted file mode 100644
index 977772418589..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.compiler.make;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.packaging.artifacts.Artifact;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public abstract class BuildParticipant {
- public static final BuildParticipant[] EMPTY_ARRAY = new BuildParticipant[0];
-
- @Nullable
- public abstract Artifact createArtifact(CompileContext context);
-
-}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java
deleted file mode 100644
index 374e161549ad..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.intellij.openapi.compiler.make;
-
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.module.Module;
-
-import java.util.Collection;
-
-/**
- * @author nik
- *
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public abstract class BuildParticipantProvider {
- public static final ExtensionPointName<BuildParticipantProvider> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.compiler.buildParticipantProvider");
-
-
- public abstract Collection<? extends BuildParticipant> getParticipants(Module module);
-
-}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java
deleted file mode 100644
index c5636394cfe0..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.compiler.make;
-
-import java.io.File;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public interface FileCopyInstruction extends BuildInstruction {
- File getFile();
-
- boolean isDirectory();
-
-} \ No newline at end of file