check correct reference to type parameter

also for classes

Change-Id: Ib9f1e4016c9dda8a196b9ba98be0903811631d60