mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
method refs: search for potentially applicable members in supers (IDEA-121737)
This commit is contained in:
@@ -161,7 +161,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
|
||||
if (containingClass != null) {
|
||||
PsiMethod[] methods = null;
|
||||
if (element instanceof PsiIdentifier) {
|
||||
methods = containingClass.findMethodsByName(element.getText(), false);
|
||||
methods = containingClass.findMethodsByName(element.getText(), true);
|
||||
}
|
||||
else if (isConstructor()) {
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(getProject());
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
interface Base {
|
||||
int getInt(String a);
|
||||
int getInt();
|
||||
|
||||
void foo();
|
||||
}
|
||||
|
||||
abstract class ABase implements Base {
|
||||
@Override
|
||||
public int getInt(String a) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
class Impl extends ABase {
|
||||
@Override
|
||||
public int getInt() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void foo() {
|
||||
List<String> strs = Arrays.asList("one", "two");
|
||||
|
||||
List<Integer> withMethodRef = strs
|
||||
.stream()
|
||||
.map(this::getInt)
|
||||
.collect( Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -181,6 +181,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSuperClassPotentiallyApplicableMembers() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user