mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
make method static: add parameter when method was used in method reference (IDEA-93138)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class Test4 {
|
||||
void test() {
|
||||
Foo2<Test4> f = Test4::yyy;
|
||||
}
|
||||
static void yyy(Test4 anObject) {}
|
||||
}
|
||||
interface Foo2<T> {
|
||||
void bar(T j);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test4 {
|
||||
void test() {
|
||||
Foo2<Test4> f = Test4::yyy;
|
||||
}
|
||||
void yy<caret>y() {}
|
||||
}
|
||||
interface Foo2<T> {
|
||||
void bar(T j);
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiTypeParameterListOwner;
|
||||
import com.intellij.refactoring.makeStatic.MakeMethodStaticProcessor;
|
||||
import com.intellij.refactoring.makeStatic.MakeStaticUtil;
|
||||
import com.intellij.refactoring.makeStatic.Settings;
|
||||
@@ -186,13 +185,21 @@ public class MakeMethodStaticTest extends LightRefactoringTestCase {
|
||||
assertFalse(MakeStaticUtil.isParameterNeeded((PsiMethod)element));
|
||||
}
|
||||
|
||||
public void testMethodReference() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testPreserveParametersAlignment() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
private void doTest(final boolean addClassParameter) throws Exception {
|
||||
configureByFile("/refactoring/makeMethodStatic/before" + getTestName(false) + ".java");
|
||||
perform(false);
|
||||
perform(addClassParameter);
|
||||
checkResultByFile("/refactoring/makeMethodStatic/after" + getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user