Friday, November 23, 2007

Java generics in enhanced for loops

How exactly should the java compiler translate enhanced for loops? Should it try to enforce type safety (e.g. List<string> should only contain strings)? The JLS thinks it should not. It is a bug that Sun's javac enforces this type safety!

I got embroiled in this discussion because of a post on my old article on for-each loops in java. (Disclosure: I am nishrs in that world).

No comments: