mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
following IDEA-CR-5310
This commit is contained in:
@@ -155,14 +155,16 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
|
||||
final PsiSubstitutor inferredSubstitutor = ourDiamondGuard.doPreventingRecursion(context, false, new Computable<PsiSubstitutor>() {
|
||||
@Override
|
||||
public PsiSubstitutor compute() {
|
||||
final MethodCandidateInfo staticFactoryCandidateInfo = CachedValuesManager.getCachedValue(context,
|
||||
final MethodCandidateInfo staticFactoryCandidateInfo = context == newExpression ?
|
||||
CachedValuesManager.getCachedValue(context,
|
||||
new CachedValueProvider<MethodCandidateInfo>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Result<MethodCandidateInfo> compute() {
|
||||
return new Result<MethodCandidateInfo>(getStaticFactoryCandidateInfo(psiClass, newExpression, context, argumentList), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
|
||||
return new Result<MethodCandidateInfo>(getStaticFactoryCandidateInfo(psiClass, newExpression, newExpression, argumentList), PsiModificationTracker.MODIFICATION_COUNT);
|
||||
}
|
||||
});
|
||||
})
|
||||
: getStaticFactoryCandidateInfo(psiClass, newExpression, context, argumentList);
|
||||
staticFactoryRef.set(staticFactoryCandidateInfo);
|
||||
return staticFactoryCandidateInfo != null ? staticFactoryCandidateInfo.getSubstitutor() : null;
|
||||
}
|
||||
|
||||
+9
-7
@@ -445,17 +445,19 @@ public class InferenceSession {
|
||||
public static JavaResolveResult getResolveResult(final PsiCall callExpression, final PsiExpressionList argumentList) {
|
||||
if (callExpression instanceof PsiNewExpression) {
|
||||
final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)callExpression).getClassOrAnonymousClassReference();
|
||||
final JavaResolveResult resolveResult = classReference != null ? classReference.advancedResolve(false) : null;
|
||||
final PsiElement psiClass = resolveResult != null ? resolveResult.getElement() : null;
|
||||
if (psiClass instanceof PsiClass) {
|
||||
if (classReference != null) {
|
||||
return CachedValuesManager.getCachedValue(classReference, new CachedValueProvider<JavaResolveResult>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Result<JavaResolveResult> compute() {
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(callExpression.getProject());
|
||||
final JavaResolveResult constructor = facade.getResolveHelper()
|
||||
.resolveConstructor(facade.getElementFactory().createType((PsiClass)psiClass).rawType(), argumentList, callExpression);
|
||||
return new Result<JavaResolveResult>(constructor.getElement() == null ? resolveResult : constructor, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
|
||||
final JavaResolveResult resolveResult = classReference.advancedResolve(false);
|
||||
final PsiElement psiClass = resolveResult.getElement();
|
||||
JavaResolveResult constructor = JavaResolveResult.EMPTY;
|
||||
if (psiClass != null) {
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(callExpression.getProject());
|
||||
constructor = facade.getResolveHelper().resolveConstructor(facade.getElementFactory().createType((PsiClass)psiClass).rawType(), argumentList, callExpression);
|
||||
}
|
||||
return new Result<JavaResolveResult>(constructor.getElement() == null ? resolveResult : constructor, PsiModificationTracker.MODIFICATION_COUNT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user