adding class filter for generate toString
(cherry picked from commit 9ca0518)
IDEA-130798 (SSR retains too much memory) (cherry picked from commit ebbf9f1)[IDEA-CR-1039