StringBuilder (PsiType type, StringBuilder text) { if (type instanceof PsiArrayType arrayType) { text.append("[]"); getTypeText(arrayType.getComponentType(), text); } else if (type instanceof PsiClassType) { PsiClass aClass = ((PsiClassType)type).resolve(); if (aClass != null && PsiUtil.isLocalClass(aClass)) { text.insert(0, aClass.getName()); aClass = aClass.getContainingClass(); while (aClass != null) { text.insert(0, aClass.getName() + '.'); aClass = aClass.getContainingClass(); } } else { final String canonicalText = type.getCanonicalText(); final String typeText = PsiNameHelper.getQualifiedClassName(canonicalText, false); text.insert(0, typeText); } } else { text.insert(0, type.getCanonicalText()); } return text; }