diff --git a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java index 05ca5e482639..43328ada8bca 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java @@ -11,7 +11,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.PluginId; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.PathUtil; import com.intellij.util.io.URLUtil; @@ -82,7 +82,7 @@ public class BuildProcessClasspathManager { // development mode if (PluginManagerCore.isRunningFromSources()) { // ... try "out/classes/production/", assuming that means module name - String moduleName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(relativePath)); + String moduleName = FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(relativePath)); if (OLD_TO_NEW_MODULE_NAME.containsKey(moduleName)) { moduleName = OLD_TO_NEW_MODULE_NAME.get(moduleName); } diff --git a/java/execution/impl/src/com/intellij/execution/TestClassCollector.java b/java/execution/impl/src/com/intellij/execution/TestClassCollector.java index 6d9c4be6a7aa..8696dfe71165 100644 --- a/java/execution/impl/src/com/intellij/execution/TestClassCollector.java +++ b/java/execution/impl/src/com/intellij/execution/TestClassCollector.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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-2019 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.execution; import com.intellij.execution.testframework.TestSearchScope; @@ -22,7 +8,7 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.roots.OrderEnumerator; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; @@ -81,7 +67,7 @@ public class TestClassCollector { try { Path relativePath = baseDir.relativize(file.getParent()); String subpackageName = StringUtil.getQualifiedName(relativePath.toString().replace(pathSeparator, "."), - FileUtil.getNameWithoutExtension(fName)); + FileUtilRt.getNameWithoutExtension(fName)); String fqName = StringUtil.getQualifiedName(packageName, subpackageName); Class aClass = Class.forName(fqName, false, classLoader); //is potential junit 4 diff --git a/java/execution/impl/src/com/intellij/execution/scratch/JavaScratchCompilationSupport.java b/java/execution/impl/src/com/intellij/execution/scratch/JavaScratchCompilationSupport.java index 68b598992da6..6115db0b8709 100644 --- a/java/execution/impl/src/com/intellij/execution/scratch/JavaScratchCompilationSupport.java +++ b/java/execution/impl/src/com/intellij/execution/scratch/JavaScratchCompilationSupport.java @@ -17,6 +17,7 @@ import com.intellij.openapi.roots.OrderEnumerator; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; @@ -123,7 +124,7 @@ public class JavaScratchCompilationSupport implements CompileTask { } } } - return FileUtil.getNameWithoutExtension(scratchFile); + return FileUtilRt.getNameWithoutExtension(scratchFile.getName()); }); srcFile = new File(srcDir, srcFileName + ".java"); FileUtil.copy(scratchFile, srcFile); diff --git a/java/idea-ui/src/com/intellij/ide/util/importProject/ModuleInsight.java b/java/idea-ui/src/com/intellij/ide/util/importProject/ModuleInsight.java index 73c3a1e7a5bc..d6135bc08649 100644 --- a/java/idea-ui/src/com/intellij/ide/util/importProject/ModuleInsight.java +++ b/java/idea-ui/src/com/intellij/ide/util/importProject/ModuleInsight.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 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.importProject; import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; @@ -22,6 +8,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.Consumer; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.Interner; @@ -234,7 +221,8 @@ public abstract class ModuleInsight { final Set libNames = new HashSet<>(myExistingProjectLibraryNames); for (LibraryDescriptor library : libraries) { final Collection libJars = library.getJars(); - final String newName = suggestUniqueName(libNames, libJars.size() == 1? FileUtil.getNameWithoutExtension(libJars.iterator().next()) : library.getName()); + final String newName = suggestUniqueName(libNames, libJars.size() == 1 ? FileUtilRt + .getNameWithoutExtension(libJars.iterator().next().getName()) : library.getName()); library.setName(newName); libNames.add(newName); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java index f2092cd7beaf..3e93b8218311 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java @@ -1,4 +1,4 @@ -// 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. +// Copyright 2000-2019 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.openapi.roots.ui.configuration.artifacts; import com.intellij.codeInsight.hint.HintManager; @@ -473,7 +473,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx { if (root instanceof ArchivePackagingElement) { String oldFileName = ArtifactUtil.suggestArtifactFileName(oldArtifactName); final String name = ((ArchivePackagingElement)root).getArchiveFileName(); - final String fileName = FileUtil.getNameWithoutExtension(name); + final String fileName = FileUtilRt.getNameWithoutExtension(name); final String extension = FileUtilRt.getExtension(name); if (fileName.equals(oldFileName) && extension.length() > 0) { myLayoutTreeComponent.editLayout( diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ChangeLibraryLevelActionBase.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ChangeLibraryLevelActionBase.java index 6ca383842ce2..5810ff785d27 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ChangeLibraryLevelActionBase.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ChangeLibraryLevelActionBase.java @@ -106,7 +106,7 @@ public abstract class ChangeLibraryLevelActionBase extends AnAction { final File targetDir = new File(FileUtil.toSystemDependentName(targetDirPath)); for (final File from : filesToProcess) { indicator.checkCanceled(); - final File to = FileUtil.findSequentNonexistentFile(targetDir, FileUtil.getNameWithoutExtension(from), + final File to = FileUtil.findSequentNonexistentFile(targetDir, FileUtilRt.getNameWithoutExtension(from.getName()), FileUtilRt.getExtension(from.getName())); try { if (from.isDirectory()) { diff --git a/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java b/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java index 96ce8f8da148..99ac8d47f409 100644 --- a/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java +++ b/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java @@ -1,5 +1,5 @@ -// 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. +// Copyright 2000-2019 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.refactoring.migration; import com.intellij.application.options.CodeStyle; @@ -9,6 +9,7 @@ import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.io.FileFilters; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.text.UniqueNameGenerator; import org.jdom.Document; @@ -95,12 +96,12 @@ public class MigrationMapSet { private static boolean isPredefined(String name) { for (PredefinedMigrationProvider provider : PredefinedMigrationProvider.EP_NAME.getExtensionList()) { URL migrationMap = provider.getMigrationMap(); - String fileName = FileUtil.getNameWithoutExtension(new File(migrationMap.getFile())); + String fileName = FileUtilRt.getNameWithoutExtension(new File(migrationMap.getFile()).getName()); if (fileName.equals(name)) return true; } for (String defaultTemplate : DEFAULT_MAPS) { - String fileName = FileUtil.getNameWithoutExtension(StringUtil.getShortName(defaultTemplate, '/')); + String fileName = FileUtilRt.getNameWithoutExtension(StringUtil.getShortName(defaultTemplate, '/')); if (fileName.equals(name)) return true; } @@ -143,7 +144,7 @@ public class MigrationMapSet { for (PredefinedMigrationProvider provider : PredefinedMigrationProvider.EP_NAME.getExtensionList()) { URL migrationMap = provider.getMigrationMap(); String fileName = new File(migrationMap.getFile()).getName(); - if (myDeletedMaps.contains(FileUtil.getNameWithoutExtension(fileName))) continue; + if (myDeletedMaps.contains(FileUtilRt.getNameWithoutExtension(fileName))) continue; copyMap(dir, migrationMap, fileName); } @@ -151,7 +152,7 @@ public class MigrationMapSet { URL url = MigrationMapSet.class.getResource(defaultTemplate); LOG.assertTrue(url != null); String fileName = defaultTemplate.substring(defaultTemplate.lastIndexOf("/") + 1); - if (myDeletedMaps.contains(FileUtil.getNameWithoutExtension(fileName))) continue; + if (myDeletedMaps.contains(FileUtilRt.getNameWithoutExtension(fileName))) continue; copyMap(dir, url, fileName); } } @@ -192,7 +193,7 @@ public class MigrationMapSet { try { MigrationMap map = readMap(file); if (map != null) { - map.setFileName(FileUtil.getNameWithoutExtension(file)); + map.setFileName(FileUtilRt.getNameWithoutExtension(file.getName())); myMaps.add(map); } } diff --git a/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java b/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java index 23952770b92a..4d07d47bfa0c 100644 --- a/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java +++ b/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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-2019 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.testIntegration; import com.intellij.codeInsight.CodeInsightActionHandler; @@ -33,7 +19,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopupFactory; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.refactoring.util.CommonRefactoringUtil; @@ -74,7 +60,7 @@ public class BaseGenerateTestSupportMethodAction extends BaseGenerateAction { final FileTemplateDescriptor descriptor = methodKind.getFileTemplateDescriptor(framework); if (descriptor != null) { final String fileName = descriptor.getFileName(); - AllFileTemplatesConfigurable.editCodeTemplate(FileUtil.getNameWithoutExtension(fileName), project); + AllFileTemplatesConfigurable.editCodeTemplate(FileUtilRt.getNameWithoutExtension(fileName), project); } else { HintManager.getInstance().showErrorHint(editor, "No template found for " + framework.getName() + ":" + BaseGenerateTestSupportMethodAction.this.getTemplatePresentation().getText()); } diff --git a/java/java-tests/testSrc/com/intellij/java/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java b/java/java-tests/testSrc/com/intellij/java/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java index 8580e552df0e..55971131317a 100644 --- a/java/java-tests/testSrc/com/intellij/java/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java +++ b/java/java-tests/testSrc/com/intellij/java/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java @@ -7,6 +7,7 @@ import com.intellij.compiler.instrumentation.FailSafeClassReader; import com.intellij.compiler.instrumentation.InstrumenterClassWriter; import com.intellij.compiler.notNullVerification.NotNullVerifyingInstrumenter; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.io.IoTestUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.testFramework.IdeaTestUtil; @@ -429,7 +430,7 @@ public abstract class NotNullVerifyingInstrumenterTest { int flags = InstrumenterClassWriter.getAsmClassWriterFlags(InstrumenterClassWriter.getClassFileVersion(reader)); ClassWriter writer = new ClassWriter(reader, flags); modified |= NotNullVerifyingInstrumenter.processClassFile(reader, writer, notNullAnnotations); - String className = FileUtil.getNameWithoutExtension(file.getName()); + String className = FileUtilRt.getNameWithoutExtension(file.getName()); Class aClass = classLoader.doDefineClass(className, writer.toByteArray()); if (className.equals(testName)) { mainClass = aClass; diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsProjectLoader.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsProjectLoader.java index 20bb9e9d67f9..533f66fed497 100644 --- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsProjectLoader.java +++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsProjectLoader.java @@ -1,4 +1,4 @@ -// 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. +// Copyright 2000-2019 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 org.jetbrains.jps.model.serialization; import com.intellij.openapi.diagnostic.Logger; @@ -251,7 +251,7 @@ public class JpsProjectLoader extends JpsLoaderBase { private void loadFromIpr(@NotNull Path iprFile) { final Element iprRoot = loadRootElement(iprFile); - String projectName = FileUtil.getNameWithoutExtension(iprFile.getFileName().toString()); + String projectName = FileUtilRt.getNameWithoutExtension(iprFile.getFileName().toString()); myProject.setName(projectName); Path iwsFile = iprFile.getParent().resolve(projectName + ".iws"); Element iwsRoot = loadRootElement(iwsFile); @@ -463,7 +463,7 @@ public class JpsProjectLoader extends JpsLoaderBase { @NotNull private static String getModuleName(@NotNull Path file) { - return FileUtil.getNameWithoutExtension(file.getFileName().toString()); + return FileUtilRt.getNameWithoutExtension(file.getFileName().toString()); } static JpsMacroExpander createModuleMacroExpander(final Map pathVariables, @NotNull Path moduleFile) { diff --git a/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsArtifactSerializationTest.java b/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsArtifactSerializationTest.java index c5e2b43c438b..003c13d092e6 100644 --- a/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsArtifactSerializationTest.java +++ b/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsArtifactSerializationTest.java @@ -1,21 +1,7 @@ -/* - * Copyright 2000-2017 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-2019 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 org.jetbrains.jps.model.serialization; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import org.jdom.Element; import org.jetbrains.jps.model.artifact.JpsArtifact; import org.jetbrains.jps.model.artifact.JpsArtifactService; @@ -48,7 +34,8 @@ public class JpsArtifactSerializationTest extends JpsSerializationTestCase { List artifactFiles = Files.list(getTestDataAbsoluteFile(SAMPLE_PROJECT_PATH + "/.idea/artifacts")).collect(Collectors.toList()); assertNotNull(artifactFiles); for (Path file : artifactFiles) { - JpsArtifact artifact = getService().createReference(FileUtil.getNameWithoutExtension(file.getFileName().toString())).asExternal(myModel).resolve(); + JpsArtifact artifact = getService().createReference( + FileUtilRt.getNameWithoutExtension(file.getFileName().toString())).asExternal(myModel).resolve(); assertNotNull(artifact); doTestSaveArtifact(artifact, file); } diff --git a/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsProjectSerializationTest.java b/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsProjectSerializationTest.java index b750a9213344..6341b44e5811 100644 --- a/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsProjectSerializationTest.java +++ b/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsProjectSerializationTest.java @@ -1,22 +1,9 @@ -/* - * Copyright 2000-2017 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-2019 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 org.jetbrains.jps.model.serialization; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.model.JpsDummyElement; @@ -236,7 +223,7 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase { List libs = Files.list(getFileInSampleProject(".idea/libraries")).collect(Collectors.toList()); assertNotNull(libs); for (Path libFile : libs) { - String libName = FileUtil.getNameWithoutExtension(libFile.getFileName().toString()); + String libName = FileUtilRt.getNameWithoutExtension(libFile.getFileName().toString()); JpsLibrary library = myProject.getLibraryCollection().findLibrary(libName); assertNotNull(libName, library); doTestSaveLibrary(libFile, libName, library); diff --git a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java index 1b5871d01ddd..5c8a4c1d5e1a 100644 --- a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java +++ b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 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.analysis; @@ -19,7 +17,7 @@ import com.intellij.openapi.project.ProjectCoreUtil; import com.intellij.openapi.project.ProjectUtilCore; import com.intellij.openapi.roots.*; import com.intellij.openapi.roots.libraries.LibraryUtil; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.*; import com.intellij.psi.*; @@ -529,7 +527,7 @@ public class AnalysisScope { @NotNull private static String pathToName(@NotNull String path) { File file = new File(path); - return FileUtil.getNameWithoutExtension(file); + return FileUtilRt.getNameWithoutExtension(file.getName()); } public int getFileCount() { diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/AbstractIdeModifiableModelsProvider.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/AbstractIdeModifiableModelsProvider.java index 6a421b07223a..47b18fe892c9 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/AbstractIdeModifiableModelsProvider.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/AbstractIdeModifiableModelsProvider.java @@ -36,7 +36,7 @@ import com.intellij.openapi.roots.ui.configuration.ModulesProvider; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.UserDataHolderBase; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.packaging.artifacts.ArtifactModel; import com.intellij.packaging.artifacts.ModifiableArtifactModel; @@ -123,7 +123,7 @@ public abstract class AbstractIdeModifiableModelsProvider extends IdeModelsProvi @Override public Module newModule(@NotNull final String filePath, final String moduleTypeId) { Module module = getModifiableModuleModel().newModule(filePath, moduleTypeId); - final String moduleName = FileUtil.getNameWithoutExtension(new File(filePath)); + final String moduleName = FileUtilRt.getNameWithoutExtension(new File(filePath).getName()); if (!module.getName().equals(moduleName)) { try { getModifiableModuleModel().renameModule(module, moduleName); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java index 101a8653889c..747380be32f3 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java @@ -33,6 +33,7 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; @@ -290,7 +291,7 @@ public abstract class AbstractModuleDataService extends Ab for (Path modulePath : orphanModules) { try { String path = FileUtil.loadFile(modulePath.resolveSibling(modulePath.getFileName() + ".path").toFile()); - modulesToRestoreText.append(FileUtil.getNameWithoutExtension(new File(path))).append("\n"); + modulesToRestoreText.append(FileUtilRt.getNameWithoutExtension(new File(path).getName())).append("\n"); modulesToRestore.add(Pair.create(path, modulePath)); } catch (IOException e) { @@ -338,7 +339,7 @@ public abstract class AbstractModuleDataService extends Ab @Override protected JComponent createCenterPanel() { orphanModulesList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - orphanModulesList.setItems(orphanModules, module -> FileUtil.getNameWithoutExtension(new File(module.getFirst()))); + orphanModulesList.setItems(orphanModules, module -> FileUtilRt.getNameWithoutExtension(new File(module.getFirst()).getName())); orphanModulesList.setBorder(JBUI.Borders.empty(5)); JScrollPane myModulesScrollPane = diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/PlainTextFormatter.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/PlainTextFormatter.java index 2f543eacc7c6..3063fbd8cd9a 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/PlainTextFormatter.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/PlainTextFormatter.java @@ -1,8 +1,9 @@ +// Copyright 2000-2019 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.codeInspection.ex; import com.intellij.codeInspection.InspectionApplication; import com.intellij.codeInspection.InspectionsReportConverter; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.io.URLUtil; import org.jdom.Document; @@ -87,7 +88,7 @@ public class PlainTextFormatter implements InspectionsReportConverter { warn("Folder isn't expected here: " + inspectionData.getName()); continue; } - final String fileNameWithoutExt = FileUtil.getNameWithoutExtension(inspectionData); + final String fileNameWithoutExt = FileUtilRt.getNameWithoutExtension(inspectionData.getName()); if (InspectionApplication.DESCRIPTIONS.equals(fileNameWithoutExt)) { continue; } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/XSLTReportConverter.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/XSLTReportConverter.java index 706f9b1d606a..b6900528bc74 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/XSLTReportConverter.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/XSLTReportConverter.java @@ -1,23 +1,9 @@ -/* - * Copyright 2000-2011 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-2019 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.codeInspection.ex; import com.intellij.codeInspection.InspectionApplication; import com.intellij.codeInspection.InspectionsReportConverter; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -94,7 +80,7 @@ public class XSLTReportConverter implements InspectionsReportConverter { warn("Folder isn't expected here: " + inspectionData.getName()); continue; } - final String fileNameWithoutExt = FileUtil.getNameWithoutExtension(inspectionData); + final String fileNameWithoutExt = FileUtilRt.getNameWithoutExtension(inspectionData.getName()); if (InspectionApplication.DESCRIPTIONS.equals(fileNameWithoutExt)) { continue; } diff --git a/platform/lang-impl/src/com/intellij/framework/library/impl/LibraryVersionsFetcher.java b/platform/lang-impl/src/com/intellij/framework/library/impl/LibraryVersionsFetcher.java index f8360f9c55c8..82b16a8a6386 100644 --- a/platform/lang-impl/src/com/intellij/framework/library/impl/LibraryVersionsFetcher.java +++ b/platform/lang-impl/src/com/intellij/framework/library/impl/LibraryVersionsFetcher.java @@ -1,27 +1,12 @@ -/* - * Copyright 2000-2011 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-2019 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.framework.library.impl; import com.intellij.facet.frameworks.beans.Artifact; import com.intellij.facet.frameworks.beans.ArtifactItem; +import com.intellij.framework.FrameworkAvailabilityCondition; import com.intellij.framework.library.DownloadableLibraryDescription; import com.intellij.framework.library.DownloadableLibraryFileDescription; -import com.intellij.framework.FrameworkAvailabilityCondition; import com.intellij.framework.library.FrameworkLibraryVersion; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.download.impl.FileSetVersionsFetcherBase; import org.jetbrains.annotations.NotNull; @@ -59,6 +44,6 @@ public class LibraryVersionsFetcher extends FileSetVersionsFetcherBase= 1) { - return FileUtil.getNameWithoutExtension(PathUtil.getFileName(classesRoots[0].getPath())); + return FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(classesRoots[0].getPath())); } return DEFAULT_LIBRARY_NAME; } @@ -78,7 +68,7 @@ public class LibraryTypeServiceImpl extends LibraryTypeService { @NotNull public static String suggestLibraryName(@NotNull List roots) { if (roots.size() >= 1) { - return FileUtil.getNameWithoutExtension(PathUtil.getFileName(roots.get(0).getFile().getPath())); + return FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(roots.get(0).getFile().getPath())); } return DEFAULT_LIBRARY_NAME; } 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 5fa9e8911a81..629e384380bb 100644 --- a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java @@ -30,7 +30,7 @@ import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.JDOMUtil; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.io.StreamUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtil; @@ -105,7 +105,7 @@ public class SaveProjectAsTemplateAction extends AnAction implements DumbAware { AnAction manageAction = ActionManager.getInstance().getAction("ManageProjectTemplates"); Notification notification = new Notification("Project Template", "Template Created", - FileUtil.getNameWithoutExtension(file.getFileName().toString()) + + FileUtilRt.getNameWithoutExtension(file.getFileName().toString()) + " was successfully created", NotificationType.INFORMATION ); diff --git a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java index b811c12e879b..780f075df44a 100644 --- a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java +++ b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java @@ -1,4 +1,4 @@ -// 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. +// Copyright 2000-2019 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.platform.templates; import com.intellij.ide.util.projectWizard.ProjectTemplateParameterFactory; @@ -10,7 +10,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.ValidationInfo; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; @@ -109,7 +109,7 @@ public class SaveProjectAsTemplateDialog extends DialogWrapper { Path file = getTemplateFile(); if (PathKt.exists(file)) { if (Messages.showYesNoDialog(myPanel, - FileUtil.getNameWithoutExtension(file.getFileName().toString()) + " exists already.\n" + + FileUtilRt.getNameWithoutExtension(file.getFileName().toString()) + " exists already.\n" + "Do you want to replace it with the new one?", "Template Already Exists", Messages.getWarningIcon()) == Messages.NO) { return; diff --git a/platform/lang-impl/src/com/intellij/util/download/impl/DownloadableFileServiceImpl.java b/platform/lang-impl/src/com/intellij/util/download/impl/DownloadableFileServiceImpl.java index 96d1e4ef84b7..0bd0ec992920 100644 --- a/platform/lang-impl/src/com/intellij/util/download/impl/DownloadableFileServiceImpl.java +++ b/platform/lang-impl/src/com/intellij/util/download/impl/DownloadableFileServiceImpl.java @@ -1,24 +1,9 @@ -/* - * Copyright 2000-2011 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-2019 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.util.download.impl; import com.intellij.facet.frameworks.beans.Artifact; import com.intellij.facet.frameworks.beans.ArtifactItem; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.download.*; import org.jetbrains.annotations.NotNull; @@ -35,7 +20,7 @@ public class DownloadableFileServiceImpl extends DownloadableFileService { @NotNull @Override public DownloadableFileDescription createFileDescription(@NotNull String downloadUrl, @NotNull String fileName) { - return new DownloadableFileDescriptionImpl(downloadUrl, FileUtil.getNameWithoutExtension(fileName), FileUtilRt.getExtension(fileName)); + return new DownloadableFileDescriptionImpl(downloadUrl, FileUtilRt.getNameWithoutExtension(fileName), FileUtilRt.getExtension(fileName)); } @NotNull diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java b/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java index be4c433b9ca3..7b9aee8bc023 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java @@ -12,6 +12,7 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.updateSettings.impl.UpdateSettings; import com.intellij.openapi.util.BuildNumber; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.Url; import com.intellij.util.Urls; import com.intellij.util.containers.ContainerUtil; @@ -241,7 +242,7 @@ public class RepositoryHelper { } if (node.getName() == null) { String url = node.getDownloadUrl(); - node.setName(FileUtil.getNameWithoutExtension(url.substring(url.lastIndexOf('/') + 1))); + node.setName(FileUtilRt.getNameWithoutExtension(url.substring(url.lastIndexOf('/') + 1))); } IdeaPluginDescriptor previous = result.get(pluginId); diff --git a/platform/platform-impl/src/com/intellij/ui/Splash.java b/platform/platform-impl/src/com/intellij/ui/Splash.java index 60bca0f95dac..4ec7da89994e 100644 --- a/platform/platform-impl/src/com/intellij/ui/Splash.java +++ b/platform/platform-impl/src/com/intellij/ui/Splash.java @@ -19,7 +19,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import java.util.Objects; /** * To customize your IDE splash go to YourIdeNameApplicationInfo.xml and edit 'logo' tag. For more information see documentation for diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsFromHistoryAction.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsFromHistoryAction.java index 8e6e9629c3b0..0d7b29e6d43a 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsFromHistoryAction.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsFromHistoryAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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-2019 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.execution.testframework.sm.runner.history.actions; import com.intellij.execution.TestStateStorage; @@ -20,7 +6,7 @@ import com.intellij.execution.testframework.sm.TestHistoryConfiguration; import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties; import com.intellij.execution.testframework.sm.runner.ui.SMTestRunnerResultsForm; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; @@ -35,7 +21,7 @@ import java.util.Date; public class ImportTestsFromHistoryAction extends AbstractImportTestsAction { private final String myFileName; - + public ImportTestsFromHistoryAction(@Nullable SMTRunnerConsoleProperties properties, Project project, String name) { super(properties, StringUtil.escapeMnemonics(getPresentableText(project, name)), getPresentableText(project, name), getIcon(project, name)); myFileName = name; @@ -47,14 +33,14 @@ public class ImportTestsFromHistoryAction extends AbstractImportTestsAction { @NotNull private static String getPresentableText(Project project, String name) { - String nameWithoutExtension = FileUtil.getNameWithoutExtension(name); + String nameWithoutExtension = FileUtilRt.getNameWithoutExtension(name); final int lastIndexOf = nameWithoutExtension.lastIndexOf(" - "); if (lastIndexOf > 0) { final String date = nameWithoutExtension.substring(lastIndexOf + 3); try { final Date creationDate = new SimpleDateFormat(SMTestRunnerResultsForm.HISTORY_DATE_FORMAT).parse(date); final String configurationName = TestHistoryConfiguration.getInstance(project).getConfigurationName(name); - return (configurationName != null ? configurationName : nameWithoutExtension.substring(0, lastIndexOf)) + + return (configurationName != null ? configurationName : nameWithoutExtension.substring(0, lastIndexOf)) + " (" + DateFormatUtil.formatDateTime(creationDate) + ")"; } catch (ParseException ignore) {} diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestUtil.java index dc0e3d057561..2f6ab11fc7d8 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestUtil.java @@ -30,7 +30,6 @@ import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; @@ -87,7 +86,7 @@ public class CodeInsightTestUtil { @TestOnly public static void doIntentionTest(CodeInsightTestFixture fixture, @NonNls String file, @NonNls String actionText) { String extension = FileUtilRt.getExtension(file); - file = FileUtil.getNameWithoutExtension(file); + file = FileUtilRt.getNameWithoutExtension(file); if (extension.isEmpty()) extension = "xml"; doIntentionTest(fixture, actionText, file + "." + extension, file + "_after." + extension); } @@ -118,7 +117,7 @@ public class CodeInsightTestUtil { } }); } - + public static void doWordSelectionTestOnDirectory(@NotNull final CodeInsightTestFixture fixture, @TestDataFile @NotNull final String directoryName, @NotNull final String filesExtension) { @@ -221,7 +220,7 @@ public class CodeInsightTestUtil { public static void doActionTest(AnAction action, String file, CodeInsightTestFixture fixture) { String extension = FileUtilRt.getExtension(file); - String name = FileUtil.getNameWithoutExtension(file); + String name = FileUtilRt.getNameWithoutExtension(file); fixture.configureByFile(file); fixture.testAction(action); fixture.checkResultByFile(name + "_after." + extension); diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java index f7b17aea0111..21d965b1bf30 100644 --- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java +++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java @@ -551,7 +551,7 @@ public class FileUtil extends FileUtilRt { @NotNull public static String getNameWithoutExtension(@NotNull File file) { - return getNameWithoutExtension(file.getName()); + return FileUtilRt.getNameWithoutExtension(file.getName()); } @NotNull diff --git a/platform/util/ui/src/com/intellij/util/ImageLoader.java b/platform/util/ui/src/com/intellij/util/ImageLoader.java index 48c843c44aff..4dfe18b87362 100644 --- a/platform/util/ui/src/com/intellij/util/ImageLoader.java +++ b/platform/util/ui/src/com/intellij/util/ImageLoader.java @@ -6,7 +6,6 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.SystemInfoRt; import com.intellij.openapi.util.io.BufferExposingByteArrayInputStream; import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtilRt; @@ -300,7 +299,7 @@ public class ImageLoader implements Serializable { // retina images provides a better result than up-scaling non-retina images. boolean retina = JBUI.isHiDPI(ctx.getScale(PIX_SCALE)); - Builder list = new Builder(FileUtil.getNameWithoutExtension(path), + Builder list = new Builder(FileUtilRt.getNameWithoutExtension(path), FileUtilRt.getExtension(path), cls, true, diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java index 3049c4567763..3f331165ebe1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java @@ -13,6 +13,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.changes.patch.RelativePathCalculator; @@ -593,7 +594,7 @@ public class PathsVerifier { File destFile = new File(newParentFile, tmpFileWithUniqueName.getName()); while (destFile.exists()) { destFile = new File(newParentFile, - FileUtil.createTempFile(oldParent, FileUtil.getNameWithoutExtension(destFile.getName()), null, false) + FileUtil.createTempFile(oldParent, FileUtilRt.getNameWithoutExtension(destFile.getName()), null, false) .getName()); } myCurrent.rename(PatchApplier.class, destFile.getName()); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java index 6217855a8c14..a0858933e278 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java @@ -595,7 +595,7 @@ public class ShelveChangesManager implements PersistentStateComponent, String shelvedPath = null; if (afterFile != null) { String shelvedFileName = afterFile.getName(); - String name = FileUtil.getNameWithoutExtension(shelvedFileName); + String name = FileUtilRt.getNameWithoutExtension(shelvedFileName); String extension = FileUtilRt.getExtension(shelvedFileName); File shelvedFile = FileUtil.findSequentNonexistentFile(schemePatchDir, name, extension); FileUtil.copy(afterRevision.getFile().getIOFile(), shelvedFile); diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java index c8fa16487656..908826d6fcc0 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java @@ -1,11 +1,11 @@ -// 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. +// Copyright 2000-2019 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.siyeh.ipp.modifiers; import com.intellij.codeInsight.intention.LowPriorityAction; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.impl.source.resolve.JavaResolveUtil; @@ -109,7 +109,7 @@ abstract class ModifierIntention extends Intention implements LowPriorityAction return MultiMap.emptyInstance(); } final PsiJavaFile javaFile = (PsiJavaFile)parent; - final String name = FileUtil.getNameWithoutExtension(javaFile.getName()); + final String name = FileUtilRt.getNameWithoutExtension(javaFile.getName()); final String className = aClass.getName(); if (name.equals(className)) { return MultiMap.emptyInstance(); diff --git a/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java b/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java index 420def355719..fbd1c83bbfb8 100644 --- a/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java +++ b/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java @@ -136,7 +136,7 @@ public class JavaCoverageEngine extends CoverageEngine { final int line = in.readInt(); if (Comparing.strEqual(className, classFQName)) { if (lineNumber == line) { - tests.add(FileUtil.getNameWithoutExtension(traceFile)); + tests.add(FileUtilRt.getNameWithoutExtension(traceFile.getName())); return; } } @@ -162,7 +162,7 @@ public class JavaCoverageEngine extends CoverageEngine { private static File getTracesDirectory(CoverageSuite coverageSuite) { final String filePath = coverageSuite.getCoverageDataFileName(); - final String dirName = FileUtil.getNameWithoutExtension(new File(filePath).getName()); + final String dirName = FileUtilRt.getNameWithoutExtension(new File(filePath).getName()); final File parentDir = new File(filePath).getParentFile(); return new File(parentDir, dirName); @@ -372,7 +372,7 @@ public class JavaCoverageEngine extends CoverageEngine { @NotNull public String getQualifiedName(@NotNull final File outputFile, @NotNull final PsiFile sourceFile) { final String packageFQName = getPackageName(sourceFile); - return StringUtil.getQualifiedName(packageFQName, FileUtil.getNameWithoutExtension(outputFile)); + return StringUtil.getQualifiedName(packageFQName, FileUtilRt.getNameWithoutExtension(outputFile.getName())); } @NotNull @@ -436,7 +436,7 @@ public class JavaCoverageEngine extends CoverageEngine { final String className = ReadAction.compute(() -> psiClass.getName()); for (File child : children) { if (FileUtilRt.extensionEquals(child.getName(), StdFileTypes.CLASS.getDefaultExtension())) { - final String childName = FileUtil.getNameWithoutExtension(child); + final String childName = FileUtilRt.getNameWithoutExtension(child.getName()); if (childName.equals(className) || //class or inner childName.startsWith(className) && childName.charAt(className.length()) == '$') { classFiles.add(child); diff --git a/plugins/devkit/devkit-core/src/build/PrepareToDeployAction.java b/plugins/devkit/devkit-core/src/build/PrepareToDeployAction.java index a328c041cb96..f87ce129cbf9 100644 --- a/plugins/devkit/devkit-core/src/build/PrepareToDeployAction.java +++ b/plugins/devkit/devkit-core/src/build/PrepareToDeployAction.java @@ -23,6 +23,7 @@ import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.*; import com.intellij.psi.xml.XmlFile; @@ -179,7 +180,7 @@ public class PrepareToDeployAction extends AnAction { String classpath = tag.getAttributeValue("classpath"); if (classpath != null) { for (String path : StringUtil.split(classpath, ";")) { - String moduleName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(path)); + String moduleName = FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(path)); Module jpsModule = ModuleManager.getInstance(module.getProject()).findModuleByName(moduleName); if (jpsModule != null) { jpsPluginToOutputPath.put(jpsModule, path); diff --git a/plugins/devkit/devkit-core/src/icons/Theme.java b/plugins/devkit/devkit-core/src/icons/Theme.java index 470c89581e17..cee82bc21e3a 100644 --- a/plugins/devkit/devkit-core/src/icons/Theme.java +++ b/plugins/devkit/devkit-core/src/icons/Theme.java @@ -1,8 +1,8 @@ -// 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. +// Copyright 2000-2019 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 org.jetbrains.idea.devkit.icons; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.VirtualFile; import org.intellij.images.thumbnail.ThumbnailView; import org.intellij.images.thumbnail.actions.ThemeFilter; @@ -11,7 +11,7 @@ public enum Theme implements ThemeFilter{ WHITE(null, "Default") { @Override public boolean accepts(VirtualFile fileName) { - String nameWithoutExtension = FileUtil.getNameWithoutExtension(fileName.getName()); + String nameWithoutExtension = FileUtilRt.getNameWithoutExtension(fileName.getName()); for (Theme theme : values()) { String extension = theme.getExtension(); if (extension != null && nameWithoutExtension.endsWith(extension)) { @@ -25,13 +25,13 @@ public enum Theme implements ThemeFilter{ HIGH_DPI_WHITE("@2x", "Default HiDPI") { @Override public boolean accepts(VirtualFile fileName) { - return FileUtil.getNameWithoutExtension(fileName.getName()).endsWith(getExtension()); + return FileUtilRt.getNameWithoutExtension(fileName.getName()).endsWith(getExtension()); } }, DARK("_dark", "Darcula") { @Override public boolean accepts(VirtualFile file) { - String name = FileUtil.getNameWithoutExtension(file.getName()); + String name = FileUtilRt.getNameWithoutExtension(file.getName()); if (name.endsWith(getExtension()) && !name.endsWith(HIGH_DPI_DARK.getExtension())) { return true; } @@ -45,7 +45,7 @@ public enum Theme implements ThemeFilter{ HIGH_DPI_DARK("@2x_dark", "Darcula HiDPI") { @Override public boolean accepts(VirtualFile file) { - String name = FileUtil.getNameWithoutExtension(file.getName()); + String name = FileUtilRt.getNameWithoutExtension(file.getName()); if (name.endsWith(getExtension())) { return true; } diff --git a/plugins/devkit/devkit-core/src/navigation/DescriptionInspectionGotoRelatedProvider.java b/plugins/devkit/devkit-core/src/navigation/DescriptionInspectionGotoRelatedProvider.java index b592ba247266..be8d6e87d83b 100644 --- a/plugins/devkit/devkit-core/src/navigation/DescriptionInspectionGotoRelatedProvider.java +++ b/plugins/devkit/devkit-core/src/navigation/DescriptionInspectionGotoRelatedProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// Copyright 2000-2019 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 org.jetbrains.idea.devkit.navigation; import com.intellij.codeInspection.InspectionProfileEntry; @@ -11,7 +11,7 @@ import com.intellij.openapi.actionSystem.LangDataKeys; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.JavaPsiFacade; import com.intellij.psi.PsiClass; @@ -68,7 +68,7 @@ public class DescriptionInspectionGotoRelatedProvider extends GotoRelatedProvide // Try to find class by description name first. It may improve performance significantly. PsiShortNamesCache psiShortNamesCache = PsiShortNamesCache.getInstance(project); - String possibleImplementationName = FileUtil.getNameWithoutExtension(descriptionFile.getName()) + "Inspection"; + String possibleImplementationName = FileUtilRt.getNameWithoutExtension(descriptionFile.getName()) + "Inspection"; Set checkedPossibleImplementation = new HashSet<>(); for (GlobalSearchScope scope : DescriptionCheckerUtil.searchScopes(module)) { PsiClass[] possibleImplementations = psiShortNamesCache.getClassesByName(possibleImplementationName, scope); diff --git a/plugins/devkit/devkit-core/src/refactoring/InspectionAutomaticRenamerFactory.java b/plugins/devkit/devkit-core/src/refactoring/InspectionAutomaticRenamerFactory.java index 31f15d786fd0..ab89728ea32a 100644 --- a/plugins/devkit/devkit-core/src/refactoring/InspectionAutomaticRenamerFactory.java +++ b/plugins/devkit/devkit-core/src/refactoring/InspectionAutomaticRenamerFactory.java @@ -1,13 +1,11 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 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 org.jetbrains.idea.devkit.refactoring; import com.intellij.ide.util.PropertiesComponent; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.ElementManipulators; @@ -128,7 +126,7 @@ public class InspectionAutomaticRenamerFactory implements AutomaticRenamerFactor String descriptionFileName = descriptionFile.getName(); String defaultShortName = getDescriptionFileName(inspectionClassName); - if (!newName.endsWith(INSPECTION_CLASS_SUFFIX) || !defaultShortName.equals(FileUtil.getNameWithoutExtension(descriptionFileName))) { + if (!newName.endsWith(INSPECTION_CLASS_SUFFIX) || !defaultShortName.equals(FileUtilRt.getNameWithoutExtension(descriptionFileName))) { return; } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java index aa29fc7c6930..84fd9d894b2e 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java @@ -15,6 +15,7 @@ import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunCo import com.intellij.openapi.externalSystem.util.OutputWrapper; import com.intellij.openapi.util.Couple; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.io.StreamUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.*; @@ -709,7 +710,7 @@ public class GradleExecutionHelper { final Set jarPaths = ContainerUtil.map2SetNotNull(toolingExtensionClasses, aClass -> { String path = PathManager.getJarPathForClass(aClass); if (path != null) { - if (FileUtil.getNameWithoutExtension(path).equals("gradle-api-" + GradleVersion.current().getBaseVersion())) { + if (FileUtilRt.getNameWithoutExtension(path).equals("gradle-api-" + GradleVersion.current().getBaseVersion())) { LOG.warn("The gradle api jar shouldn't be added to the gradle daemon classpath: {" + aClass + "," + path + "}"); return null; } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java index 69e5ddd5916a..44e8a88af49e 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java @@ -1116,7 +1116,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver level = LibraryLevel.PROJECT; libraryName = String.format("%s:%s:%s", moduleVersion.getGroup(), moduleVersion.getName(), moduleVersion.getVersion()); if (binaryPath.isFile()) { - String libraryFileName = FileUtil.getNameWithoutExtension(binaryPath); + String libraryFileName = FileUtilRt.getNameWithoutExtension(binaryPath.getName()); final String mavenLibraryFileName = String.format("%s-%s", moduleVersion.getName(), moduleVersion.getVersion()); if (!mavenLibraryFileName.equals(libraryFileName)) { Pattern pattern = Pattern.compile(moduleVersion.getName() + "-" + moduleVersion.getVersion() + "-(.*)"); @@ -1179,7 +1179,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver private String chooseName(File path, LibraryLevel level, DataNode ideProject) { - final String fileName = FileUtil.getNameWithoutExtension(path); + final String fileName = FileUtilRt.getNameWithoutExtension(path.getName()); if (level == LibraryLevel.MODULE) { return fileName; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java index 4048bb87d26b..72cde54010ff 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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-2019 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 org.jetbrains.plugins.groovy.refactoring.convertToJava; import com.intellij.codeInsight.daemon.impl.quickfix.MoveClassToSeparateFileFix; @@ -21,7 +7,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.codeStyle.JavaCodeStyleManager; @@ -141,7 +127,7 @@ public class ConvertToJavaProcessor extends BaseRefactoringProcessor { for (PsiFile psiFile : files) { fileNames.add(psiFile.getName()); } - String prefix = FileUtil.getNameWithoutExtension(file.getName()); + String prefix = FileUtilRt.getNameWithoutExtension(file.getName()); String fileName = prefix + ".java"; int index = 1; while (fileNames.contains(fileName)) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenameGroovyScriptProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenameGroovyScriptProcessor.java index de3bdc8a74a6..f45b6e78d06e 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenameGroovyScriptProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenameGroovyScriptProcessor.java @@ -1,7 +1,7 @@ -// 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. +// Copyright 2000-2019 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 org.jetbrains.plugins.groovy.refactoring.rename; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; @@ -27,7 +27,7 @@ public class RenameGroovyScriptProcessor extends RenamePsiFileProcessor { if (element instanceof GroovyFile) { final PsiClass script = ((GroovyFile)element).getScriptClass(); if (script != null && script.isValid()) { - final String scriptName = FileUtil.getNameWithoutExtension(newName); + final String scriptName = FileUtilRt.getNameWithoutExtension(newName); if (StringUtil.isJavaIdentifier(scriptName)) { allRenames.put(script, scriptName); } @@ -37,7 +37,7 @@ public class RenameGroovyScriptProcessor extends RenamePsiFileProcessor { @Override public void findExistingNameConflicts(@NotNull PsiElement element, @NotNull String newName, @NotNull MultiMap conflicts) { - final String scriptName = FileUtil.getNameWithoutExtension(newName); + final String scriptName = FileUtilRt.getNameWithoutExtension(newName); if (!StringUtil.isJavaIdentifier(scriptName)) { final PsiClass script = ((GroovyFile)element).getScriptClass(); conflicts.putValue(script, GroovyRefactoringBundle.message("cannot.rename.script.class.to.0", script.getName(), scriptName)); diff --git a/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/AbstractJavaFxPackager.java b/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/AbstractJavaFxPackager.java index cbeafe257367..2e9501b4642d 100644 --- a/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/AbstractJavaFxPackager.java +++ b/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/AbstractJavaFxPackager.java @@ -1,4 +1,4 @@ -// 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. +// Copyright 2000-2019 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 org.jetbrains.plugins.javaFX.packaging; import com.intellij.execution.CommandLineUtil; @@ -10,6 +10,7 @@ import com.intellij.openapi.application.PathManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ArrayUtilRt; import com.intellij.util.PathUtilRt; @@ -88,7 +89,7 @@ public abstract class AbstractJavaFxPackager { tempUnzippedArtifactOutput = FileUtil.createTempDirectory("artifact", "unzipped"); final File artifactOutputFile = new File(zipPath); ZipUtil.extract(artifactOutputFile, tempUnzippedArtifactOutput, null); - copyLibraries(FileUtil.getNameWithoutExtension(artifactOutputFile), tempUnzippedArtifactOutput); + copyLibraries(FileUtilRt.getNameWithoutExtension(artifactOutputFile.getName()), tempUnzippedArtifactOutput); } catch (IOException e) { registerJavaFxPackagerError(e); diff --git a/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java b/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java index 4c84bfaaef9c..da805a3cf56c 100644 --- a/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java +++ b/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java @@ -1,23 +1,10 @@ -/* - * Copyright 2000-2013 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-2019 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 org.jetbrains.plugins.javaFX.packaging; import com.intellij.openapi.util.Couple; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; @@ -33,13 +20,13 @@ public class JavaFxAntGenerator { String tempDirPath, String tempDirDeployPath, String relativeToBaseDirPath) { - final String artifactFileNameWithoutExtension = FileUtil.getNameWithoutExtension(artifactFileName); + final String artifactFileNameWithoutExtension = FileUtilRt.getNameWithoutExtension(artifactFileName); final List topLevelTagsCollector = new ArrayList<>(); final String preloaderJar = packager.getPreloaderJar(); final String preloaderClass = packager.getPreloaderClass(); String preloaderFiles = null; String allButPreloader = null; - + if (!StringUtil.isEmptyOrSpaces(preloaderJar) && !StringUtil.isEmptyOrSpaces(preloaderClass)) { preloaderFiles = artifactFileNameWithoutExtension + "_preloader_files"; topLevelTagsCollector.add(new SimpleTag("fx:fileset", @@ -338,7 +325,7 @@ public class JavaFxAntGenerator { public void addAttribute(Pair attr) { myPairs.add(attr); } - + public void add(SimpleTag tag) { mySubTags.add(tag); } diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java index 12ff34310ff5..58b64fe5d4e7 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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-2019 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 org.jetbrains.plugins.javaFX.packaging.ant; import com.intellij.compiler.ant.*; @@ -23,7 +9,7 @@ import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.util.Couple; import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.packaging.artifacts.Artifact; import com.intellij.packaging.artifacts.ArtifactManager; import com.intellij.packaging.artifacts.ArtifactType; @@ -91,7 +77,7 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension { protected List computeChildrenGenerators(PackagingElementResolvingContext resolvingContext, final AntCopyInstructionCreator copyInstructionCreator, - final ArtifactAntGenerationContext generationContext, + final ArtifactAntGenerationContext generationContext, ArtifactType artifactType, List> children) { final List generators = new ArrayList<>(); @@ -100,7 +86,7 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension { } return generators; } - + @Override public void generateTasksForArtifact(Artifact artifact, boolean preprocessing, @@ -122,13 +108,13 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension { } } - final String artifactName = FileUtil.getNameWithoutExtension(artifactFileName); + final String artifactName = FileUtilRt.getNameWithoutExtension(artifactFileName); final String tempDirPath = BuildProperties.propertyRef( context.createNewTempFileProperty("artifact.temp.output." + artifactName, artifactFileName)); final PackagingElementResolvingContext resolvingContext = ArtifactManager.getInstance(context.getProject()).getResolvingContext(); - for (Generator childGenerator : computeChildrenGenerators(resolvingContext, + for (Generator childGenerator : computeChildrenGenerators(resolvingContext, new DirectoryAntCopyInstructionCreator(tempDirPath), context, artifact.getArtifactType(), children)) { generator.add(childGenerator); @@ -171,15 +157,15 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension { final String keypass = selfSigning ? "keypass" : new String(Base64.getDecoder().decode(properties.getKeypass()), StandardCharsets.UTF_8); generator.add(new Property(artifactBasedProperty(ARTIFACTKEYPASS_SIGN_PROPERTY, artifactName), keypass)); - + final Pair[] keysDescriptions = createKeysDescriptions(artifactName); if (selfSigning) { - generator.add(new Tag("genkey", + generator.add(new Tag("genkey", ArrayUtil.prepend(Couple.of("dname", BuildProperties .propertyRef(artifactBasedProperty(ARTIFACT_VENDOR_SIGN_PROPERTY, artifactName))), keysDescriptions))); } - + final Tag signjar = new Tag("signjar", keysDescriptions); final Tag fileset = new Tag("fileset", Couple.of("dir", tempDirDeployPath)); fileset.add(new Tag("include", Couple.of("name", "*.jar"))); diff --git a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java index d71f13443ad1..125d18dcde81 100644 --- a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java +++ b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 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.lang.properties; import com.intellij.lang.properties.psi.PropertiesFile; @@ -8,7 +6,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; @@ -101,7 +99,7 @@ public class PropertiesUtil { final String name = file.getName(); if (!StringUtil.containsChar(name, '_')) { - return FileUtil.getNameWithoutExtension(name); + return FileUtilRt.getNameWithoutExtension(name); } final Matcher matcher = LOCALE_PATTERN.matcher(name); @@ -118,11 +116,11 @@ public class PropertiesUtil { continue; } baseNameWithExtension = name.substring(0, matchResult.start(1)) + name.substring(matchResult.end(1)); - return FileUtil.getNameWithoutExtension(baseNameWithExtension); + return FileUtilRt.getNameWithoutExtension(baseNameWithExtension); } } baseNameWithExtension = name; - return FileUtil.getNameWithoutExtension(baseNameWithExtension); + return FileUtilRt.getNameWithoutExtension(baseNameWithExtension); } }); } @@ -250,7 +248,7 @@ public class PropertiesUtil { public static String getSuffix(@NotNull PropertiesFile propertiesFile) { final String baseName = propertiesFile.getResourceBundle().getBaseName(); final String propertiesFileName = propertiesFile.getName(); - if (baseName.equals(FileUtil.getNameWithoutExtension(propertiesFileName))) return ""; - return FileUtil.getNameWithoutExtension(propertiesFileName.substring(baseName.length() + 1)); + if (baseName.equals(FileUtilRt.getNameWithoutExtension(propertiesFileName))) return ""; + return FileUtilRt.getNameWithoutExtension(propertiesFileName.substring(baseName.length() + 1)); } } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java index 2e953d4483e7..950b43c93008 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java @@ -1,4 +1,4 @@ -// 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. +// Copyright 2000-2019 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.lang.properties.editor; import com.intellij.codeInsight.FileModificationService; @@ -18,7 +18,7 @@ import com.intellij.openapi.ui.ComboBox; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.ValidationInfo; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; @@ -166,7 +166,7 @@ public class PropertiesCopyHandler extends CopyHandlerDelegateBase { @NotNull private static String getPropertiesFileSuffix(PropertiesFile searchFile, String baseName) { - String suffix = FileUtil.getNameWithoutExtension(searchFile.getContainingFile().getName()); + String suffix = FileUtilRt.getNameWithoutExtension(searchFile.getContainingFile().getName()); suffix = StringUtil.trimStart(suffix, baseName); return suffix; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java index 40424686e2be..a026127e30e3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java @@ -1,7 +1,8 @@ -// 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. +// Copyright 2000-2019 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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.configurations.GeneralCommandLine; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.EnvironmentUtil; import com.intellij.util.execution.ParametersListUtil; import org.jetbrains.annotations.NotNull; @@ -13,7 +14,6 @@ import org.jetbrains.idea.svn.SvnConfigurationState; import java.util.List; import static com.intellij.execution.CommandLineUtil.toCommandLine; -import static com.intellij.openapi.util.io.FileUtil.getNameWithoutExtension; import static com.intellij.openapi.util.io.FileUtil.toSystemIndependentName; import static com.intellij.openapi.util.text.StringUtil.*; import static com.intellij.util.ObjectUtils.notNull; @@ -58,7 +58,7 @@ public class SshTunnelRuntimeModule extends BaseCommandRuntimeModule { @NotNull private GeneralCommandLine buildTunnelCommandLine(@NotNull String sshPath) { GeneralCommandLine result = new GeneralCommandLine(sshPath); - boolean isPuttyLinkClient = endsWithIgnoreCase(getNameWithoutExtension(sshPath), "plink"); + boolean isPuttyLinkClient = endsWithIgnoreCase(FileUtilRt.getNameWithoutExtension(sshPath), "plink"); SvnConfigurationState state = getState(); // quiet mode diff --git a/python/src/com/jetbrains/python/buildout/BuildoutFacet.java b/python/src/com/jetbrains/python/buildout/BuildoutFacet.java index c1841f08c13f..7d4dc345fe3f 100644 --- a/python/src/com/jetbrains/python/buildout/BuildoutFacet.java +++ b/python/src/com/jetbrains/python/buildout/BuildoutFacet.java @@ -173,7 +173,7 @@ public class BuildoutFacet extends LibraryContributingFacet paths = extractFromScript(script); if (paths == null) { VirtualFile root = script.getParent().getParent(); - String partName = FileUtil.getNameWithoutExtension(script.getName()); + String partName = FileUtilRt.getNameWithoutExtension(script.getName()); if (SystemInfoRt.isWindows && partName.endsWith(SCRIPT_SUFFIX)) { partName = partName.substring(0, partName.length() - SCRIPT_SUFFIX.length()); } @@ -356,7 +356,7 @@ public class BuildoutFacet extends LibraryContributingFacet scripts = getScripts(buildoutFacet, baseDir); for (File script : scripts) { - if (FileUtil.getNameWithoutExtension(script.getName()).equals(scriptName)) { + if (FileUtilRt.getNameWithoutExtension(script.getName()).equals(scriptName)) { return script; } } diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PyCompletionUtils.kt b/python/src/com/jetbrains/python/codeInsight/completion/PyCompletionUtils.kt index 9328f2725916..14aec77e6c93 100644 --- a/python/src/com/jetbrains/python/codeInsight/completion/PyCompletionUtils.kt +++ b/python/src/com/jetbrains/python/codeInsight/completion/PyCompletionUtils.kt @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 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.jetbrains.python.codeInsight.completion import com.intellij.codeInsight.TailType @@ -11,7 +9,6 @@ import com.intellij.codeInsight.completion.CompletionResultSet import com.intellij.codeInsight.lookup.LookupElementBuilder import com.intellij.codeInsight.lookup.TailTypeDecorator import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.PsiDirectory import com.intellij.psi.PsiFile import com.intellij.psi.PsiFileSystemItem import com.jetbrains.python.PyNames @@ -21,7 +18,6 @@ import com.jetbrains.python.psi.PyFile import com.jetbrains.python.psi.PyFunction import com.jetbrains.python.psi.resolve.QualifiedNameFinder import com.jetbrains.python.psi.types.TypeEvalContext -import com.jetbrains.python.sdk.PythonSdkType import icons.PythonIcons /** diff --git a/python/src/com/jetbrains/python/codeInsight/imports/PythonImportUtils.java b/python/src/com/jetbrains/python/codeInsight/imports/PythonImportUtils.java index 956eef83e744..65293d76fd98 100644 --- a/python/src/com/jetbrains/python/codeInsight/imports/PythonImportUtils.java +++ b/python/src/com/jetbrains/python/codeInsight/imports/PythonImportUtils.java @@ -1,4 +1,4 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.codeInsight.imports; @@ -7,7 +7,7 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.*; import com.intellij.psi.search.FilenameIndex; import com.intellij.psi.search.GlobalSearchScope; @@ -180,15 +180,15 @@ public final class PythonImportUtils { private static boolean isAcceptableForImport(PyElement node, PsiFile existingImportFile, PsiFileSystemItem srcfile) { return srcfile != existingImportFile && srcfile != node.getContainingFile() && - (ImportFromExistingAction.isRoot(srcfile) || PyNames.isIdentifier(FileUtil.getNameWithoutExtension(srcfile.getName()))) && - !isShadowedModule(srcfile); + (ImportFromExistingAction.isRoot(srcfile) || PyNames.isIdentifier(FileUtilRt.getNameWithoutExtension(srcfile.getName()))) && + !isShadowedModule(srcfile); } private static boolean isShadowedModule(PsiFileSystemItem file) { if (file.isDirectory() || file.getName().equals(PyNames.INIT_DOT_PY)) { return false; } - String name = FileUtil.getNameWithoutExtension(file.getName()); + String name = FileUtilRt.getNameWithoutExtension(file.getName()); final PsiDirectory directory = ((PsiFile)file).getContainingDirectory(); if (directory == null) { return false; diff --git a/python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java b/python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java index f88f9567f012..13b318124517 100644 --- a/python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java +++ b/python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// Copyright 2000-2019 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.jetbrains.python.packaging; import com.google.common.cache.CacheBuilder; @@ -14,7 +14,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.CatchingConsumer; import com.intellij.util.SmartList; @@ -45,7 +45,7 @@ import java.util.stream.Collectors; public class PyPIPackageUtil { private static final Logger LOG = Logger.getInstance(PyPIPackageUtil.class); private static final Gson GSON = new GsonBuilder().create(); - + private static final String PYPI_HOST = "https://pypi.python.org"; public static final String PYPI_URL = PYPI_HOST + "/pypi"; public static final String PYPI_LIST_URL = PYPI_HOST + "/simple"; @@ -113,14 +113,14 @@ public class PyPIPackageUtil { .connect(request -> GSON.fromJson(request.getReader(), PackageDetails.class)); } }); - + /** * Prevents simultaneous updates of {@link PyPackageService#PYPI_REMOVED} * because the corresponding response contains tons of data and multiple - * queries at the same time can cause memory issues. + * queries at the same time can cause memory issues. */ private final Object myPyPIPackageCacheUpdateLock = new Object(); - + /** * Value for "User Agent" HTTP header in form: PyCharm/2016.2 EAP */ @@ -145,7 +145,7 @@ public class PyPIPackageUtil { catch (IOException e) { LOG.error("Cannot find \"packages\". " + e.getMessage()); } - return builder.build(); + return builder.build(); } public static boolean isPyPIRepository(@Nullable String repository) { @@ -220,7 +220,7 @@ public class PyPIPackageUtil { * Fetches available package versions using JSON API of PyPI. */ @NotNull - private List getPackageVersionsFromPyPI(@NotNull String packageName, + private List getPackageVersionsFromPyPI(@NotNull String packageName, boolean force) throws IOException { final PackageDetails details = refreshAndGetPackageDetailsFromPyPI(packageName, force); final List result = details.getReleases(); @@ -236,7 +236,7 @@ public class PyPIPackageUtil { } /** - * Fetches available package versions by scrapping the page containing package archives. + * Fetches available package versions by scrapping the page containing package archives. * It's primarily used for additional repositories since, e.g. devpi doesn't provide another way to get this information. */ @NotNull @@ -318,7 +318,7 @@ public class PyPIPackageUtil { withoutExtension = StringUtil.trimEnd(artifactName, ".tar.gz"); } else { - withoutExtension = FileUtil.getNameWithoutExtension(artifactName); + withoutExtension = FileUtilRt.getNameWithoutExtension(artifactName); } final String packageNameWithUnderscores = packageName.replace('-', '_'); final String suffix; @@ -397,11 +397,11 @@ public class PyPIPackageUtil { @SuppressWarnings("FieldMayBeFinal") public static final class PackageDetails { public static final class Info { - // We have to explicitly name each of the fields instead of just using + // We have to explicitly name each of the fields instead of just using // GsonBuilder#setFieldNamingStrategy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES), // since otherwise GSON wouldn't be able to deserialize server responses - // in the professional edition of PyCharm where the names of private fields - // are obfuscated. + // in the professional edition of PyCharm where the names of private fields + // are obfuscated. @SerializedName("version") private String version = ""; @SerializedName("author") @@ -413,7 +413,7 @@ public class PyPIPackageUtil { @SerializedName("summary") private String summary = ""; - + @NotNull public String getVersion() { return StringUtil.notNullize(version); diff --git a/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskIntrospector.java b/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskIntrospector.java index f1826f9720f0..738fab8b676c 100644 --- a/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskIntrospector.java +++ b/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskIntrospector.java @@ -1,24 +1,10 @@ -/* - * Copyright 2000-2017 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-2019 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.jetbrains.python.packaging.setupPy; import com.google.common.collect.ImmutableSet; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; @@ -91,7 +77,7 @@ public class SetupTaskIntrospector { final List result = new ArrayList<>(); for (PsiFile commandFile : commandDir.getFiles()) { if (commandFile instanceof PyFile && !SKIP_NAMES.contains(commandFile.getName())) { - final String taskName = FileUtil.getNameWithoutExtension(commandFile.getName()); + final String taskName = FileUtilRt.getNameWithoutExtension(commandFile.getName()); result.add(createTaskFromFile((PyFile)commandFile, taskName, setuptools)); } } diff --git a/python/src/com/jetbrains/python/patterns/PythonPatterns.java b/python/src/com/jetbrains/python/patterns/PythonPatterns.java index c9e1a57b2546..6040529f90dc 100644 --- a/python/src/com/jetbrains/python/patterns/PythonPatterns.java +++ b/python/src/com/jetbrains/python/patterns/PythonPatterns.java @@ -1,7 +1,7 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.patterns; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.patterns.InitialPatternCondition; import com.intellij.patterns.PlatformPatterns; import com.intellij.psi.PsiElement; @@ -74,7 +74,7 @@ public class PythonPatterns extends PlatformPatterns { .select(PyFunction.class) .map(ScopeUtil::getScopeOwner) .select(PyFile.class) - .anyMatch(file -> moduleName.equals(FileUtil.getNameWithoutExtension(file.getName()))); + .anyMatch(file -> moduleName.equals(FileUtilRt.getNameWithoutExtension(file.getName()))); } }); } diff --git a/python/src/com/jetbrains/python/psi/PyUtil.java b/python/src/com/jetbrains/python/psi/PyUtil.java index 8fbbfe26d802..257ce0cdf8df 100644 --- a/python/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/src/com/jetbrains/python/psi/PyUtil.java @@ -439,11 +439,11 @@ public class PyUtil { final File file = new File(pyFilePath); File pycache = new File(file.getParentFile(), PyNames.PYCACHE); if (pycache.isDirectory()) { - final String shortName = FileUtil.getNameWithoutExtension(file); + final String shortName = FileUtilRt.getNameWithoutExtension(file.getName()); Collections.addAll(filesToDelete, pycache.listFiles(pathname -> { if (!FileUtilRt.extensionEquals(pathname.getName(), "pyc")) return false; - String nameWithMagic = FileUtil.getNameWithoutExtension(pathname); - return FileUtil.getNameWithoutExtension(nameWithMagic).equals(shortName); + String nameWithMagic = FileUtilRt.getNameWithoutExtension(pathname.getName()); + return FileUtilRt.getNameWithoutExtension(nameWithMagic).equals(shortName); })); } FileUtil.asyncDelete(filesToDelete); @@ -452,7 +452,7 @@ public class PyUtil { public static String getElementNameWithoutExtension(PsiNamedElement psiNamedElement) { return psiNamedElement instanceof PyFile - ? FileUtil.getNameWithoutExtension(((PyFile)psiNamedElement).getName()) + ? FileUtilRt.getNameWithoutExtension(((PyFile)psiNamedElement).getName()) : psiNamedElement.getName(); } @@ -510,7 +510,7 @@ public class PyUtil { @NotNull public static String computeElementNameForStringSearch(@NotNull final PsiElement element) { if (element instanceof PyFile) { - return FileUtil.getNameWithoutExtension(((PyFile)element).getName()); + return FileUtilRt.getNameWithoutExtension(((PyFile)element).getName()); } if (element instanceof PsiDirectory) { return ((PsiDirectory)element).getName(); @@ -1392,7 +1392,7 @@ public class PyUtil { final FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance(project); final FileTemplate template = fileTemplateManager.getInternalTemplate("Python Script"); final Properties properties = fileTemplateManager.getDefaultProperties(); - properties.setProperty("NAME", FileUtil.getNameWithoutExtension(file.getName())); + properties.setProperty("NAME", FileUtilRt.getNameWithoutExtension(file.getName())); final String content = (template != null) ? template.getText(properties) : null; psi = PyExtractSuperclassHelper.placeFile(project, StringUtil.notNullize( diff --git a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java index 444b7a97169e..726d3e65a402 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// Copyright 2000-2019 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.jetbrains.python.psi.impl; import com.google.common.collect.Lists; @@ -11,7 +11,7 @@ import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.RecursionManager; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; @@ -771,7 +771,7 @@ public class PyFileImpl extends PsiFileBase implements PyFile, PyExpression { return dir.getName(); } } - return FileUtil.getNameWithoutExtension(file.getName()); + return FileUtilRt.getNameWithoutExtension(file.getName()); } @Nullable diff --git a/python/src/com/jetbrains/python/psi/resolve/QualifiedNameFinder.java b/python/src/com/jetbrains/python/psi/resolve/QualifiedNameFinder.java index c755ac08dc93..720c6915ceb6 100644 --- a/python/src/com/jetbrains/python/psi/resolve/QualifiedNameFinder.java +++ b/python/src/com/jetbrains/python/psi/resolve/QualifiedNameFinder.java @@ -1,10 +1,10 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.psi.resolve; import com.intellij.openapi.module.Module; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.util.Couple; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; @@ -229,7 +229,7 @@ public class QualifiedNameFinder { final List result = new ArrayList<>(StringUtil.split(relativePath, "/")); if (!result.isEmpty()) { final int lastIndex = result.size() - 1; - final String nameWithoutExtension = FileUtil.getNameWithoutExtension(result.get(lastIndex)); + final String nameWithoutExtension = FileUtilRt.getNameWithoutExtension(result.get(lastIndex)); if (myVFile.isDirectory() || !nameWithoutExtension.equals(PyNames.INIT)) { result.set(lastIndex, nameWithoutExtension); diff --git a/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java b/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java index edf3c2da5c1f..f38ec1c1c9e6 100644 --- a/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java +++ b/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java @@ -1,4 +1,4 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.psi.resolve; import com.google.common.collect.Lists; @@ -9,7 +9,7 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; @@ -423,7 +423,7 @@ public class ResolveImportUtil { } } } - if (file != null && FileUtil.getNameWithoutExtension(file.getName()).equals(referencedName)) { + if (file != null && FileUtilRt.getNameWithoutExtension(file.getName()).equals(referencedName)) { return file; } return null; diff --git a/python/src/com/jetbrains/python/psi/resolve/VariantsProcessor.java b/python/src/com/jetbrains/python/psi/resolve/VariantsProcessor.java index 1fc245d61900..e952b72d39cc 100644 --- a/python/src/com/jetbrains/python/psi/resolve/VariantsProcessor.java +++ b/python/src/com/jetbrains/python/psi/resolve/VariantsProcessor.java @@ -1,8 +1,8 @@ -// Copyright 2000-2017 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. +// Copyright 2000-2019 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.jetbrains.python.psi.resolve; import com.intellij.openapi.util.Condition; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiInvalidElementAccessException; import com.intellij.psi.PsiNamedElement; @@ -79,7 +79,7 @@ public abstract class VariantsProcessor implements PsiScopeProcessor { if (!expr.isValid()) { throw new PsiInvalidElementAccessException(expr, "Definer: " + definer); } - final String name = expr instanceof PyFile ? FileUtil.getNameWithoutExtension(((PyFile)expr).getName()) : expr.getName(); + final String name = expr instanceof PyFile ? FileUtilRt.getNameWithoutExtension(((PyFile)expr).getName()) : expr.getName(); if (nameIsAcceptable(name)) { addImportedElement(name, expr); } diff --git a/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java b/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java index 1cd8a6c66454..fcfb574f447d 100644 --- a/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java +++ b/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java @@ -1,22 +1,8 @@ -/* - * 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. - */ +// Copyright 2000-2019 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.jetbrains.python.psi.stubs; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; @@ -52,7 +38,7 @@ public class PyModuleNameIndex extends ScalarIndexExtension { } } else { - return Collections.singletonMap(FileUtil.getNameWithoutExtension(name), null); + return Collections.singletonMap(FileUtilRt.getNameWithoutExtension(name), null); } return Collections.emptyMap(); } diff --git a/python/src/com/jetbrains/python/psi/types/PyModuleType.java b/python/src/com/jetbrains/python/psi/types/PyModuleType.java index aa56e6e57798..8721975f97d4 100644 --- a/python/src/com/jetbrains/python/psi/types/PyModuleType.java +++ b/python/src/com/jetbrains/python/psi/types/PyModuleType.java @@ -8,7 +8,6 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.openapi.roots.FileIndexFacade; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.SystemInfoRt; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; @@ -527,7 +526,7 @@ public class PyModuleType implements PyType { // Modules don't descend from obje @Nullable public static LookupElementBuilder buildFileLookupElement(PsiFile file, PsiFileSystemItem item, @Nullable Set existingNames) { - final String s = FileUtil.getNameWithoutExtension(item.getName()); + final String s = FileUtilRt.getNameWithoutExtension(item.getName()); if (!PyNames.isIdentifier(s)) return null; if (existingNames != null) { if (existingNames.contains(s)) { diff --git a/python/src/com/jetbrains/python/refactoring/rename/PyContainingFileRenamerFactory.java b/python/src/com/jetbrains/python/refactoring/rename/PyContainingFileRenamerFactory.java index d1b932005227..202be72329c3 100644 --- a/python/src/com/jetbrains/python/refactoring/rename/PyContainingFileRenamerFactory.java +++ b/python/src/com/jetbrains/python/refactoring/rename/PyContainingFileRenamerFactory.java @@ -1,7 +1,6 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.refactoring.rename; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; @@ -32,7 +31,7 @@ public class PyContainingFileRenamerFactory implements AutomaticRenamerFactory { ScopeOwner scopeOwner = PsiTreeUtil.getParentOfType(element, ScopeOwner.class); if (scopeOwner instanceof PyFile) { String className = ((PyClass) element).getName(); - String fileName = FileUtil.getNameWithoutExtension(scopeOwner.getName()); + String fileName = FileUtilRt.getNameWithoutExtension(scopeOwner.getName()); return fileName.equalsIgnoreCase(className); } return false; @@ -85,7 +84,7 @@ public class PyContainingFileRenamerFactory implements AutomaticRenamerFactory { @Override protected String nameToCanonicalName(@NonNls String name, PsiNamedElement element) { - return FileUtil.getNameWithoutExtension(name); + return FileUtilRt.getNameWithoutExtension(name); } @Override diff --git a/python/src/com/jetbrains/python/refactoring/rename/RenamePyFileProcessor.java b/python/src/com/jetbrains/python/refactoring/rename/RenamePyFileProcessor.java index 4a6c194b685f..1c39202b27f4 100644 --- a/python/src/com/jetbrains/python/refactoring/rename/RenamePyFileProcessor.java +++ b/python/src/com/jetbrains/python/refactoring/rename/RenamePyFileProcessor.java @@ -1,8 +1,8 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.refactoring.rename; import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiPolyVariantReference; import com.intellij.psi.PsiReference; @@ -61,7 +61,7 @@ public class RenamePyFileProcessor extends RenamePsiFileProcessor { @NotNull final String newName, @NotNull Map allRenames, @NotNull List result) { - final String newFileName = FileUtil.getNameWithoutExtension(newName); + final String newFileName = FileUtilRt.getNameWithoutExtension(newName); if (!PyNames.isIdentifier(newFileName)) { final List usages = new ArrayList<>(result); for (UsageInfo usageInfo : usages) { diff --git a/python/src/com/jetbrains/python/sdk/flavors/JythonSdkFlavor.java b/python/src/com/jetbrains/python/sdk/flavors/JythonSdkFlavor.java index edbc5f9a2ea9..631b072a7745 100644 --- a/python/src/com/jetbrains/python/sdk/flavors/JythonSdkFlavor.java +++ b/python/src/com/jetbrains/python/sdk/flavors/JythonSdkFlavor.java @@ -1,9 +1,9 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.sdk.flavors; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.configurations.ParamsGroup; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.PatternUtil; import com.jetbrains.python.run.PythonCommandLineState; @@ -33,7 +33,7 @@ public class JythonSdkFlavor extends PythonSdkFlavor { @Override public boolean isValidSdkPath(@NotNull File file) { - return StringUtil.toLowerCase(FileUtil.getNameWithoutExtension(file)).startsWith("jython"); + return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(file.getName())).startsWith("jython"); } @Nullable diff --git a/python/src/com/jetbrains/python/sdk/flavors/PyPySdkFlavor.java b/python/src/com/jetbrains/python/sdk/flavors/PyPySdkFlavor.java index 44e0e66ea2fe..2bfdadb8d4b1 100644 --- a/python/src/com/jetbrains/python/sdk/flavors/PyPySdkFlavor.java +++ b/python/src/com/jetbrains/python/sdk/flavors/PyPySdkFlavor.java @@ -1,8 +1,8 @@ -// 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. +// Copyright 2000-2019 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.jetbrains.python.sdk.flavors; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.PatternUtil; import com.jetbrains.python.psi.LanguageLevel; @@ -32,7 +32,7 @@ public class PyPySdkFlavor extends PythonSdkFlavor { @Override public boolean isValidSdkPath(@NotNull File file) { - return StringUtil.toLowerCase(FileUtil.getNameWithoutExtension(file)).startsWith("pypy"); + return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(file.getName())).startsWith("pypy"); } @Nullable diff --git a/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java b/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java index 02f1bfce1780..f2e852a54e77 100644 --- a/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java +++ b/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java @@ -10,7 +10,7 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkAdditionalData; import com.intellij.openapi.util.SystemInfoRt; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.PatternUtil; @@ -171,7 +171,7 @@ public abstract class PythonSdkFlavor { } public boolean isValidSdkPath(@NotNull File file) { - return StringUtil.toLowerCase(FileUtil.getNameWithoutExtension(file)).startsWith("python"); + return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(file.getName())).startsWith("python"); } @Nullable diff --git a/python/src/com/jetbrains/python/sdk/flavors/WinPythonSdkFlavor.java b/python/src/com/jetbrains/python/sdk/flavors/WinPythonSdkFlavor.java index a5da2db7ca1a..d923ff549fc8 100644 --- a/python/src/com/jetbrains/python/sdk/flavors/WinPythonSdkFlavor.java +++ b/python/src/com/jetbrains/python/sdk/flavors/WinPythonSdkFlavor.java @@ -1,24 +1,11 @@ -/* - * 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. - */ +// Copyright 2000-2019 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.jetbrains.python.sdk.flavors; import com.google.common.collect.ImmutableMap; import com.intellij.openapi.module.Module; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; @@ -87,7 +74,7 @@ public final class WinPythonSdkFlavor extends CPythonSdkFlavor { private static void findInstallations(Set candidates, String exe_name, String... roots) { for (String root : roots) { - findSubdirInstallations(candidates, root, FileUtil.getNameWithoutExtension(exe_name), exe_name); + findSubdirInstallations(candidates, root, FileUtilRt.getNameWithoutExtension(exe_name), exe_name); } } diff --git a/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java b/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java index e07d0f7a40eb..2075bfda05b4 100644 --- a/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java +++ b/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 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.jetbrains.python.testing; import com.google.common.collect.Sets; @@ -23,7 +9,7 @@ import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; @@ -188,7 +174,7 @@ public final class PythonUnitTestUtil { final PsiFile containingFile = cls.getContainingFile(); final VirtualFile virtualFile = containingFile.getVirtualFile(); final String clsFileName = virtualFile == null ? containingFile.getName() : virtualFile.getPath(); - final String clsFileNameWithoutExt = FileUtil.getNameWithoutExtension(clsFileName); + final String clsFileNameWithoutExt = FileUtilRt.getNameWithoutExtension(clsFileName); if (!clsFileNameWithoutExt.endsWith(fileName) && !fileName.equals(clsFileName)) { continue; } @@ -212,7 +198,7 @@ public final class PythonUnitTestUtil { final PsiFile containingFile = function.getContainingFile(); final VirtualFile virtualFile = containingFile.getVirtualFile(); final String clsFileName = virtualFile == null ? containingFile.getName() : virtualFile.getPath(); - final String clsFileNameWithoutExt = FileUtil.getNameWithoutExtension(clsFileName); + final String clsFileNameWithoutExt = FileUtilRt.getNameWithoutExtension(clsFileName); if (!clsFileNameWithoutExt.endsWith(fileName)) { continue; } diff --git a/python/testSrc/com/jetbrains/python/intentions/PyIntentionTestCase.java b/python/testSrc/com/jetbrains/python/intentions/PyIntentionTestCase.java index f5003bc2e624..e1a3bc339afd 100644 --- a/python/testSrc/com/jetbrains/python/intentions/PyIntentionTestCase.java +++ b/python/testSrc/com/jetbrains/python/intentions/PyIntentionTestCase.java @@ -1,8 +1,8 @@ -// Copyright 2000-2017 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. +// Copyright 2000-2019 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.jetbrains.python.intentions; import com.intellij.codeInsight.intention.IntentionAction; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.PsiFile; import com.jetbrains.python.PythonTestUtil; import com.jetbrains.python.fixtures.PyTestCase; @@ -28,7 +28,7 @@ public abstract class PyIntentionTestCase extends PyTestCase { if (files.length > 0) { final PsiFile[] allFiles = myFixture.configureByFiles(files); file = allFiles[0]; - testFileName = FileUtil.getNameWithoutExtension(file.getName()); + testFileName = FileUtilRt.getNameWithoutExtension(file.getName()); } else { testFileName = getTestName(true);