From 06ed9a37b7b1d985f6f76392a53c4a6a0df35f5b Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 22 Jul 2015 16:01:53 +0200 Subject: [PATCH] =?UTF-8?q?Use=20passed=20filepath=20as=20is,=20don't=20at?= =?UTF-8?q?tempt=20to=20use=20absolute=20file=20=E2=80=94=20in=20our=20tes?= =?UTF-8?q?ts=20we=20don't=20specify=20sometimes=20full=20path=20=E2=80=94?= =?UTF-8?q?=20we=20use=20"foo.iml"=20for=20example.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/intellij/roots/MultiModuleEditingTest.java | 14 +++++++------- .../impl/stores/StateStorageManagerImpl.java | 9 ++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java b/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java index dd156cff1005..44c2597fc576 100644 --- a/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java @@ -70,8 +70,8 @@ public class MultiModuleEditingTest extends ModuleTestCase { { final ModifiableModuleModel modifiableModel = moduleManager.getModifiableModel(); - moduleA = modifiableModel.newModule(new File("a.iml").getAbsolutePath(), StdModuleTypes.JAVA.getId()); - moduleB = modifiableModel.newModule(new File("b.iml").getAbsolutePath(), StdModuleTypes.JAVA.getId()); + moduleA = modifiableModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); + moduleB = modifiableModel.newModule("b.iml", StdModuleTypes.JAVA.getId()); assertEquals("Changes are not applied until commit", 0, moduleManager.getModules().length); //noinspection SSBasedInspection moduleListener.assertCorrectEvents(new String[0][]); @@ -107,8 +107,8 @@ public class MultiModuleEditingTest extends ModuleTestCase { final Module moduleB; { final ModifiableModuleModel moduleModel = moduleManager.getModifiableModel(); - moduleA = moduleModel.newModule(new File("a.iml").getAbsolutePath(), StdModuleTypes.JAVA.getId()); - moduleB = moduleModel.newModule(new File("b.iml").getAbsolutePath(), StdModuleTypes.JAVA.getId()); + moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); + moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA.getId()); final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel(); final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel(); rootModelB.addModuleOrderEntry(moduleA); @@ -146,9 +146,9 @@ public class MultiModuleEditingTest extends ModuleTestCase { { final ModifiableModuleModel moduleModel = moduleManager.getModifiableModel(); - moduleA = moduleModel.newModule(new File("a.iml").getAbsolutePath(), StdModuleTypes.JAVA.getId()); - moduleB = moduleModel.newModule(new File("b.iml").getAbsolutePath(), StdModuleTypes.JAVA.getId()); - final Module moduleC = moduleModel.newModule(new File("c.iml").getAbsolutePath(), StdModuleTypes.JAVA.getId()); + moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); + moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA.getId()); + final Module moduleC = moduleModel.newModule("c.iml", StdModuleTypes.JAVA.getId()); final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel(); rootModelB.addModuleOrderEntry(moduleC); moduleModel.disposeModule(moduleC); diff --git a/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java b/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java index f5d48c3bd316..af2a65e6550f 100644 --- a/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java +++ b/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java @@ -175,14 +175,13 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di ((MutablePicoContainer)myPicoContainer).registerComponentImplementation(key, storageClass); return (StateStorage)myPicoContainer.getComponentInstance(key); } - final String filePath = expandMacros(fileSpec); - File file = new File(filePath).getAbsoluteFile(); + + String filePath = expandMacros(fileSpec); + File file = new File(filePath); //noinspection deprecation if (!stateSplitter.equals(StateSplitter.class) && !stateSplitter.equals(StateSplitterEx.class)) { - @SuppressWarnings("deprecation") - StateSplitter splitter = ReflectionUtil.newInstance(stateSplitter); - return new DirectoryBasedStorage(myPathMacroSubstitutor, file, splitter, this, createStorageTopicListener()); + return new DirectoryBasedStorage(myPathMacroSubstitutor, file, ReflectionUtil.newInstance(stateSplitter), this, createStorageTopicListener()); } if (!ApplicationManager.getApplication().isHeadlessEnvironment() && PathUtilRt.getFileName(filePath).lastIndexOf('.') < 0) {