mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method refs: move method inside class with method ref usage (EA-57734 - IOE: PsiReferenceExpressionBase.setQualifierExpression)
This commit is contained in:
+1
-1
@@ -180,7 +180,7 @@ public class MoveJavaMemberHandler implements MoveMemberHandler {
|
||||
}
|
||||
else {
|
||||
final PsiReferenceParameterList parameterList = refExpr.getParameterList();
|
||||
if (parameterList != null && parameterList.getTypeArguments().length == 0){
|
||||
if (parameterList != null && parameterList.getTypeArguments().length == 0 && !(refExpr instanceof PsiMethodReferenceExpression)){
|
||||
refExpr.setQualifierExpression(null);
|
||||
} else {
|
||||
final Project project = element.getProject();
|
||||
|
||||
+1
-3
@@ -22,7 +22,6 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.source.resolve.JavaResolveUtil;
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
|
||||
@@ -45,7 +44,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -228,7 +226,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
|
||||
@Override
|
||||
public void setQualifierExpression(@Nullable PsiExpression newQualifier) throws IncorrectOperationException {
|
||||
if (newQualifier == null) {
|
||||
super.setQualifierExpression(newQualifier);
|
||||
LOG.error("Forbidden null qualifier");
|
||||
return;
|
||||
}
|
||||
final PsiExpression expression = getQualifierExpression();
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Outer {
|
||||
static void foo() {}
|
||||
|
||||
static class Inner {
|
||||
}
|
||||
|
||||
{
|
||||
Runnable r = Outer::foo;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Outer {
|
||||
static class Inner {
|
||||
static void foo() {}
|
||||
}
|
||||
|
||||
{
|
||||
Runnable r = Inner::foo;
|
||||
}
|
||||
}
|
||||
@@ -187,6 +187,18 @@ public class MoveMembersTest extends MultiFileTestCase {
|
||||
doTest("Outer.Inner", "Outer", true, VisibilityUtil.ESCALATE_VISIBILITY, 0);
|
||||
}
|
||||
|
||||
public void testFromNestedToOuterMethodRef() throws Exception {
|
||||
final LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getProject());
|
||||
final LanguageLevel oldLevel = projectExtension.getLanguageLevel();
|
||||
try {
|
||||
projectExtension.setLanguageLevel(LanguageLevel.HIGHEST);
|
||||
doTest("Outer.Inner", "Outer", true, VisibilityUtil.ESCALATE_VISIBILITY, 0);
|
||||
}
|
||||
finally {
|
||||
projectExtension.setLanguageLevel(oldLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
|
||||
Reference in New Issue
Block a user