mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[java] compare copied enum constructors as isEquivalent (IDEA-281446)
GitOrigin-RevId: 2b2456ad69da44c92376b42ffbfb8993f2aff3c2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3d3d27dec4
commit
eacd3576f5
@@ -914,7 +914,7 @@ public final class LambdaUtil {
|
||||
PsiExpression function = replacer.apply(lambdaCopy);
|
||||
if (function == null) return false;
|
||||
JavaResolveResult resultCopy = copyCall.resolveMethodGenerics();
|
||||
if (resultCopy.getElement() != oldTarget) return false;
|
||||
if (!oldTarget.getManager().areElementsEquivalent(resultCopy.getElement(), oldTarget)) return false;
|
||||
String copyMessage = resultCopy instanceof MethodCandidateInfo ? ((MethodCandidateInfo)resultCopy).getInferenceErrorMessage() : null;
|
||||
if (!Objects.equals(origErrorMessage, copyMessage)) return false;
|
||||
if (function instanceof PsiFunctionalExpression) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.Consumer;
|
||||
|
||||
enum E {
|
||||
E(System.out::println);
|
||||
|
||||
E(Runnable r) { }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.Consumer;
|
||||
|
||||
enum E {
|
||||
E(() -> {
|
||||
S<caret>ystem.out.println();
|
||||
});
|
||||
|
||||
E(Runnable r) { }
|
||||
}
|
||||
Reference in New Issue
Block a user