mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
new inference: restore cache after use
This commit is contained in:
@@ -143,7 +143,11 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
return applicabilityLevel;
|
||||
}
|
||||
finally {
|
||||
if (alreadyThere == null) map.remove(getMarkerList());
|
||||
if (alreadyThere == null) {
|
||||
map.remove(getMarkerList());
|
||||
} else {
|
||||
map.put(getMarkerList(), alreadyThere);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getApplicabilityLevelInner();
|
||||
@@ -269,10 +273,8 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
CURRENT_CANDIDATE.set(map);
|
||||
}
|
||||
final PsiMethod method = getElement();
|
||||
final CurrentCandidateProperties alreadyThere = map.get(getMarkerList());
|
||||
if (alreadyThere == null) {
|
||||
final CurrentCandidateProperties alreadyThere =
|
||||
map.put(getMarkerList(), new CurrentCandidateProperties(method, super.getSubstitutor(), isVarargs(), !includeReturnConstraint));
|
||||
}
|
||||
try {
|
||||
PsiTypeParameter[] typeParameters = method.getTypeParameters();
|
||||
|
||||
@@ -293,7 +295,11 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
.inferTypeArguments(typeParameters, method.getParameterList().getParameters(), arguments, mySubstitutor, parent, policy, myLanguageLevel);
|
||||
}
|
||||
finally {
|
||||
if (alreadyThere == null) map.remove(getMarkerList());
|
||||
if (alreadyThere == null) {
|
||||
map.remove(getMarkerList());
|
||||
} else {
|
||||
map.put(getMarkerList(), alreadyThere);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
abstract class Overloadsss {
|
||||
abstract <T> List<T> foo(List<T> l);
|
||||
abstract <T> Set<T> foo(Set<T> s);
|
||||
|
||||
abstract <K> List<K> bar(List<K> l);
|
||||
abstract <K> List<K> bar1(List<K> l);
|
||||
abstract <K> Set<K> bar1(Set<K> s);
|
||||
|
||||
{
|
||||
List<String> l = foo(bar (null));
|
||||
List<String> l1 = foo(bar1<error descr="Ambiguous method call: both 'Overloadsss.bar1(List<Object>)' and 'Overloadsss.bar1(Set<Object>)' match">(null)</error>);
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testOuterCallOverloads() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user