Class cast is needed on JDK8