mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[java-inspections] PsiDiamondTypeUtil: fix method comparison
IDEA-298142 Type parameter is not omitted in the quick-fix preview GitOrigin-RevId: 4a0e238a5c124e6be6230994bccdfc742d4da72e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b9a2e79c7c
commit
8269f89b1a
@@ -291,7 +291,7 @@ public final class PsiDiamondTypeUtil {
|
||||
exprCopy.getTypeArgumentList().replace(list);
|
||||
|
||||
final JavaResolveResult copyResult = exprCopy.resolveMethodGenerics();
|
||||
if (method != copyResult.getElement()) return false;
|
||||
if (!method.isEquivalentTo(copyResult.getElement())) return false;
|
||||
final PsiSubstitutor psiSubstitutor = copyResult.getSubstitutor();
|
||||
for (int i = 0, length = typeParameters.length; i < length; i++) {
|
||||
PsiTypeParameter typeParameter = typeParameters[i];
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'Optional.empty()'" "true-preview"
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
public class Test {
|
||||
Optional<Integer> foo(boolean flag) {
|
||||
return flag ? Optional.of(42) : Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'Optional.empty()'" "true-preview"
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
public class Test {
|
||||
Optional<Integer> foo(boolean flag) {
|
||||
return flag ? Optional.of(42) : n<caret>ull;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user