summaryrefslogtreecommitdiff
path: root/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java')
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java
index 8d91b620f798..da7b4b78930a 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.source.resolve.graphInference;
import com.intellij.psi.*;
import com.intellij.psi.impl.light.LightTypeParameter;
+import com.intellij.psi.util.PsiUtil;
import java.util.*;
@@ -49,6 +50,10 @@ public class InferenceVariable extends LightTypeParameter {
}
public boolean addBound(PsiType classType, InferenceBound inferenceBound) {
+ if (inferenceBound == InferenceBound.EQ &&
+ PsiUtil.resolveClassInClassTypeOnly(classType) == this) {
+ return false;
+ }
List<PsiType> list = myBounds.get(inferenceBound);
if (list == null) {
list = new ArrayList<PsiType>();
@@ -77,20 +82,18 @@ public class InferenceVariable extends LightTypeParameter {
}
}
+ if (!session.hasCapture(this) && dependencies.isEmpty()) {
+ return dependencies;
+ }
+
next:
for (InferenceVariable variable : session.getInferenceVariables()) {
if (!dependencies.contains(variable) && variable != this) {
- nextBound:
- for (List<PsiType> bounds : myBounds.values()) { //todo
+ for (List<PsiType> bounds : variable.myBounds.values()) { //todo
if (bounds != null) {
for (PsiType bound : bounds) {
- final Set<InferenceVariable> deps = new HashSet<InferenceVariable>();
- session.collectDependencies(bound, deps);
- if (deps.isEmpty()) {
- continue nextBound;
- }
-
- if (deps.contains(this)) {
+ final InferenceVariable inferenceVariable = session.getInferenceVariable(bound);
+ if (inferenceVariable == this) {
dependencies.add(variable);
continue next;
}