mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
Description
This commit is contained in:
@@ -6,6 +6,8 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
@@ -17,19 +19,28 @@ import java.util.LinkedList;
|
||||
public class PsiTypeVariableFactory {
|
||||
private int myCurrent = 0;
|
||||
private LinkedList<HashSet<PsiTypeVariable>> myClusters = new LinkedList<HashSet<PsiTypeVariable>>();
|
||||
private HashMap<Integer, HashSet<PsiTypeVariable>> myVarCluster = new HashMap<Integer, HashSet<PsiTypeVariable>>();
|
||||
|
||||
public final int getNumber() {
|
||||
return myCurrent;
|
||||
}
|
||||
|
||||
public final void registerCluster (final HashSet<PsiTypeVariable> cluster){
|
||||
public final void registerCluster(final HashSet<PsiTypeVariable> cluster) {
|
||||
myClusters.add(cluster);
|
||||
|
||||
for (final Iterator<PsiTypeVariable> v=cluster.iterator(); v.hasNext();){
|
||||
myVarCluster.put (new Integer(v.next().getIndex()), cluster);
|
||||
}
|
||||
}
|
||||
|
||||
public final LinkedList<HashSet<PsiTypeVariable>> getClusters() {
|
||||
return myClusters;
|
||||
}
|
||||
|
||||
public final HashSet<PsiTypeVariable> getClusterOf (final int var){
|
||||
return myVarCluster.get(new Integer (var));
|
||||
}
|
||||
|
||||
public final PsiTypeVariable create() {
|
||||
return new PsiTypeVariable() {
|
||||
private int myIndex = myCurrent++;
|
||||
|
||||
@@ -31,6 +31,7 @@ public class BindingFactory {
|
||||
private int[] myBoundVariableIndices;
|
||||
private HashSet<PsiTypeVariable> myBoundVariables;
|
||||
private Project myProject;
|
||||
private PsiTypeVariableFactory myFactory;
|
||||
|
||||
private PsiClass[] getGreatestLowerClasses(final PsiClass aClass, final PsiClass bClass) {
|
||||
if (InheritanceUtil.isInheritorOrSelf(aClass, bClass, true)) {
|
||||
@@ -77,6 +78,16 @@ public class BindingFactory {
|
||||
myCyclic = type instanceof PsiTypeVariable;
|
||||
|
||||
myBindings[index] = type;
|
||||
|
||||
if (type instanceof Bottom){
|
||||
final HashSet<PsiTypeVariable> cluster = myFactory.getClusterOf(index);
|
||||
|
||||
if (cluster != null){
|
||||
for (final Iterator<PsiTypeVariable> v=cluster.iterator(); v.hasNext();){
|
||||
myBindings[v.next().getIndex()] = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BindingImpl(final int n) {
|
||||
@@ -791,6 +802,7 @@ public class BindingFactory {
|
||||
myVariablesNumber = system.getVariableFactory().getNumber();
|
||||
myBoundVariables = system.getBoundVariables();
|
||||
myProject = system.getProject();
|
||||
myFactory = system.getVariableFactory();
|
||||
|
||||
final PsiTypeVariable[] index = myBoundVariables.toArray(new PsiTypeVariable[]{});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user