mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
new inference: avoid prohibit cashing, don't check exceptions during overload resolution instead (IDEA-139531)
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -340,9 +339,6 @@ public class LambdaUtil {
|
||||
if (gParent instanceof PsiCall) {
|
||||
final PsiCall contextCall = (PsiCall)gParent;
|
||||
final MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(contextCall.getArgumentList());
|
||||
if (MethodCandidateInfo.isOverloadCheck()) {
|
||||
MethodCandidateInfo.ourOverloadGuard.prohibitResultCaching(MethodCandidateInfo.ourOverloadGuard.currentStack().get(0));
|
||||
}
|
||||
if (properties != null && properties.isApplicabilityCheck()) { //todo simplification
|
||||
final PsiParameter[] parameters = properties.getMethod().getParameterList().getParameters();
|
||||
final int finalLambdaIdx = adjustLambdaIdx(lambdaIdx, properties.getMethod(), parameters);
|
||||
|
||||
@@ -409,6 +409,10 @@ public class ExceptionUtil {
|
||||
public static List<PsiClassType> getUnhandledExceptions(@NotNull final PsiCallExpression methodCall,
|
||||
@Nullable final PsiElement topElement,
|
||||
final boolean includeSelfCalls) {
|
||||
//exceptions only influence the invocation type after overload resolution is complete
|
||||
if (MethodCandidateInfo.isOverloadCheck()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final JavaResolveResult result = methodCall.resolveMethodGenerics();
|
||||
final PsiMethod method = (PsiMethod)result.getElement();
|
||||
if (method == null) {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
|
||||
class Test {
|
||||
|
||||
{
|
||||
Set<Map.Entry<String, Integer>> sort3 = new TreeSet<>((x, y) -> {
|
||||
return Integer.compare(x.get<ref>Value(), y.getValue());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,10 @@ public class TypeInference18Test extends ResolveTestCase {
|
||||
doTestMethodCall();
|
||||
}
|
||||
|
||||
public void testSecondConflictResolution1() throws Exception {
|
||||
doTestMethodCall();
|
||||
}
|
||||
|
||||
public void testCachedSubstitutionDuringOverloadResolution() throws Exception {
|
||||
PsiReference ref = configureByFile("/codeInsight/daemonCodeAnalyzer/lambda/resolve/" + getTestName(false) + ".java");
|
||||
assertNotNull(ref);
|
||||
|
||||
Reference in New Issue
Block a user