mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
new inference: array constructor refs are always exact (IDEA-115725)
(cherry picked from commit 0f6538fc54bbee0aaf6cbab9884c0407937d4568)
This commit is contained in:
@@ -101,7 +101,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
|
||||
return parameterList != null && parameterList.getTypeParameterElements().length > 0 ? psiMethod : null;
|
||||
}
|
||||
}
|
||||
if (containingClass.hasTypeParameters()) {
|
||||
if (containingClass.isPhysical() && containingClass.hasTypeParameters()) {
|
||||
final PsiElement qualifier = getQualifier();
|
||||
if (qualifier instanceof PsiTypeElement) {
|
||||
final PsiJavaCodeReferenceElement referenceElement = ((PsiTypeElement)qualifier).getInnermostComponentReferenceElement();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
public class InspectorTest {
|
||||
interface Stream<T> {
|
||||
<A> A[] toArray(IntFunction<A[]> generator);
|
||||
}
|
||||
interface IntFunction<R> {
|
||||
R apply(int value);
|
||||
}
|
||||
|
||||
public static void main(Stream<Object> objectStream){
|
||||
varargMethod(String[]::new,
|
||||
objectStream.toArray(String[]::new));
|
||||
}
|
||||
public static <T> void varargMethod(IntFunction<T[]> generator,T[]... a){}
|
||||
}
|
||||
@@ -89,6 +89,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void _testExactReferencesToArrayCreation() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user