mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
java overload resolution: fix NPE
found by property testing GitOrigin-RevId: b45cb07402ad58a37886b7f1b5afb62bca2746fe
This commit is contained in:
committed by
intellij-monorepo-bot
parent
94a4084b0e
commit
4ad4e7d908
@@ -157,6 +157,7 @@ public class InferenceSession {
|
||||
|
||||
if (args[i] != null && isPertinentToApplicability(args[i], method)) {
|
||||
PsiType parameterType = getParameterType(parameters, i, mySiteSubstitutor, varargs);
|
||||
LOG.assertTrue(parameterType != null);
|
||||
if (!ignoreLambdaConstraintTree(args[i])) {
|
||||
addConstraint(new ExpressionCompatibilityConstraint(args[i], substituteWithInferenceVariables(parameterType)));
|
||||
}
|
||||
@@ -1660,7 +1661,7 @@ public class InferenceSession {
|
||||
|
||||
final int paramsLength = !varargs ? parameters1.length : Math.max(parameters1.length, parameters2.length) - 1;
|
||||
for (int i = 0; i < paramsLength; i++) {
|
||||
PsiType sType = getParameterType(parameters1, i, siteSubstitutor1, false);
|
||||
PsiType sType = getParameterType(parameters1, i, siteSubstitutor1, varargs);
|
||||
PsiType tType = session.substituteWithInferenceVariables(getParameterType(parameters2, i, siteSubstitutor1, varargs));
|
||||
if (PsiUtil.isRawSubstitutor(m2, siteSubstitutor1)) {
|
||||
tType = TypeConversionUtil.erasure(tType);
|
||||
|
||||
@@ -18,4 +18,20 @@ interface Node<<warning descr="Type parameter 'T' is never used">T</warning>> {
|
||||
Node.of(1, Node.of(2), Node.of(3));
|
||||
Node.<Integer>of(1, Node.<Integer>of(2), Node.<Integer> of(3));
|
||||
}
|
||||
}
|
||||
|
||||
class MyTest {
|
||||
void foo(String... s) {
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
<T> void foo(T t, String t3, T... s) {
|
||||
System.out.println(t);
|
||||
System.out.println(t3);
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
{
|
||||
foo(" ", " ", "");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user