Community
Participate
Working Groups
(using RC3) In the following example code, I get the warning "Unnecessary cast from Set<Integer> to Collection". But if I remove the cast, I get the (expected) error "Type mismatch: cannot convert from Set<Integer> to Collection<Number>"... so, I don't think the cast is unnecessary. ---- package test; import java.util.*; public class Foo { @SuppressWarnings("unchecked") public static void main(String[] args) { Set<Integer> set = new HashSet<Integer>(); set.add(42); Collection<Number> collection; collection = (Collection) set; System.out.println(collection.iterator().next()); } }
Agreed.
Added GenericTypeTest#test833 *** This bug has been marked as a duplicate of 106010 ***