DRY-251: No conversions generated for enhanced for loop
I think the identifier of a foreach should get an AssignmentConversion. The JLS says that “meaning of the enhanced for statement is given by translation into a basic for statement” (http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.14.2). But if they bothered to specify it properly I’m sure they’d have mentioned it ;)Without this the type-checker can’t tell this is wrong:
Submitted on 4 April 2007 at 18:59
for(double d : new java.util.ArrayList()) { … }
Log in to post comments