mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
ensure resolve is not cached during overload resolution
This commit is contained in:
@@ -312,17 +312,17 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
|
||||
|
||||
public static CurrentCandidateProperties getCurrentMethod(PsiElement context) {
|
||||
if (isOverloadCheck()) {
|
||||
ourOverloadGuard.prohibitResultCaching(ourOverloadGuard.currentStack().get(0));
|
||||
}
|
||||
final Map<PsiElement, CurrentCandidateProperties> currentMethodCandidates = CURRENT_CANDIDATE.get();
|
||||
return currentMethodCandidates != null ? currentMethodCandidates.get(context) : null;
|
||||
}
|
||||
|
||||
public static void updateSubstitutor(PsiElement context, PsiSubstitutor newSubstitutor) {
|
||||
final Map<PsiElement, CurrentCandidateProperties> currentMethodCandidates = CURRENT_CANDIDATE.get();
|
||||
if (currentMethodCandidates != null) {
|
||||
final CurrentCandidateProperties properties = currentMethodCandidates.get(context);
|
||||
if (properties != null) {
|
||||
properties.setSubstitutor(newSubstitutor);
|
||||
}
|
||||
CurrentCandidateProperties candidateProperties = getCurrentMethod(context);
|
||||
if (candidateProperties != null) {
|
||||
candidateProperties.setSubstitutor(newSubstitutor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.counting;
|
||||
import static java.util.stream.Collectors.groupingBy;
|
||||
|
||||
abstract class Token {
|
||||
|
||||
|
||||
private static B<Long> getMode(Optional<Map.Entry<Integer, Long>> max){
|
||||
return max
|
||||
.flatMap(e -> Optional.of(new B<>(Long.valu<ref>eOf(e.getValue().longValue()))))
|
||||
.get();
|
||||
}
|
||||
|
||||
static class B<K> {
|
||||
public B(K k) {}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.ResolveTestCase;
|
||||
|
||||
@@ -30,6 +31,14 @@ public class TypeInference18Test extends ResolveTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSecondConflictResolution() throws Exception {
|
||||
PsiReference ref = configureByFile("/codeInsight/daemonCodeAnalyzer/lambda/resolve/" + getTestName(false) + ".java");
|
||||
assertNotNull(ref);
|
||||
PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(ref.getElement(), PsiMethodCallExpression.class);
|
||||
assertNotNull(methodCallExpression);
|
||||
assertNotNull(methodCallExpression.resolveMethod());
|
||||
}
|
||||
|
||||
private LanguageLevel myOldLanguageLevel;
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user