mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+2
-1
@@ -17,6 +17,7 @@ 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;
|
||||
|
||||
@@ -43,7 +44,7 @@ public class FileCopyInstructionImpl extends BuildInstructionBase implements Fil
|
||||
|
||||
final FileCopyInstruction item = (FileCopyInstruction) o;
|
||||
|
||||
if (getFile() != null ? !getFile().equals(item.getFile()) : item.getFile() != null) return false;
|
||||
if (getFile() != null ? !FileUtil.filesEqual(getFile(), item.getFile()) : item.getFile() != null) return false;
|
||||
|
||||
if (getOutputRelativePath() != null) {
|
||||
if (!getOutputRelativePath().equals( item.getOutputRelativePath() )) return false;
|
||||
|
||||
@@ -70,8 +70,7 @@ public class DeploymentUtilImpl extends DeploymentUtil {
|
||||
CompilerBundle.message("message.text.destination.is.directory", createCopyErrorMessage(fromFile, toFile)), null, -1, -1);
|
||||
return;
|
||||
}
|
||||
if (fromFile.equals(toFile)
|
||||
|| writtenPaths != null && !writtenPaths.add(toFile.getPath())) {
|
||||
if (FileUtil.filesEqual(fromFile, toFile) || writtenPaths != null && !writtenPaths.add(toFile.getPath())) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Skipping " + fromFile.getAbsolutePath() + ": " + toFile.getAbsolutePath() + " is already written");
|
||||
}
|
||||
|
||||
+4
-2
@@ -806,10 +806,12 @@ public class HighlightMethodUtil {
|
||||
|
||||
if (aClass != null) {
|
||||
String className = aClass instanceof PsiAnonymousClass ? null : aClass.getName();
|
||||
if (className != null && !Comparing.strEqual(methodName, className)) {
|
||||
if (className == null || !Comparing.strEqual(methodName, className)) {
|
||||
errorResult = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, method.getNameIdentifier(),
|
||||
JavaErrorMessages.message("missing.return.type"));
|
||||
QuickFixAction.registerQuickFixAction(errorResult, new RenameElementFix(method, className));
|
||||
if (className != null) {
|
||||
QuickFixAction.registerQuickFixAction(errorResult, new RenameElementFix(method, className));
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorResult;
|
||||
|
||||
+6
-3
@@ -159,13 +159,16 @@ public class ParameterCanBeLocalInspection extends BaseJavaLocalInspectionTool {
|
||||
final PsiMethod method = (PsiMethod)scope;
|
||||
final PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
|
||||
final ParameterInfoImpl[] info = new ParameterInfoImpl[parameters.length - 1];
|
||||
final List<ParameterInfoImpl> info = new ArrayList<ParameterInfoImpl>();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
PsiParameter psiParameter = parameters[i];
|
||||
if (psiParameter == parameter) continue;
|
||||
info[i] = new ParameterInfoImpl(i, psiParameter.getName(), psiParameter.getType());
|
||||
info.add(new ParameterInfoImpl(i, psiParameter.getName(), psiParameter.getType()));
|
||||
}
|
||||
final ChangeSignatureProcessor cp = new ChangeSignatureProcessor(project, method, false, VisibilityUtil.getVisibilityModifier(method.getModifierList()), method.getName(), method.getReturnType(), info){
|
||||
final ParameterInfoImpl[] newParams = info.toArray(new ParameterInfoImpl[info.size()]);
|
||||
final String visibilityModifier = VisibilityUtil.getVisibilityModifier(method.getModifierList());
|
||||
final ChangeSignatureProcessor cp = new ChangeSignatureProcessor(project, method, false, visibilityModifier,
|
||||
method.getName(), method.getReturnType(), newParams) {
|
||||
@Override
|
||||
protected void performRefactoring(UsageInfo[] usages) {
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
|
||||
|
||||
+5
@@ -76,6 +76,11 @@ public class AnonymousToInnerHandler implements RefactoringActionHandler {
|
||||
showErrorMessage(editor, RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("error.wrong.caret.position.anonymous")));
|
||||
return;
|
||||
}
|
||||
final PsiElement parent = anonymousClass.getParent();
|
||||
if (parent instanceof PsiEnumConstant) {
|
||||
showErrorMessage(editor, RefactoringBundle.getCannotRefactorMessage("Enum constant can't be converted to inner class"));
|
||||
return;
|
||||
}
|
||||
invoke(project, editor, anonymousClass);
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -99,6 +99,12 @@ public class a12 {
|
||||
public <error descr="Invalid method declaration; return type required">foo</error>() {
|
||||
}
|
||||
|
||||
{
|
||||
new Object() {
|
||||
<error descr="Invalid method declaration; return type required">Object</error>() {}
|
||||
};
|
||||
}
|
||||
|
||||
// do not warn about illegal type in incomplete declarations (http://www.intellij.net/tracker/idea/viewSCR?publicId=9586)
|
||||
void foo<EOLError descr="';' expected"></EOLError>
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Convert to local variable" "true"
|
||||
class Temp {
|
||||
|
||||
void foo(int k) {
|
||||
int x = 5;
|
||||
System.out.println(x);
|
||||
}
|
||||
|
||||
void bar() {
|
||||
foo(42);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Convert to local variable" "true"
|
||||
class Temp {
|
||||
|
||||
void foo(int <caret>x, int k) {
|
||||
x = 5;
|
||||
System.out.println(x);
|
||||
}
|
||||
|
||||
void bar() {
|
||||
foo(2, 42);
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
package org.jetbrains.jps.builders.java.dependencyView;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.io.PersistentStringEnumerator;
|
||||
@@ -9,7 +8,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -92,7 +90,8 @@ class DependencyContext {
|
||||
return myEmptyName;
|
||||
}
|
||||
final String _path = FileUtil.toSystemIndependentName(path);
|
||||
return myEnumerator.enumerate(SystemInfo.isFileSystemCaseSensitive ? _path : _path.toLowerCase(Locale.US));
|
||||
//return myEnumerator.enumerate(SystemInfo.isFileSystemCaseSensitive ? _path : _path.toLowerCase(Locale.US));
|
||||
return myEnumerator.enumerate(_path);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
@@ -3,10 +3,12 @@ package org.jetbrains.jps.incremental;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Mappings;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.ProjectPaths;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Mappings;
|
||||
import org.jetbrains.jps.incremental.fs.RootDescriptor;
|
||||
import org.jetbrains.jps.incremental.messages.ProgressMessage;
|
||||
import org.jetbrains.jps.incremental.storage.SourceToOutputMapping;
|
||||
@@ -87,7 +89,8 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
// unmark as affected all successfully compiled
|
||||
allAffectedFiles.removeAll(successfullyCompiled);
|
||||
|
||||
final HashSet<File> affectedBeforeDif = new HashSet<File>(allAffectedFiles);
|
||||
final Set<File> affectedBeforeDif = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
affectedBeforeDif.addAll(allAffectedFiles);
|
||||
|
||||
final ModulesBasedFileFilter moduleBasedFilter = new ModulesBasedFileFilter(context, chunk);
|
||||
final boolean incremental = globalMappings.differentiateOnIncrementalMake(
|
||||
@@ -110,8 +113,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
if (incremental) {
|
||||
final Set<File> newlyAffectedFiles = new HashSet<File>(allAffectedFiles);
|
||||
newlyAffectedFiles.removeAll(affectedBeforeDif);
|
||||
newlyAffectedFiles
|
||||
.removeAll(allCompiledFiles); // the diff operation may have affected the class already compiled in thic compilation round
|
||||
newlyAffectedFiles.removeAll(allCompiledFiles); // the diff operation may have affected the class already compiled in thic compilation round
|
||||
|
||||
final String infoMessage = "Dependency analysis found " + newlyAffectedFiles.size() + " affected files";
|
||||
LOG.info(infoMessage);
|
||||
@@ -211,7 +213,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
private static Set<File> getAllAffectedFilesContainer(CompileContext context) {
|
||||
Set<File> allAffectedFiles = ALL_AFFECTED_FILES_KEY.get(context);
|
||||
if (allAffectedFiles == null) {
|
||||
allAffectedFiles = new HashSet<File>();
|
||||
allAffectedFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
ALL_AFFECTED_FILES_KEY.set(context, allAffectedFiles);
|
||||
}
|
||||
return allAffectedFiles;
|
||||
@@ -220,7 +222,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
private static Set<File> getAllCompiledFilesContainer(CompileContext context) {
|
||||
Set<File> allCompiledFiles = ALL_COMPILED_FILES_KEY.get(context);
|
||||
if (allCompiledFiles == null) {
|
||||
allCompiledFiles = new HashSet<File>();
|
||||
allCompiledFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
ALL_COMPILED_FILES_KEY.set(context, allCompiledFiles);
|
||||
}
|
||||
return allCompiledFiles;
|
||||
@@ -231,7 +233,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
if (map == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
final Set<String> removed = new HashSet<String>();
|
||||
final Set<String> removed = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
|
||||
for (ModuleBuildTarget target : chunk.getTargets()) {
|
||||
final Collection<String> modulePaths = map.get(target);
|
||||
if (modulePaths != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.jetbrains.jps.incremental;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.JpsPathUtil;
|
||||
@@ -23,7 +24,7 @@ import java.util.*;
|
||||
* Date: 1/11/12
|
||||
*/
|
||||
public class ModuleRootsIndex {
|
||||
private final Map<File, RootDescriptor> myRootToDescriptorMap = new HashMap<File, RootDescriptor>();
|
||||
private final THashMap<File, RootDescriptor> myRootToDescriptorMap = new THashMap<File, RootDescriptor>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
private final Map<JpsModule, List<RootDescriptor>> myModuleToRootsMap = new HashMap<JpsModule, List<RootDescriptor>>();
|
||||
private final Map<String, JpsModule> myNameToModuleMap = new HashMap<String, JpsModule>();
|
||||
private final int myTotalModuleCount;
|
||||
@@ -167,7 +168,7 @@ public class ModuleRootsIndex {
|
||||
public RootDescriptor associateRoot(@NotNull CompileContext context, File root, JpsModule module, boolean isTestRoot) {
|
||||
Map<File, RootDescriptor> rootToDescriptorMap = ROOT_DESCRIPTOR_MAP.get(context);
|
||||
if (rootToDescriptorMap == null) {
|
||||
rootToDescriptorMap = new HashMap<File, RootDescriptor>();
|
||||
rootToDescriptorMap = new THashMap<File, RootDescriptor>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
ROOT_DESCRIPTOR_MAP.set(context, rootToDescriptorMap);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class ArtifactInstructionsBuilderImpl implements ArtifactInstructionsBuil
|
||||
|
||||
public boolean addDestination(@NotNull ArtifactRootDescriptor descriptor, @NotNull DestinationInfo destinationInfo) {
|
||||
if (destinationInfo instanceof ExplodedDestinationInfo && descriptor instanceof FileBasedArtifactRootDescriptor
|
||||
&& descriptor.getRootFile().equals(new File(FileUtil.toSystemDependentName(destinationInfo.getOutputFilePath())))) {
|
||||
&& FileUtil.filesEqual(descriptor.getRootFile(), new File(FileUtil.toSystemDependentName(destinationInfo.getOutputFilePath())))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class FileBasedArtifactRootDescriptor extends ArtifactRootDescriptor {
|
||||
final File file = new File(FileUtil.toSystemDependentName(filePath));
|
||||
if (!file.exists()) return;
|
||||
String targetPath;
|
||||
if (!file.equals(getRootFile())) {
|
||||
if (!FileUtil.filesEqual(file, getRootFile())) {
|
||||
final String relativePath = FileUtil.getRelativePath(FileUtil.toSystemIndependentName(getRootFile().getPath()), filePath, '/');
|
||||
targetPath = JpsPathUtil.appendToPath(outputPath, relativePath);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public final class CopyResourcesUtil {
|
||||
final File file = new File(targetDir, className + ".class");
|
||||
FileUtil.createParentDirs(file);
|
||||
if (deleteOnExit) {
|
||||
for (File f = file; f != null && !f.equals(targetDir); f = f.getParentFile()) {
|
||||
for (File f = file; f != null && !FileUtil.filesEqual(f, targetDir); f = FileUtil.getParentFile(f)) {
|
||||
f.deleteOnExit();
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public final class CopyResourcesUtil {
|
||||
final File targetDir = new File(targetPath).getAbsoluteFile();
|
||||
final File file = new File(targetDir, fileName);
|
||||
FileUtil.createParentDirs(file);
|
||||
for (File f = file; f != null && !f.equals(targetDir); f = f.getParentFile()) {
|
||||
for (File f = file; f != null && !FileUtil.filesEqual(f, targetDir); f = FileUtil.getParentFile(f)) {
|
||||
f.deleteOnExit();
|
||||
}
|
||||
final String resourceName = "/" + fileName;
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.uiDesigner.compiler.AlienFormFileException;
|
||||
@@ -19,6 +20,7 @@ import com.intellij.uiDesigner.lw.CompiledClassPropertiesProvider;
|
||||
import com.intellij.uiDesigner.lw.LwRootContainer;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.concurrency.SequentialTaskExecutor;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.ClassReader;
|
||||
@@ -82,16 +84,32 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
"-g", "-deprecation", "-nowarn", "-verbose"
|
||||
));
|
||||
|
||||
private static final FileFilter JAVA_SOURCES_FILTER = new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(JAVA_EXTENSION);
|
||||
private static final FileFilter JAVA_SOURCES_FILTER =
|
||||
SystemInfo.isFileSystemCaseSensitive?
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(JAVA_EXTENSION);
|
||||
}
|
||||
} :
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return StringUtil.endsWithIgnoreCase(file.getPath(), JAVA_EXTENSION);
|
||||
}
|
||||
};
|
||||
|
||||
private static final FileFilter FORM_SOURCES_FILTER =
|
||||
SystemInfo.isFileSystemCaseSensitive?
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(FORM_EXTENSION);
|
||||
}
|
||||
} :
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return StringUtil.endsWithIgnoreCase(file.getPath(), FORM_EXTENSION);
|
||||
}
|
||||
}
|
||||
};
|
||||
private static final FileFilter FORM_SOURCES_FILTER = new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(FORM_EXTENSION);
|
||||
}
|
||||
};
|
||||
;
|
||||
|
||||
private static final Key<Callbacks.Backend> DELTA_MAPPINGS_CALLBACK_KEY = Key.create("_dependency_data_");
|
||||
private final Executor myTaskRunner;
|
||||
@@ -153,8 +171,8 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
|
||||
public ExitCode build(final CompileContext context, final ModuleChunk chunk) throws ProjectBuildException {
|
||||
try {
|
||||
final Set<File> filesToCompile = new HashSet<File>();
|
||||
final Set<File> formsToCompile = new HashSet<File>();
|
||||
final Set<File> filesToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
final Set<File> formsToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
|
||||
FSOperations.processFilesToRecompile(context, chunk, new FileProcessor() {
|
||||
public boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.jetbrains.jps.incremental.java;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
@@ -19,8 +21,8 @@ import java.util.*;
|
||||
*/
|
||||
class OutputFilesSink implements OutputFileConsumer {
|
||||
private final CompileContext myContextI;
|
||||
private final Set<File> mySuccessfullyCompiled = new LinkedHashSet<File>();
|
||||
private final Set<File> myProblematic = new HashSet<File>();
|
||||
private final Set<File> mySuccessfullyCompiled = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
private final Set<File> myProblematic = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
private final List<OutputFileObject> myFileObjects = new ArrayList<OutputFileObject>();
|
||||
private final Map<String, OutputFileObject> myCompiledClasses = new HashMap<String, OutputFileObject>();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ClassRenameTest extends IncrementalTestCase {
|
||||
doTest().assertSuccessful();
|
||||
}
|
||||
|
||||
public void testChangeCaseOfName() {
|
||||
public void _testChangeCaseOfName() {
|
||||
doTest().assertSuccessful();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class ModuleAttachProcessor extends ProjectAttachProcessor {
|
||||
if (mappings.size() == 1) {
|
||||
final VirtualFile[] contentRoots = ModuleRootManager.getInstance(primaryModule).getContentRoots();
|
||||
// if we had one mapping for the root of the primary module and the added module uses the same VCS, change mapping to <Project Root>
|
||||
if (contentRoots.length == 1 && new File(contentRoots[0].getPath()).equals(new File(mappings.get(0).getDirectory()))) {
|
||||
if (contentRoots.length == 1 && FileUtil.filesEqual(new File(contentRoots[0].getPath()), new File(mappings.get(0).getDirectory()))) {
|
||||
final AbstractVcs vcs = vcsManager.findVersioningVcs(addedModuleContentRoot);
|
||||
if (vcs != null && vcs.getName().equals(mappings.get(0).getVcs())) {
|
||||
vcsManager.setDirectoryMappings(Arrays.asList(new VcsDirectoryMapping("", vcs.getName())));
|
||||
|
||||
@@ -199,7 +199,7 @@ public class RenameProcessor extends BaseRefactoringProcessor {
|
||||
}
|
||||
|
||||
protected static void assertNonCompileElement(PsiElement element) {
|
||||
LOG.assertTrue(!(element instanceof PsiCompiledElement));
|
||||
LOG.assertTrue(!(element instanceof PsiCompiledElement), element);
|
||||
}
|
||||
|
||||
private boolean findRenamedVariables(final List<UsageInfo> variableUsages) {
|
||||
|
||||
@@ -142,10 +142,9 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo
|
||||
|
||||
@Override
|
||||
public void setNoCopyJarForPath(String pathInJar) {
|
||||
if (myNoCopyJarPaths == null) {
|
||||
if (myNoCopyJarPaths == null || pathInJar == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = pathInJar.indexOf(JAR_SEPARATOR);
|
||||
if (index < 0) return;
|
||||
String path = pathInJar.substring(0, index);
|
||||
|
||||
@@ -96,7 +96,10 @@ public class TestsUIUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void notifyByBalloon(@NotNull final Project project, final AbstractTestProxy root, final TestConsoleProperties properties) {
|
||||
public static void notifyByBalloon(@NotNull final Project project,
|
||||
boolean started,
|
||||
final AbstractTestProxy root,
|
||||
final TestConsoleProperties properties) {
|
||||
if (project.isDisposed()) return;
|
||||
if (properties == null) return;
|
||||
|
||||
@@ -107,7 +110,7 @@ public class TestsUIUtil {
|
||||
String text;
|
||||
String balloonText;
|
||||
MessageType type;
|
||||
TestResultPresentation testResultPresentation = new TestResultPresentation(root).getPresentation();
|
||||
TestResultPresentation testResultPresentation = new TestResultPresentation(root, started).getPresentation();
|
||||
type = testResultPresentation.getType();
|
||||
balloonText = testResultPresentation.getBalloonText();
|
||||
title = testResultPresentation.getTitle();
|
||||
@@ -157,13 +160,19 @@ public class TestsUIUtil {
|
||||
|
||||
private static class TestResultPresentation {
|
||||
private AbstractTestProxy myRoot;
|
||||
private boolean myStarted;
|
||||
private String myTitle;
|
||||
private String myText;
|
||||
private String myBalloonText;
|
||||
private MessageType myType;
|
||||
|
||||
public TestResultPresentation(AbstractTestProxy root) {
|
||||
public TestResultPresentation(AbstractTestProxy root, boolean started) {
|
||||
myRoot = root;
|
||||
myStarted = started;
|
||||
}
|
||||
|
||||
public TestResultPresentation(AbstractTestProxy root) {
|
||||
this(root, true);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
@@ -184,7 +193,7 @@ public class TestsUIUtil {
|
||||
|
||||
public TestResultPresentation getPresentation() {
|
||||
if (myRoot == null) {
|
||||
myBalloonText = myTitle = ExecutionBundle.message("test.not.started.progress.text");
|
||||
myBalloonText = myTitle = myStarted ? "Tests were interrupted" : ExecutionBundle.message("test.not.started.progress.text");
|
||||
myText = "";
|
||||
myType = MessageType.WARNING;
|
||||
} else{
|
||||
|
||||
@@ -134,7 +134,6 @@ public class StringUtil extends StringUtilRt {
|
||||
return newBuffer == null ? buffer : newBuffer.toString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String replace(@NotNull final String text, @NotNull final String oldS, @Nullable final String newS, boolean ignoreCase) {
|
||||
if (text.length() < oldS.length()) return text;
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@ class AndroidJpsUtil {
|
||||
|
||||
if ((JavaSourceRootType.SOURCE.equals(root.getRootType())
|
||||
|| JavaSourceRootType.TEST_SOURCE.equals(root.getRootType()) && extension != null && extension.isPackTestCode())
|
||||
&& !rootDir.equals(resDir) && !rootDir.equals(resDirForCompilation)) {
|
||||
&& !FileUtil.filesEqual(rootDir, resDir) && !rootDir.equals(resDirForCompilation)) {
|
||||
result.add(rootDir);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -910,7 +910,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parent.equals(sourceRoot)) {
|
||||
if (FileUtil.filesEqual(parent, sourceRoot)) {
|
||||
return genFolder.getPath();
|
||||
}
|
||||
final String relativePath = FileUtil.getRelativePath(sourceRoot, parent);
|
||||
|
||||
@@ -485,7 +485,7 @@ public class AndroidCompileUtil {
|
||||
try {
|
||||
f = f.getCanonicalFile();
|
||||
classFile = classFile != null ? classFile.getCanonicalFile() : null;
|
||||
if (f != null && !f.equals(classFile) && f.exists()) {
|
||||
if (f != null && !FileUtil.filesEqual(f, classFile) && f.exists()) {
|
||||
if (f.delete()) {
|
||||
virtualFile.refresh(true, false);
|
||||
}
|
||||
|
||||
@@ -288,6 +288,12 @@ public abstract class TestObject implements JavaCommandLine {
|
||||
handler.getErr().setPacketDispatcher(packetsReceiver, queue);
|
||||
|
||||
handler.addProcessListener(new ProcessAdapter() {
|
||||
private boolean myStarted = false;
|
||||
@Override
|
||||
public void startNotified(ProcessEvent event) {
|
||||
myStarted = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
handler.removeProcessListener(this);
|
||||
@@ -304,7 +310,7 @@ public abstract class TestObject implements JavaCommandLine {
|
||||
unboundOutputRoot.flush();
|
||||
packetsReceiver.checkTerminated();
|
||||
final JUnitRunningModel model = packetsReceiver.getModel();
|
||||
notifyByBalloon(model, consoleProperties);
|
||||
notifyByBalloon(model, myStarted, consoleProperties);
|
||||
}
|
||||
finally {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
@@ -355,8 +361,8 @@ public abstract class TestObject implements JavaCommandLine {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void notifyByBalloon(JUnitRunningModel model, JUnitConsoleProperties consoleProperties) {
|
||||
TestsUIUtil.notifyByBalloon(myProject, model != null ? model.getRoot() : null, consoleProperties);
|
||||
protected void notifyByBalloon(JUnitRunningModel model, boolean started, JUnitConsoleProperties consoleProperties) {
|
||||
TestsUIUtil.notifyByBalloon(myProject, started, model != null ? model.getRoot() : null, consoleProperties);
|
||||
}
|
||||
|
||||
protected JUnitProcessHandler createHandler(Executor executor) throws ExecutionException {
|
||||
|
||||
@@ -272,9 +272,9 @@ public class TestPackage extends TestObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void notifyByBalloon(JUnitRunningModel model, final JUnitConsoleProperties consoleProperties) {
|
||||
protected void notifyByBalloon(JUnitRunningModel model, boolean started, final JUnitConsoleProperties consoleProperties) {
|
||||
if (myFoundTests) {
|
||||
super.notifyByBalloon(model, consoleProperties);
|
||||
super.notifyByBalloon(model, started, consoleProperties);
|
||||
}
|
||||
else {
|
||||
final String packageName = myConfiguration.getPackage();
|
||||
|
||||
+10
-1
@@ -133,6 +133,8 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
JavaRunConfigurationExtensionManager.getInstance().attachExtensionsToProcess(config, processHandler, runnerSettings);
|
||||
final SearchingForTestsTask task = createSearchingForTestsTask(myServerSocket, config, myTempFile);
|
||||
processHandler.addProcessListener(new ProcessAdapter() {
|
||||
private boolean myStarted = false;
|
||||
|
||||
@Override
|
||||
public void processTerminated(final ProcessEvent event) {
|
||||
unboundOutputRoot.flush();
|
||||
@@ -157,7 +159,13 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
: (resultsView.getStatus() == MessageHelper.FAILED_TEST
|
||||
? MessageType.ERROR
|
||||
: MessageType.INFO);
|
||||
final String message = resultsView == null ? "Tests were not started" : resultsView.getStatusLine();
|
||||
final String message;
|
||||
if (resultsView == null) {
|
||||
message = myStarted ? "Tests were interrupted" : "Tests were not started";
|
||||
}
|
||||
else {
|
||||
message = resultsView.getStatusLine();
|
||||
}
|
||||
toolWindowManager.notifyByBalloon(testRunDebugId, type, message, null, null);
|
||||
TestsUIUtil.NOTIFICATION_GROUP.createNotification(message, type).notify(project);
|
||||
}
|
||||
@@ -173,6 +181,7 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
unboundOutputRoot.setOutputFilePath(config.getOutputFilePath());
|
||||
}
|
||||
client.prepareListening(listener, port);
|
||||
myStarted = true;
|
||||
mySearchForTestIndicator = new BackgroundableProcessIndicator(task);
|
||||
ProgressManagerImpl.runProcessWithProgressAsynchronously(task, mySearchForTestIndicator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user