void (@NotNull final PsiNewExpression newExpr, @NotNull final PsiExpressionList list) { if (PsiDiamondType.hasDiamond(newExpr)) { final List<CandidateInfo> candidates = PsiDiamondTypeImpl.collectStaticFactories(newExpr); if (candidates != null) { final PsiExpressionList argumentList = Objects.requireNonNull(newExpr.getArgumentList()); Collections.addAll(myResult, getExpectedArgumentTypesForMethodCall(candidates.toArray(CandidateInfo.EMPTY_ARRAY), argumentList, myExpr, myForCompletion)); } return; } PsiType newType = newExpr.getType(); if (newType instanceof PsiClassType) { JavaResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(newType); PsiClass newClass = (PsiClass)resolveResult.getElement(); final PsiSubstitutor substitutor; if (newClass instanceof PsiAnonymousClass anonymous) { newClass = anonymous.getBaseClassType().resolve(); if (newClass == null) return; substitutor = TypeConversionUtil.getSuperClassSubstitutor(newClass, anonymous, PsiSubstitutor.EMPTY); } else if (newClass != null) { substitutor = resolveResult.getSubstitutor(); } else { return; } getExpectedTypesForConstructorCall(newClass, list, substitutor); } }