GrCodeReferenceElement (PsiClassType type) { if (type instanceof GrClassReferenceType) { return ((GrClassReferenceType)type).getReference(); } final PsiClassType.ClassResolveResult resolveResult = type.resolveGenerics(); final PsiClass refClass = resolveResult.getElement(); assert refClass != null : type; return createCodeReference(type.getCanonicalText()); }