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

(cherry picked from commit 57c41e26da250637e7a40b0f7db5eaaca6836e37)