mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
resolve for method reference qualifier should prefer classes in case of constructor refs (IDEA-164165)
This commit is contained in:
@@ -286,6 +286,13 @@ public class PsiReferenceExpressionImpl extends PsiReferenceExpressionBase imple
|
||||
}
|
||||
|
||||
if (parentType == JavaElementType.METHOD_REF_EXPRESSION) {
|
||||
if (((PsiMethodReferenceExpression)getParent()).isConstructor()) {
|
||||
PsiElement classNameElement = getReferenceNameElement();
|
||||
if (classNameElement == null) {
|
||||
return JavaResolveResult.EMPTY_ARRAY;
|
||||
}
|
||||
return resolveToClass(classNameElement, containingFile);
|
||||
}
|
||||
return resolve(JavaElementType.REFERENCE_EXPRESSION, containingFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class TEST_NAME {
|
||||
TEST_NAME(){}
|
||||
}
|
||||
class TEST_NAME1 {}
|
||||
|
||||
class TestClass {
|
||||
static{
|
||||
String TEST_NAME = "";
|
||||
Supplier<TEST_NAME> s = TEST_NAME::new;
|
||||
|
||||
String TEST_NAME1 = "";
|
||||
Supplier<TEST_NAME1> s1 = TEST_NAME1::new;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -525,6 +525,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEnsureResolveToClassInConstructorRefs() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user