If I am interpreting the Java Language Specification (§4.6. Type Erasure) correctly, this is a "gotcha" of the language:
Type erasure also maps the signature (§8.4.2) of a constructor or method to a signature that has no parameterized types or type variables. The erasure of a constructor or method signature s is a signature consisting of the same name as s and the erasures of all the formal parameter types given in s.
I believe that this states that if you declare a type (Task) that is declared with a generic parameter (Task<U>) without said generic parameter, all its functions also lose their generic types, whether they are related or not. Therefore, your task.getIDs() is interpreted by the compiler as returning a plain List, not a List<Integer>. The iterator for that, of course, produces Objects, not Integers, causing the compiler error you see.
The reason for this is likely backwards compatibility with code produced before Java 1.5, when generics were introduced.