From 715448dd8b1fa03f4abedc7cb50371045d6ce4ae Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 18 Jun 2019 19:47:05 +0200 Subject: [PATCH] inference: cleanup GitOrigin-RevId: ae8713b005dde291b1178157e884b0d304443bf9 --- .../InferenceIncorporationPhase.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceIncorporationPhase.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceIncorporationPhase.java index 7a9b2998740f..7ed9bf771e25 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceIncorporationPhase.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceIncorporationPhase.java @@ -352,15 +352,15 @@ public class InferenceIncorporationPhase { * there exists a supertype (4.10) of S of the form G and a supertype of T of the form G, * then for all i, 1 <= i <= n, if Si and Ti are types (not wildcards), the constraint (Si = Ti) is implied. */ - private boolean upUp(List upperBounds) { - return InferenceSession.findParameterizationOfTheSameGenericClass(upperBounds, pair -> { + private void upUp(List upperBounds) { + InferenceSession.findParameterizationOfTheSameGenericClass(upperBounds, pair -> { final PsiType sType = pair.first; final PsiType tType = pair.second; if (!(sType instanceof PsiWildcardType) && !(tType instanceof PsiWildcardType) && sType != null && tType != null) { addConstraint(new TypeEqualityConstraint(sType, tType)); } return false; - }) != null; + }); } private void addConstraint(ConstraintFormula constraint) { @@ -368,16 +368,8 @@ public class InferenceIncorporationPhase { } public void addBound(InferenceVariable variable, PsiType type, InferenceBound bound) { - Map> bounds = myCurrentBounds.get(variable); - if (bounds == null) { - bounds = new HashMap<>(); - myCurrentBounds.put(variable, bounds); - } - Set types = bounds.get(bound); - if (types == null) { - types = new LinkedHashSet<>(); - bounds.put(bound, types); - } - types.add(type); + myCurrentBounds.computeIfAbsent(variable, k1 -> new HashMap<>()) + .computeIfAbsent(bound, k -> new LinkedHashSet<>()) + .add(type); } }