mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inference: ensure thread local is cleared after calculation
This commit is contained in:
@@ -157,16 +157,17 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
map = ContainerUtil.createConcurrentWeakMap();
|
||||
CURRENT_CANDIDATE.set(map);
|
||||
}
|
||||
final CurrentCandidateProperties alreadyThere = map.put(getMarkerList(),
|
||||
final PsiElement argumentList = getMarkerList();
|
||||
final CurrentCandidateProperties alreadyThere = map.put(argumentList,
|
||||
new CurrentCandidateProperties(this, substitutor, isVarargs(), true));
|
||||
try {
|
||||
return computable.compute();
|
||||
}
|
||||
finally {
|
||||
if (alreadyThere == null) {
|
||||
map.remove(getMarkerList());
|
||||
map.remove(argumentList);
|
||||
} else {
|
||||
map.put(getMarkerList(), alreadyThere);
|
||||
map.put(argumentList, alreadyThere);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,8 +287,9 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
CURRENT_CANDIDATE.set(map);
|
||||
}
|
||||
final PsiMethod method = getElement();
|
||||
final CurrentCandidateProperties alreadyThere =
|
||||
map.put(getMarkerList(), new CurrentCandidateProperties(this, super.getSubstitutor(), policy.isVarargsIgnored() || isVarargs(), !includeReturnConstraint));
|
||||
final PsiElement argumentList = getMarkerList();
|
||||
final CurrentCandidateProperties alreadyThere =
|
||||
map.put(argumentList, new CurrentCandidateProperties(this, super.getSubstitutor(), policy.isVarargsIgnored() || isVarargs(), !includeReturnConstraint));
|
||||
try {
|
||||
PsiTypeParameter[] typeParameters = method.getTypeParameters();
|
||||
|
||||
@@ -309,9 +311,9 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
}
|
||||
finally {
|
||||
if (alreadyThere == null) {
|
||||
map.remove(getMarkerList());
|
||||
map.remove(argumentList);
|
||||
} else {
|
||||
map.put(getMarkerList(), alreadyThere);
|
||||
map.put(argumentList, alreadyThere);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user