Make getCanonicalName handle $ correctly.

Class.getCanonicalName was treating '$' in the name as inner class
separators notably failing if the class actually contained a
'$' in its name.

Bug: issue 8905.
Change-Id: I01d5b8c18bdf598af03a729eac275beac32fda8e