This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Be a language designer...
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Eric Gunnerson, formerly of the C# team, got an email stating:
When I'm writing code, I often come across a situation where my code throws an exception because another component called with a null parameter. I'd like a way to prevent that from happening.
People started down the path of having an Annotation which would be able to enforce the contract that nulls can't be passed in (@NullNotAccepted void doFoo(String whee) { }).
I don't know how valuable this would be, as you can do checks yourself, or even use AOP to do some of this for you.
The key for me is having a decent trace on what the hell is going on when a NullPointerException is thrown. I want my system to tell me exactly what was going on when this happened. With the right info you can then attack the problem, but how often do you get a NullPointerException with zero information and have no idea what the hell is going on! This just comes down to having a nice policy of being good with exception handling, and having precise reporting.