mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
EA-44489 - NPE: PsiDiamondTypeImpl.resolveInferredTypesNoCheck
This commit is contained in:
@@ -128,25 +128,31 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
|
||||
if (psiClass == null) return DiamondInferenceResult.NULL_RESULT;
|
||||
final PsiExpressionList argumentList = newExpression.getArgumentList();
|
||||
if (argumentList == null) return DiamondInferenceResult.NULL_RESULT;
|
||||
final Ref<PsiMethod> staticFactory = new Ref<PsiMethod>();
|
||||
final Ref<PsiMethod> staticFactoryRef = new Ref<PsiMethod>();
|
||||
final PsiSubstitutor inferredSubstitutor = ourDiamondGuard.doPreventingRecursion(newExpression, true, new Computable<PsiSubstitutor>() {
|
||||
@Override
|
||||
public PsiSubstitutor compute() {
|
||||
final PsiMethod constructor = findConstructor(psiClass, newExpression);
|
||||
PsiTypeParameter[] params = getAllTypeParams(constructor, psiClass);
|
||||
|
||||
staticFactory.set(generateStaticFactory(constructor, psiClass, params));
|
||||
if (staticFactory.get() == null) {
|
||||
final PsiMethod staticFactory = generateStaticFactory(constructor, psiClass, params);
|
||||
if (staticFactory == null) {
|
||||
return null;
|
||||
}
|
||||
staticFactoryRef.set(staticFactory);
|
||||
|
||||
return inferTypeParametersForStaticFactory(staticFactory.get(), newExpression, context);
|
||||
return inferTypeParametersForStaticFactory(staticFactory, newExpression, context);
|
||||
}
|
||||
});
|
||||
if (inferredSubstitutor == null) {
|
||||
return DiamondInferenceResult.NULL_RESULT;
|
||||
}
|
||||
final PsiTypeParameter[] parameters = staticFactory.get().getTypeParameters();
|
||||
final PsiMethod staticFactory = staticFactoryRef.get();
|
||||
if (staticFactory == null) {
|
||||
LOG.assertTrue(false);
|
||||
return DiamondInferenceResult.NULL_RESULT;
|
||||
}
|
||||
final PsiTypeParameter[] parameters = staticFactory.getTypeParameters();
|
||||
final PsiTypeParameter[] classParameters = psiClass.getTypeParameters();
|
||||
final PsiJavaCodeReferenceElement classOrAnonymousClassReference = newExpression.getClassOrAnonymousClassReference();
|
||||
LOG.assertTrue(classOrAnonymousClassReference != null);
|
||||
|
||||
Reference in New Issue
Block a user