Tonio's Dev blog

Friday, November 03, 2006

The build environment of tom now integrates the use of findbugs, to help spotting errors.

Yet, we are starting to fix the issues it shows.
The first ones were about an incorrect use of the Cloneable interface.

To me, this issue is weird: you should use "super.clone()" when defining the clone() method, instead of using "new", so that the class can be later extended. The problem is that I want the "clone()" method to be public, and not to throw "CloneNotSupportedException". Then, y have to "try{ } catch" this exception in the clone method, and send a RuntimeException in the catch part. But it will never happen, as I implement Cloneable.

Is Java's Cloneable interface simply poorly designed, or am I simply misusing it? Seems like Joshua Blosh favor the first solution.

1 Comments:

Post a Comment

<< Home