View on GitHub

Mutability Detector

Lightweight analysis tool for detecting mutability in Java classes

Download this project as a .zip file Download this project as a tar.gz file

What is Mutability Detector?

Mutability Detector is designed to analyse Java classes and report on whether instances of a given class are immutable. It can be used:

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.

Getting started with Unit Testing

Got Mutability Detector jar? Ready to write your first test? Check out the getting started guide!

Mutability Detector Blog

Check out the latest Mutability Detector blog posts: