memleaks in tests

This commit is contained in:
Alexey Kudravtsev
2010-12-16 13:50:04 +03:00
parent 3870d8cce6
commit cd1f7108a7
4 changed files with 12 additions and 9 deletions
@@ -37,6 +37,7 @@ import com.intellij.openapi.module.impl.scopes.ModuleWithDependentsScope;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.impl.storage.ClasspathStorage;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.PathUtil;
@@ -322,16 +323,12 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
@SuppressWarnings({"HardCodedStringLiteral"})
public String toString() {
return "Module:" + getName() + " path:" + getModuleFilePath();
if (myName == null) return "Module"; // was called before initialized
return "Module: '" + getName() + "' path: '" + getModuleFilePath()+"'";
}
private static String moduleNameByFileName(String fileName) {
if (fileName.endsWith(ModuleFileType.DOT_DEFAULT_EXTENSION)) {
return fileName.substring(0, fileName.length() - ModuleFileType.DOT_DEFAULT_EXTENSION.length());
}
else {
return fileName;
}
private static String moduleNameByFileName(@NotNull String fileName) {
return StringUtil.trimEnd(fileName, ModuleFileType.DOT_DEFAULT_EXTENSION);
}
public <T> T[] getExtensions(final ExtensionPointName<T> extensionPointName) {
@@ -1196,4 +1196,9 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
return false;
}
@Override
public String toString() {
return "Application";
}
}
@@ -220,6 +220,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
@Nullable
@NonNls
public String getLocation() {
if (myName == null) return null; // was called before initialized
return isDisposed() ? null : getStateStore().getLocation();
}
@@ -64,7 +64,7 @@ public class MessageBusImpl implements MessageBus {
}
public MessageBusImpl(final Object owner, MessageBus parentBus) {
myOwner = owner;
myOwner = owner == null ? null : owner.toString();
myParentBus = (MessageBusImpl)parentBus;
if (myParentBus != null) {
myParentBus.notifyChildBusCreated(this);