Added Scala singleton handling for traits, as well as classes. Fixes JIRA 6950