IdToEntityConverter defensively handles access to getDeclaredMethods

Issue: SPR-11758
(cherry picked from commit 381ccde)