mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
create method from usage: guess return types by context of the same method calls (IDEA-199042)
This commit is contained in:
@@ -517,8 +517,9 @@ public class CreateFromUsageUtils {
|
||||
|
||||
@Override public void visitMethodCallExpression(PsiMethodCallExpression expr) {
|
||||
if (expression instanceof PsiMethodCallExpression) {
|
||||
PsiMethod resolveMethod = ((PsiMethodCallExpression)expression).resolveMethod();
|
||||
PsiReferenceExpression methodExpression = expr.getMethodExpression();
|
||||
if (Comparing.equal(methodExpression.getReferenceName(), ((PsiMethodCallExpression) expression).getMethodExpression().getReferenceName())) {
|
||||
if (Comparing.equal(methodExpression.getReferenceName(), ((PsiMethodCallExpression) expression).getMethodExpression().getReferenceName()) && methodExpression.resolve() == resolveMethod) {
|
||||
result.add(expr.getMethodExpression());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Create method 'test'" "true"
|
||||
public class Test {
|
||||
public Test(Impl impl) {
|
||||
impl.test(test());
|
||||
}
|
||||
|
||||
private String test() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Impl {
|
||||
void test(String s) {}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Create method 'test'" "true"
|
||||
public class Test {
|
||||
public Test(Impl impl) {
|
||||
impl.test(te<caret>st());
|
||||
}
|
||||
}
|
||||
|
||||
class Impl {
|
||||
void test(String s) {}
|
||||
}
|
||||
Reference in New Issue
Block a user