Saturday, November 13, 2004

Bad choice for Enumerations in J2SE 5.0

Once again, I can't tell too much here, but I'm very unhappy with the implementation of enumerated types for J2SE 5.0.

If I have an enumeration such as


public enum Weekdays {
SUNDAY,
MONDAY,
...
SATURDAY,
SUNDAY};


I cannot choose to disallow this:

Weekday weekday = null;

Now all my code still requires if(blah == null). Not very happy.

No comments: