Generate clone() plugin for Eclipse

This plugin consists of two parts:
  1. An Eclipse builder that detects four different code smells w.r.t. cloning:
    1. Returning null from clone()
    2. Never calling super.clone().
    3. Implementing clone() but not Clooneable or vice versa.
    4. In a Java 5 project, not using the covariant return type for clone().
  2. A code generator very similar in style to "generate hashCode()/equals()" that allows to generate correct clone methods with selective deep copy of fields that have as declared type a reference type that also implements Cloneable.


Two kinds of informal documentation exist:

Installation via update site

Point Eclipse to this URL:


To use the plugin, install it as usual and then simply right click on any Java project and click on Enable/disable checking of clone(). The builder will then check for wrong implementations of clone() during the next build process. Generated warnings can be fixed via quick fixes. Alternatively, you can also right-click on any type and have a clone() method generated for you.

Integration into JDT

I am currently discussion integration of this plugin into the main Eclipse build stream. If you support this idea, you might want to vote for it here.

Screen shots



Code generation dialog