GROOVY-6691: Reworked fix for GROOVY-6691 without dropping generics information