mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
accept inline on method reference (IDEA-102845)
This commit is contained in:
@@ -1028,6 +1028,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
|
||||
initializer.accept(canAllLocalsBeDeclaredFinal);
|
||||
if (!canAllLocalsBeDeclaredFinal.success) return false;
|
||||
}
|
||||
if (initializer instanceof PsiMethodReferenceExpression) return true;
|
||||
if (initializer instanceof PsiReferenceExpression) {
|
||||
PsiVariable refVar = (PsiVariable)((PsiReferenceExpression)initializer).resolve();
|
||||
if (refVar == null) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
class Foo {
|
||||
interface Jjj {
|
||||
int[] jjj(int p);
|
||||
}
|
||||
void useJjj(Jjj p) {
|
||||
p.jjj(9);
|
||||
}
|
||||
void test() {
|
||||
use<caret>Jjj(int[]::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Foo {
|
||||
interface Jjj {
|
||||
int[] jjj(int p);
|
||||
}
|
||||
void useJjj(Jjj p) {
|
||||
p.jjj(9);
|
||||
}
|
||||
void test() {
|
||||
((Jjj) int[]::new).jjj(9);
|
||||
}
|
||||
}
|
||||
@@ -250,6 +250,10 @@ public class InlineMethodTest extends LightRefactoringTestCase {
|
||||
doTestInlineThisOnly();
|
||||
}
|
||||
|
||||
public void testOnMethodReference() throws Exception {
|
||||
doTestInlineThisOnly();
|
||||
}
|
||||
|
||||
public void testNonCodeUsage() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user