My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

What Does it Do?

Mutability Detector is designed to analyse Java classes and report on whether instances of a given class are immutable. It is intended that Mutability Detector will be usable at runtime, as part of your Java application, as a standalone task, or integrating with your unit testing library of choice.

Why Try To Detect Mutability?

Developing classes to be immutable has several benefits. An immutable object is one which cannot be changed once it is constructed. While writing concurrent programs, using immutable objects can greatly simplify complex systems, as sharing an object across threads is much safer. There are a few rules for what makes an object immutable, and it is easy to break the rules and render the object unsafe. This could lead to subtle, hard-to-detect bugs which could lower the integrity of the system. Using an automated tool to recognise mutability where it's not intended can reduce the complexity of writing immutable classes.

Mutability Detector is in the very early stages of development. To give an idea of the performance, on a Thinkpad T61 the tool runs over the JVM's rt.jar (48MB, 17,000 classes) in under 2 minutes. The tool analyses on the strict side, very few classes are found to be perfectly immutable, for instance, java.lang.String and java.lang.Integer are not immutable because of a non-final field, and primitive array field, respectively. Mutability Detector will not be released under a 1.0 version until these cases can be correctly analysed.

If this sounds like it may be interesting or useful to you, check out the introduction on the project wiki here. You can also contact me through the Mutability Detector Blog, or through email

How To Get It

Mutability Detector comes packaged as a single jar which can be used for runtime analysis, an assertion mechanism in a unit test, or as a standalone application launched from the command line.

The jar can be downloaded from the downloads page or declared as a dependency in maven-compatible build tools.

Start Unit Testing Immutability With Mutability Detector

The help guide (disguised as JavaDoc API) is available here.

Mutability Detector Blog

Powered by Google Project Hosting