use of com.intellij.refactoring.typeMigration.usageInfo.TypeMigrationUsageInfo in project intellij-community by JetBrains.
the class ClassTypeArgumentMigrationProcessor method migrateClassTypeParameter.
public void migrateClassTypeParameter(final PsiReferenceParameterList referenceParameterList, final PsiClassType migrationType) {
final PsiClass psiClass = PsiTreeUtil.getParentOfType(referenceParameterList, PsiClass.class);
LOG.assertTrue(psiClass != null);
final PsiClass superClass = psiClass.getSuperClass();
LOG.assertTrue(superClass != null);
myLabeler.getTypeEvaluator().setType(new TypeMigrationUsageInfo(superClass), migrationType);
final Map<PsiElement, Pair<PsiReference[], PsiType>> roots = new HashMap<>();
markTypeParameterUsages(psiClass, migrationType, referenceParameterList, roots);
final Set<PsiElement> processed = new HashSet<>();
for (Map.Entry<PsiElement, Pair<PsiReference[], PsiType>> entry : roots.entrySet()) {
final PsiElement member = entry.getKey();
final PsiType type = entry.getValue().second;
if (member instanceof PsiParameter && ((PsiParameter) member).getDeclarationScope() instanceof PsiMethod) {
myLabeler.migrateMethodCallExpressions(type, (PsiParameter) member, psiClass);
}
final PsiReference[] references = entry.getValue().first;
for (PsiReference usage : references) {
myLabeler.migrateRootUsageExpression(usage, processed);
}
}
}
use of com.intellij.refactoring.typeMigration.usageInfo.TypeMigrationUsageInfo in project intellij-community by JetBrains.
the class TypeEvaluator method getMigratedDeclarations.
public LinkedList<Pair<TypeMigrationUsageInfo, PsiType>> getMigratedDeclarations() {
final LinkedList<Pair<TypeMigrationUsageInfo, PsiType>> list = new LinkedList<>();
for (final TypeMigrationUsageInfo usageInfo : myTypeMap.keySet()) {
final LinkedList<PsiType> types = myTypeMap.get(usageInfo);
final PsiElement element = usageInfo.getElement();
if (element instanceof PsiVariable || element instanceof PsiMethod) {
list.addLast(Pair.create(usageInfo, types.getFirst()));
}
}
return list;
}
Aggregations