Changed generic cast to implicit because eclipse is too smart.