inference: fix for incomplete constructor call without argument list

EA-144940 - IAE: RecursionManager$.$$$reportNull$$$

GitOrigin-RevId: 7367e1bccdcb5d0373293e44dd8afdfb105ee311
This commit is contained in:
Anna Kozlova
2019-06-16 08:01:14 +03:00
committed by intellij-monorepo-bot
parent d50a5e1d6a
commit 206d647c3d
3 changed files with 26 additions and 5 deletions
@@ -447,10 +447,14 @@ public class MethodCandidateInfo extends CandidateInfo{
.inferTypeArguments(typeParameters, method.getParameterList().getParameters(), arguments, this, parent, policy,
myLanguageLevel);
};
PsiSubstitutor substitutor = !includeReturnConstraint
? ourOverloadGuard.doPreventingRecursion(myArgumentList, false, computable)
: computable.compute();
return ObjectUtils.assertNotNull(substitutor);
if (!includeReturnConstraint) {
return myArgumentList == null
? PsiSubstitutor.EMPTY
: ObjectUtils.assertNotNull(ourOverloadGuard.doPreventingRecursion(myArgumentList, false, computable));
}
else {
return computable.compute();
}
}
public boolean isRawSubstitution() {
@@ -0,0 +1,9 @@
import java.lang.String;
class X {
<S> X(int i){}
<T> X(String s){}
{
new <caret>X
}
}
@@ -64,7 +64,7 @@ public class GotoDeclarationTest extends LightCodeInsightTestCase {
assertEquals("java.lang", JavaDirectoryService.getInstance().getPackage(element).getQualifiedName());
}
public void testMultipleConstructors() {
private void doTestMultipleConstructors() {
String name = getTestName(false);
configureByFile("/codeInsight/gotoDeclaration/" + name + ".java");
final int offset = getEditor().getCaretModel().getOffset();
@@ -79,6 +79,14 @@ public class GotoDeclarationTest extends LightCodeInsightTestCase {
assertEquals(candidates.toString(), 2, candidates.size());
}
public void testMultipleConstructors() {
doTestMultipleConstructors();
}
public void testMultipleGenericConstructorsOnIncompleteCall() {
doTestMultipleConstructors();
}
public void testMultipleConstructorsButArrayCreation() {
String name = getTestName(false);
configureByFile("/codeInsight/gotoDeclaration/" + name + ".java");