Nice things coming in java 1.5

This slashdot article about generics points to JSR-201. This contains some concrete proposals for enumerations, autoboxing, enhanced for loop and static import. I hadn’t seen these before, and they make for interesting reading.

    My comments would be:

  • Why introduce a new syntax for ‘foreach’ given that the c# one is so widespread?
  • I’d prefer blocks to foreach - but I guess its harder to implement.
  • I like covariant return types a lot (actually from generics aka JSR-014).
  • static import is nice syntactical sugar
  • boxing/unboxing is nice syntactical sugar
  • enum is really nice - basically syntactical sugar for the typesafe enum pattern - and I want to be able to do for (Day d : Day.monday .. Day.friday)

Leave a Reply