Rebase #2728 (SI-7658 Prevent StackOverflowError in ScalaRunTime.stringOf)

Rebase #2728