WICKET-5647 missing generic cast causes compile error on OS X / jdk 8 (reapplied after short discussion)