wildcardize parameters correctly

GitOrigin-RevId: 1041f4afb9f7970c1f28f79909a5a3a8ed6750af
This commit is contained in:
Alexey Kudravtsev
2024-06-26 16:10:57 +02:00
committed by intellij-monorepo-bot
parent 48022d959e
commit 679a71cd40
4 changed files with 6 additions and 6 deletions

View File

@@ -37,7 +37,7 @@ public final class OptimizeImportsRefactoringHelper implements RefactoringHelper
}
@Override
public Set<PsiJavaFile> prepareOperation(UsageInfo @NotNull [] usages, @NotNull List<@NotNull PsiElement> elements) {
public Set<PsiJavaFile> prepareOperation(UsageInfo @NotNull [] usages, @NotNull List<? extends @NotNull PsiElement> elements) {
Set<PsiJavaFile> movedFiles = ContainerUtil.map2SetNotNull(elements, e -> ObjectUtils.tryCast(e.getContainingFile(), PsiJavaFile.class));
return ContainerUtil.union(movedFiles, prepareOperation(usages));
}

View File

@@ -14,7 +14,7 @@ import java.util.List;
* Allows performing cleanup operations after refactoring is done e.g., optimize imports
*/
public interface RefactoringHelper<T> {
ExtensionPointName<RefactoringHelper> EP_NAME = ExtensionPointName.create("com.intellij.refactoring.helper");
ExtensionPointName<RefactoringHelper<?>> EP_NAME = ExtensionPointName.create("com.intellij.refactoring.helper");
/**
* Is called before the refactoring is executed when the refactoring provides {@link BaseRefactoringProcessor#getBeforeData()}.
@@ -22,7 +22,7 @@ public interface RefactoringHelper<T> {
* @param usages the usages found of the elements the refactoring will be called on
* @param elements the elements the refactoring will be called on
*/
T prepareOperation(UsageInfo @NotNull [] usages, @NotNull List<@NotNull PsiElement> elements);
T prepareOperation(UsageInfo @NotNull [] usages, @NotNull List<? extends @NotNull PsiElement> elements);
/**
* Is invoked in EDT, without WriteAction after refactoring is performed

View File

@@ -43,7 +43,7 @@ public final class GroovyImportOptimizerRefactoringHelper implements Refactoring
}
@Override
public Set<GroovyFile> prepareOperation(UsageInfo @NotNull [] usages, @NotNull List<@NotNull PsiElement> elements) {
public Set<GroovyFile> prepareOperation(UsageInfo @NotNull [] usages, @NotNull List<? extends @NotNull PsiElement> elements) {
Set<GroovyFile> movedFiles = ContainerUtil.map2SetNotNull(elements, e -> ObjectUtils.tryCast(e.getContainingFile(), GroovyFile.class));
return ContainerUtil.union(movedFiles, prepareOperation(usages));
}

View File

@@ -12,8 +12,8 @@ import org.jetbrains.kotlin.idea.codeInsight.shorten.prepareDelayedRequests
class KotlinRefactoringHelperForDelayedRequests : RefactoringHelper<Any> {
override fun prepareOperation(
usages: Array<out UsageInfo>,
elements: List<PsiElement>
usages: Array<out UsageInfo>,
elements: List<PsiElement>
): Any? {
if (usages.isNotEmpty()) {
val project = usages[0].project