Use cls in classmethods

issue4396
review13771002