Minor optimization when calling class tranformers. The code was previously moved from another place but can now be optimized. Backport of r1823492 and r1823495 from trunk resp. r1823497 from tc8.5.x