[DROOLS-640] fix type declarations when declaring a class with a subclass-typed attribute

(cherry picked from commit 92055be90cc43618dec9c2cb917a9efa4e3ad50c)