Backport of DDC-1590: Fix Inheritance in Code-Generation into 2.4 branch