mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-intentions] Remove external type annotations on ChangeMethodSignatureFromUsageFix
Follow-up for IDEA-363866 Remove redundant type annotations on 'Change variable type' fix GitOrigin-RevId: fc52a66f6b7192ed6c111737619d9fd5dab6817d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d8ac43a850
commit
01dab26f64
+3
-2
@@ -354,8 +354,9 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
|
||||
if (PsiPolyExpressionUtil.isPolyExpression(expression)) return null;
|
||||
PsiType exprType = CommonJavaRefactoringUtil.getTypeByExpression(expression);
|
||||
if (exprType == null || PsiTypes.voidType().equals(exprType)) return null;
|
||||
if (exprType instanceof PsiDisjunctionType) {
|
||||
exprType = ((PsiDisjunctionType)exprType).getLeastUpperBound();
|
||||
exprType = PsiTypesUtil.removeExternalAnnotations(exprType);
|
||||
if (exprType instanceof PsiDisjunctionType disjunctionType) {
|
||||
exprType = disjunctionType.getLeastUpperBound();
|
||||
}
|
||||
if (!PsiTypesUtil.allTypeParametersResolved(myTargetMethod, exprType)) return null;
|
||||
final ParameterInfoImpl changedParameterInfo = ParameterInfoImpl.create(i).withName(parameter.getName()).withType(exprType);
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Change 1st parameter of method 'use' from 'Map<String, String>' to 'Map<String, Integer>'" "true"
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class Test {
|
||||
void testMethodRef(Map<String, Integer> list) {
|
||||
var map = list.entrySet().stream()
|
||||
.filter(e -> !e.getKey().isEmpty())
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
use(map);
|
||||
}
|
||||
|
||||
private void use(Map<String, Integer> collect) {
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Change 1st parameter of method 'use' from 'Map<String, String>' to 'Map<String, Integer>'" "true"
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class Test {
|
||||
void testMethodRef(Map<String, Integer> list) {
|
||||
var map = list.entrySet().stream()
|
||||
.filter(e -> !e.getKey().isEmpty())
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
use(<caret>map);
|
||||
}
|
||||
|
||||
private void use(Map<String, String> collect) {
|
||||
}
|
||||
}
|
||||
+8
@@ -2,6 +2,10 @@
|
||||
package com.intellij.codeInsight.daemon.impl.quickfix;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.JAVA_21_ANNOTATED;
|
||||
|
||||
public class ChangeMethodSignatureFromUsageModernTest extends LightQuickFixParameterizedTestCase {
|
||||
|
||||
@@ -10,4 +14,8 @@ public class ChangeMethodSignatureFromUsageModernTest extends LightQuickFixParam
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/changeMethodSignatureFromUsageModern";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_21_ANNOTATED;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user