BZ-1172711 - Regression in handling of inner classes/enums

(cherry picked from commit 479b55059acb82be0b85964ab6c5f46adc188ad5)