Added patterns for initialization for Scala #2297
(cherry-picked from e2aa3b5)
Merge pull request #1185 from drewhk/wip-2297-lifecycle-patterns-forwardport-drewhk

Added patterns for initialization for Scala #2297 (forward-port)