Sync from Google's internal repository.

Adds an initial `@Component` annotation, cleans up some of the generation framework and adds some validation logic. Also merges in a few minor cleanups and a performance fix.