Java News from Monday, January 5, 2009

Sun has posted the public review draft of JSR-303 Bean Validation. This enables one to define constraints that can be applied to method arguments via annotations. However it's limited, and requires JavaBeans method-naming conventions to be followed. This would be better addressed by language-level support for preconditions and class invariants. Liek generics and the various closure proposals, it's a half-measure that's too crippled by backwards compatibility to really achieve its goals. Sometimes, when you can't do something the right way, it's better not to do it at all. Whether Bean Validation is one of those times, I'm not yet sure; but I'm beginning to suspect it is.