From 8b182dbf9d4f409186ad191fc5beb7775f29acd5 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 26 Apr 2018 15:33:10 +0200 Subject: [PATCH] =?UTF-8?q?cleanup=20=E2=80=94=20use=20PathMacroUtil.DEPRE?= =?UTF-8?q?CATED=5FMODULE=5FDIR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jps/incremental/java/JavaBuilder.java | 5 ++--- .../projectWizard/ExistingModuleLoader.java | 18 ++---------------- .../templates/SaveProjectAsTemplateAction.java | 2 +- .../options/ReplacePathToMacroMap.java | 18 ++---------------- 4 files changed, 7 insertions(+), 36 deletions(-) diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java index 980e490555c1..c24c28e49368 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java @@ -86,7 +86,6 @@ public class JavaBuilder extends ModuleLevelBuilder { private static final Key COMPILING_TOOL = Key.create("_java_compiling_tool_"); private static final Key>> COMPILER_USAGE_STATISTICS = Key.create("_java_compiler_usage_stats_"); private static final List COMPILABLE_EXTENSIONS = Collections.singletonList(JAVA_EXTENSION); - private static final String MODULE_DIR_MACRO_TEMPLATE = "$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$"; private static final Set FILTERED_OPTIONS = ContainerUtil.newHashSet( "-target" @@ -473,7 +472,7 @@ public class JavaBuilder extends ModuleLevelBuilder { final ConcurrentMap> map = COMPILER_USAGE_STATISTICS.get(context); Collection names = map.get(compilerName); if (names == null) { - names = Collections.synchronizedSet(new HashSet()); + names = Collections.synchronizedSet(new HashSet<>()); final Collection prev = map.putIfAbsent(compilerName, names); if (prev != null) { names = prev; @@ -774,7 +773,7 @@ public class JavaBuilder extends ModuleLevelBuilder { //this is a temporary workaround to allow passing per-module compiler options for Eclipse compiler in form // -properties $MODULE_DIR$/.settings/org.eclipse.jdt.core.prefs final String moduleDirPath = FileUtil.toCanonicalPath(baseDirectory.getAbsolutePath()); - appender = (strings, option) -> strings.add(StringUtil.replace(option, MODULE_DIR_MACRO_TEMPLATE, moduleDirPath)); + appender = (strings, option) -> strings.add(StringUtil.replace(option, PathMacroUtil.DEPRECATED_MODULE_DIR, moduleDirPath)); } boolean skip = false; diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java index 4dfdcfa1cefd..b327cfcb26e4 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java +++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.util.projectWizard; import com.intellij.CommonBundle; @@ -98,7 +84,7 @@ public class ExistingModuleLoader extends ModuleBuilder { } final Element root = JDOMUtil.load(file); final Set usedMacros = PathMacrosCollector.getMacroNames(root); - usedMacros.remove("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$"); + usedMacros.remove(PathMacroUtil.DEPRECATED_MODULE_DIR); usedMacros.removeAll(PathMacros.getInstance().getAllMacroNames()); if (usedMacros.size() > 0) { diff --git a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java index 6b68b357db4b..6e57d69a7fbf 100644 --- a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java @@ -299,7 +299,7 @@ public class SaveProjectAsTemplateAction extends AnAction { private static String getRelativePath(PathMacroManager pathMacroManager, VirtualFile moduleRoot) { String path = pathMacroManager.collapsePath(moduleRoot.getPath()); path = StringUtil.trimStart(path, "$" + PathMacroUtil.PROJECT_DIR_MACRO_NAME + "$"); - path = StringUtil.trimStart(path, "$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$"); + path = StringUtil.trimStart(path, PathMacroUtil.DEPRECATED_MODULE_DIR); path = StringUtil.trimStart(path, "/"); return path; } diff --git a/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java b/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java index 8c730f30b213..b854666e6971 100644 --- a/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java +++ b/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.application.options; import com.intellij.openapi.components.PathMacroMap; @@ -174,7 +160,7 @@ public class ReplacePathToMacroMap extends PathMacroMap { if (replacement.contains("..")) return 1; if (replacement.contains("$" + PathMacroUtil.USER_HOME_NAME + "$")) return 1; if (replacement.contains("$" + PathMacroUtil.APPLICATION_HOME_DIR + "$")) return 1; - if (replacement.contains("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$")) return 3; + if (replacement.contains(PathMacroUtil.DEPRECATED_MODULE_DIR)) return 3; if (replacement.contains("$" + PathMacroUtil.PROJECT_DIR_MACRO_NAME + "$")) return 3; return 2; }