Merge from google internal, fixing nested class injection/generation and add some extra ClassName tests.

I'm surprised the lack of space after the `if` here and below passed checkstyle.