Update ScalaDoc code examples not to use deprecated constructs

- Replace newTermName in favour of TermName
- Replace newTypeName in favour of TypeName
Merge pull request #4166 from lpiepiora/update-scaladoc-examples

Update ScalaDoc code examples not to use deprecated constructs