new inference: String::length should be exact (IDEA-122191)

This commit is contained in:
Anna Kozlova
2014-03-25 13:50:38 +01:00
parent 5605b2e6f0
commit 9f58257359
3 changed files with 20 additions and 1 deletions

View File

@@ -163,7 +163,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
if (containingClass != null) {
PsiMethod[] methods = null;
if (element instanceof PsiIdentifier) {
methods = containingClass.findMethodsByName(element.getText(), true);
methods = containingClass.findMethodsByName(element.getText(), !qualifierResolveResult.isReferenceTypeQualified());
}
else if (isConstructor()) {
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(getProject());

View File

@@ -0,0 +1,15 @@
import java.util.function.ToIntFunction;
class Test {
{
fooBar(String::length);
}
class Foo<K> {
Foo<K> then() {
return null;
}
}
static <T> Foo<T> fooBar(ToIntFunction<? super T> keyExtractor) {
return null;
}
}

View File

@@ -209,6 +209,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testIDEA112191() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}