refactoring: moved method

This commit is contained in:
Svetlana Isakova
2013-09-25 20:52:23 +04:00
parent c150c22473
commit ac33ccc0fe
3 changed files with 25 additions and 25 deletions
@@ -707,4 +707,27 @@ public class TypeUtils {
}
);
}
public static TypeSubstitutor makeConstantSubstitutor(Collection<TypeParameterDescriptor> typeParameterDescriptors, JetType type) {
final Set<TypeConstructor> constructors = Sets.newHashSet();
for (TypeParameterDescriptor typeParameterDescriptor : typeParameterDescriptors) {
constructors.add(typeParameterDescriptor.getTypeConstructor());
}
final TypeProjection projection = new TypeProjection(type);
return TypeSubstitutor.create(new TypeSubstitution() {
@Override
public TypeProjection get(TypeConstructor key) {
if (constructors.contains(key)) {
return projection;
}
return null;
}
@Override
public boolean isEmpty() {
return false;
}
});
}
}