mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
skip inference from parent for diamond's search for constructor (IDEA-101166)
This commit is contained in:
@@ -47,6 +47,13 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
public static final Pair<PsiType,ConstraintType> RAW_INFERENCE = new Pair<PsiType, ConstraintType>(null, ConstraintType.EQUALS);
|
||||
private final PsiManager myManager;
|
||||
|
||||
public static final ThreadLocal<Map<PsiElement, PsiType>> OUR_CONSTRUCTORS = new ThreadLocal<Map<PsiElement, PsiType>>(){
|
||||
@Override
|
||||
protected Map<PsiElement, PsiType> initialValue() {
|
||||
return new HashMap<PsiElement, PsiType>();
|
||||
}
|
||||
};
|
||||
|
||||
public PsiResolveHelperImpl(PsiManager manager) {
|
||||
myManager = manager;
|
||||
}
|
||||
@@ -76,7 +83,13 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
substitutor = substitutor.putAll(TypeConversionUtil.getSuperClassSubstitutor(aClass, anonymous, substitutor));
|
||||
}
|
||||
else {
|
||||
processor = new MethodResolverProcessor(aClass, argumentList, place);
|
||||
final PsiType alreadyThere = OUR_CONSTRUCTORS.get().put(argumentList, type);
|
||||
try {
|
||||
processor = new MethodResolverProcessor(aClass, argumentList, place);
|
||||
}
|
||||
finally {
|
||||
if (alreadyThere == null) OUR_CONSTRUCTORS.get().remove(argumentList);
|
||||
}
|
||||
}
|
||||
|
||||
ResolveState state = ResolveState.initial().put(PsiSubstitutor.KEY, substitutor);
|
||||
@@ -1149,6 +1162,10 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
@NotNull final PsiCallExpression parentCall) {
|
||||
if (Registry.is("disable.graph.inference", false)) return null;
|
||||
final PsiExpressionList argumentList = parentCall.getArgumentList();
|
||||
final PsiType inferDiamond = OUR_CONSTRUCTORS.get().get(argumentList);
|
||||
if (inferDiamond != null) {
|
||||
return FAILED_INFERENCE;
|
||||
}
|
||||
return ourGraphGuard.doPreventingRecursion(methodCall, true, new Computable<Pair<PsiType, ConstraintType>>() {
|
||||
@Override
|
||||
public Pair<PsiType, ConstraintType> compute() {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class IDEA10166 {
|
||||
Supplier<M1> mapSupplier,
|
||||
BiConsumer<M1, T> accumulator) {
|
||||
BinaryOperator<M1> mapBinaryOperator = leftMapMerger(mergeFunction);
|
||||
return null;//new CollectorImpl<>(mapSupplier, accumulator, leftMapMerger(mergeFunction));
|
||||
return new CollectorImpl<>(mapSupplier, accumulator, leftMapMerger(mergeFunction));
|
||||
}
|
||||
|
||||
static <K, V, M2 extends Map<K, V>> BinaryOperator<M2> leftMapMerger(BinaryOperator<V> mergeFunction) {
|
||||
|
||||
Reference in New Issue
Block a user