This post is available at http://www.thinkcode.se/blog/2011/07/28/do-not-return-null
Good point. But isn’t java.lang.UnsupportedOperation the standard exception to use for not implemented methods?
Comment by Peter Koller — July 29, 2011 @ 18:42
You might be right. But then again, not supported isn’t really what I want to express. The operation is supposed to be supported, it just hasn’t been implemented yet.
Comment by Thomas Sundberg — July 29, 2011 @ 19:22
Thanks a lot.. Changing the IntelliJ behavior saved me lot of repetitive work :). You can remove the #if check, so that methods with void type also throw exception.
Comment by tom — March 28, 2015 @ 01:56
You are absolutely right, removing the #if and keep the throw is a good suggestion.
I took a look at my current Idea settings and realized that that is the exact implementation I use myself. So, I implement this as
throw new NotImplementedException();
and nothing more.
Comment by Thomas Sundberg — March 28, 2015 @ 11:08
RSS feed for comments on this post. TrackBack URI
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Blog at WordPress.com.