river: fix enclosure type detection for generics