mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
method refs: static testdata, apply qualifier substitutor
This commit is contained in:
@@ -256,8 +256,10 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
|
||||
if (!(conflict instanceof MethodCandidateInfo)) continue;
|
||||
final PsiMethod psiMethod = ((MethodCandidateInfo)conflict).getElement();
|
||||
if (psiMethod == null) continue;
|
||||
PsiSubstitutor subst = PsiSubstitutor.EMPTY;
|
||||
subst = subst.putAll(mySubstitutor);
|
||||
if (!LambdaUtil.areAcceptable(mySignature,
|
||||
psiMethod.getSignature(conflict.getSubstitutor()), myContainingClass, mySubstitutor)) {
|
||||
psiMethod.getSignature(subst.putAll(conflict.getSubstitutor())), myContainingClass, mySubstitutor)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,3 +19,18 @@ class MyTest {
|
||||
new B().m(10);
|
||||
}
|
||||
}
|
||||
|
||||
class MyTest1 {
|
||||
|
||||
interface I {
|
||||
void m();
|
||||
}
|
||||
|
||||
void call(I s) {}
|
||||
|
||||
I i = <error descr="Cannot resolve symbol 'NonExistentType'">NonExistentType</error>::m;
|
||||
|
||||
{
|
||||
call(<error descr="Cannot resolve symbol 'NonExistentType'">NonExistentType</error>::m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.*;
|
||||
|
||||
class MyTest {
|
||||
interface I {
|
||||
String m(Foo<String> f);
|
||||
@@ -28,3 +30,9 @@ class MyTest1 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MyTest2 {
|
||||
public static void main(String[] args) {
|
||||
Arrays.sort(new String[0], String.CASE_INSENSITIVE_ORDER::compare);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class MyTest {
|
||||
interface I {
|
||||
String m(Foo f);
|
||||
}
|
||||
|
||||
static class Foo<X> {
|
||||
String foo() { return null; }
|
||||
|
||||
Foo<X> getFoo() { return this; }
|
||||
|
||||
static void test() {
|
||||
I i1 = Foo.<error descr="Non-static method 'getFoo()' cannot be referenced from a static context">getFoo</error>()::foo;
|
||||
I i2 = <error descr="'MyTest.Foo.this' cannot be referenced from a static context">this</error>::foo;
|
||||
I i3 = Foo :: foo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStaticProblems() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user