Fixed CompileTask cast bug on Java 8