[java] [refactorings] simplify dependencies

GitOrigin-RevId: b9fdf3048b7d126a7d8187cbd21aba6607c65013
This commit is contained in:
Anna Kozlova
2022-02-15 13:14:37 +00:00
committed by intellij-monorepo-bot
parent d2c8478d89
commit b3cd2cb11e
12 changed files with 14 additions and 91 deletions
@@ -18,6 +18,7 @@
<orderEntry type="module" module-name="intellij.java.rt" />
<orderEntry type="module" module-name="intellij.jsp" />
<orderEntry type="module" module-name="intellij.java.impl" />
<orderEntry type="module" module-name="intellij.java.impl.refactorings" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
<orderEntry type="module" module-name="intellij.platform.util" />
<orderEntry type="module" module-name="intellij.platform.jps.build" />
@@ -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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.debugger.ui.impl.watch;
import com.intellij.compiler.CompilerConfiguration;
@@ -29,8 +29,8 @@ import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiCodeFragment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.refactoring.JavaSpecialRefactoringProvider;
import com.intellij.refactoring.extractMethod.PrepareFailedException;
import com.intellij.refactoring.extractMethodObject.ExtractLightMethodObjectHandler;
import com.intellij.refactoring.extractMethodObject.LightMethodObjectExtractedData;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
@@ -160,7 +160,7 @@ public class CompilingEvaluatorImpl extends CompilingEvaluator {
XDebugSession currentSession = XDebuggerManager.getInstance(project).getCurrentSession();
JavaSdkVersion javaVersion = getJavaVersion(currentSession);
PsiElement physicalContext = findPhysicalContext(psiContext);
LightMethodObjectExtractedData data = JavaSpecialRefactoringProvider.getInstance().extractLightMethodObject(
LightMethodObjectExtractedData data = ExtractLightMethodObjectHandler.extractLightMethodObject(
project,
physicalContext != null ? physicalContext : psiContext,
fragmentFactory.apply(psiContext),
+1
View File
@@ -12,6 +12,7 @@
<orderEntry type="module" module-name="intellij.java.compiler" />
<orderEntry type="module" module-name="intellij.java.compiler.impl" />
<orderEntry type="module" module-name="intellij.java.impl" />
<orderEntry type="module" module-name="intellij.java.impl.refactorings" />
<orderEntry type="module" module-name="intellij.java.aetherDependencyResolver" />
<orderEntry type="library" name="OroMatcher" level="project" />
<orderEntry type="module" module-name="intellij.platform.vcs.impl" />
@@ -1,4 +1,4 @@
// Copyright 2000-2021 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.projectView.actions
import com.intellij.CommonBundle
@@ -27,7 +27,7 @@ import com.intellij.packageDependencies.ForwardDependenciesBuilder
import com.intellij.psi.JavaDirectoryService
import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiManager
import com.intellij.refactoring.JavaSpecialRefactoringProvider
import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesUtil
import org.jetbrains.annotations.TestOnly
import org.jetbrains.concurrency.AsyncPromise
import org.jetbrains.concurrency.Promise
@@ -151,8 +151,7 @@ class ExtractModuleFromPackageAction : AnAction() {
}
if (targetSourceRoot != null) {
val targetDirectory = VfsUtil.createDirectoryIfMissing(targetSourceRoot, packagePrefix.replace('.', '/'))
JavaSpecialRefactoringProvider.getInstance()
.moveDirectoryRecursively(directory, PsiManager.getInstance(module.project).findDirectory(targetDirectory.parent))
MoveClassesOrPackagesUtil.moveDirectoryRecursively(directory, PsiManager.getInstance(module.project).findDirectory(targetDirectory.parent))
}
SaveAndSyncHandler.getInstance().scheduleProjectSave(module.project)
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.apiUsage
import com.intellij.lang.java.JavaLanguage
@@ -15,6 +15,7 @@ import org.jetbrains.uast.visitor.AbstractUastNonRecursiveVisitor
* Non-recursive UAST visitor that detects usages of APIs in source code of UAST-supporting languages
* and reports them via [ApiUsageProcessor] interface.
*/
@ApiStatus.Experimental
open class ApiUsageUastVisitor(private val apiUsageProcessor: ApiUsageProcessor) : AbstractUastNonRecursiveVisitor() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.miscGenerics;
import com.intellij.codeInspection.ProblemDescriptor;
@@ -13,8 +13,6 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiTypesUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.refactoring.JavaSpecialRefactoringProvider;
import com.intellij.refactoring.typeMigration.ChangeTypeSignatureHandlerBase;
import com.intellij.util.CommonJavaRefactoringUtil;
import com.intellij.util.ObjectUtils;
import com.siyeh.ig.BaseInspection;
@@ -1,32 +0,0 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.psi.PsiCodeFragment;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.extractMethod.PrepareFailedException;
import com.intellij.refactoring.extractMethodObject.ExtractLightMethodObjectHandler;
import com.intellij.refactoring.extractMethodObject.LightMethodObjectExtractedData;
import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class JavaSpecialRefactoringProviderImpl implements JavaSpecialRefactoringProvider {
@Override
public void moveDirectoryRecursively(PsiDirectory dir, PsiDirectory destination) throws IncorrectOperationException {
MoveClassesOrPackagesUtil.moveDirectoryRecursively(dir, destination);
}
@Override
public LightMethodObjectExtractedData extractLightMethodObject(Project project,
@Nullable PsiElement originalContext,
@NotNull PsiCodeFragment fragment,
@NotNull String methodName,
@Nullable JavaSdkVersion javaVersion) throws PrepareFailedException {
return ExtractLightMethodObjectHandler.extractLightMethodObject(project, originalContext, fragment, methodName, javaVersion);
}
}
@@ -291,7 +291,6 @@
<notificationGroup id="Package File" displayType="BALLOON" hideFromSettings="true"/>
<registryKey key="ide.jps.use.build.tool.window" defaultValue="true" description="Enables 'Build' toolwindow for JPS compilation messages"/>
<applicationService serviceInterface="com.intellij.refactoring.JavaSpecialRefactoringProvider" serviceImplementation="com.intellij.refactoring.JavaSpecialRefactoringProviderImpl"/>
<applicationService serviceInterface="com.intellij.refactoring.util.CommonJavaInlineUtil" serviceImplementation="com.intellij.refactoring.util.InlineUtil"/>
<applicationService serviceInterface="com.intellij.refactoring.util.RefactoringConflictsUtil" serviceImplementation="com.intellij.refactoring.util.RefactoringConflictsUtilImpl"/>
<applicationService serviceImplementation="com.intellij.compiler.server.BuildManager" preload="true"/>
@@ -1,4 +1,4 @@
// Copyright 2000-2021 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.TailType;
@@ -23,7 +23,6 @@ import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.javadoc.PsiDocTagValue;
import com.intellij.psi.util.*;
import com.intellij.refactoring.JavaSpecialRefactoringProvider;
import com.intellij.refactoring.util.JavaNameSuggestionUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ArrayUtilRt;
@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.daemon.impl.quickfix;
@@ -14,7 +14,6 @@ import com.intellij.psi.search.PsiSearchHelper;
import com.intellij.psi.util.JavaElementKind;
import com.intellij.psi.util.PsiTypesUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.JavaSpecialRefactoringProvider;
import com.intellij.util.CommonJavaRefactoringUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
@@ -1,41 +0,0 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.psi.PsiCodeFragment;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.extractMethod.PrepareFailedException;
import com.intellij.refactoring.extractMethodObject.LightMethodObjectExtractedData;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* WARNING! Not a real extension point, used to work around module dependencies. It is an implementation detail, may be changed without warning.
*
* Provides handlers used for tests and specific scenarios, as well as different utility functions.
*/
@ApiStatus.Internal
public interface JavaSpecialRefactoringProvider {
static JavaSpecialRefactoringProvider getInstance() {
return ApplicationManager.getApplication().getService(JavaSpecialRefactoringProvider.class);
}
// null means unchanged
// null means unchanged
LightMethodObjectExtractedData extractLightMethodObject(final Project project,
@Nullable PsiElement originalContext,
@NotNull final PsiCodeFragment fragment,
@NotNull String methodName,
@Nullable JavaSdkVersion javaVersion) throws PrepareFailedException;
// utils which have too many deps
void moveDirectoryRecursively(PsiDirectory dir, PsiDirectory destination) throws IncorrectOperationException;
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.siyeh.ig.fixes;
import com.intellij.codeInsight.CodeInsightUtilCore;
@@ -15,7 +15,6 @@ import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.JavaSpecialRefactoringProvider;
import com.intellij.refactoring.rename.RenamePsiElementProcessor;
import com.intellij.refactoring.rename.inplace.MemberInplaceRenamer;
import com.intellij.util.CommonJavaRefactoringUtil;