Category Archives: java

Checked exceptions #2

In a previous post, I mentioned that I’ve filed a feature request on sun’s developer network for an option to turn off those [expletive deleted] checked exceptions in Java. Well, I had a chance to ask Peter Ahé (lead developer on sun’t java compiler) about it and he didn’t think very much of the idea. Darn. I guess a solution to this isn’t around the corner.

Update: The feature request been accepted as RFE 6376696.

iText

At work, I’m currently working on a documentation generator similar to JavaDoc or Doxygen for our new system. I browsed around a bit for a Java library for constructing PDF documents and found iText, which is one of the best structured and most well-documented java library I’ve ever come across. Their iText by Example tutorial has so many examples that anything you’ll want to do when you first try iText will be covered. And by the time you want to do something advanced that is not described in the tutorial, you’ll know enough about how things work that you’re likely to be able to figure it out yourself. Brilliant!

Checked exceptions

For a long time, I have been really annoyed with checked exceptions in Java. They break encapsulation and seem to pop up all over the place especially when I’m really busy and irritable. And because I have to handle these exceptions right there in the middle of my code where I don’t want to, my exception handlers are often accompanied by angry all-caps comments about how much I hate checked exceptions.

I’m not the only one though; they decided to not have them in C# (see this interview with Anders Hejlsberg) and mr. Thinking in Java, Bruce Eckel, has an essay about why they’re bad.

I decided to suggets that we change the severity of uncaught checked exceptions in eclipse from ‘error’ to ‘ignore’ at work. Unfortunately, it turned out that there was no such option in eclipse, I don’t know why I thought that. Instead, I made a feature request for it in the eclipse bug system (#119230). It only took them a few hours for them to reply: it shouldn’t be possible to configure the eclipse Java compiler so that it accepts code that is illegal by the java language specification. Dammit, that sounds pretty reasonable.

Well, now I’ve filed a feature request at sun’s developer network () but I’m not very optimistic. We’ll see what happens.