void (@NotNull CompositeElement reference, PsiClass referencedClass, PsiSubstitutor substitutor) { reference.putCopyableUserData(REFERENCED_CLASS_KEY, referencedClass); final PsiTypeParameter[] typeParameters = referencedClass.getTypeParameters(); if (typeParameters.length == 0) return; final ASTNode referenceParameterList = reference.findChildByRole(ChildRole.REFERENCE_PARAMETER_LIST); int index = 0; for (ASTNode child = referenceParameterList.getFirstChildNode(); child != null && index < typeParameters.length; child = child.getTreeNext()) { if (child.getElementType() == JavaElementType.TYPE) { final PsiType substitutedType = substitutor.substitute(typeParameters[index]); if (substitutedType != null) { encodeInfoInTypeElement(child, substitutedType); } index++; } } final ASTNode qualifier = reference.findChildByRole(ChildRole.QUALIFIER); if (qualifier != null) { if (referencedClass.hasModifierProperty(PsiModifier.STATIC)) return; final PsiClass outerClass = referencedClass.getContainingClass(); if (outerClass != null) { encodeClassTypeInfoInReference((CompositeElement)qualifier, outerClass, substitutor); } } }