Now, I have never used Find Bugs – but I really like the thought of having code help me improve my own code. I am human – I know that I make mistakes and that there are (still) some things that I do not know. So I decided to try the plug-in minutes after Christian had released it.
These are the steps to get going:
- Open the above link to the project on OpenNTF.org in your IBM Notes browser
- Then drag the plugin to your “My widgets” in the sidebar of IBM Notes
- Wait for it to install – and then restart (remember to close Domino Designer first if you have it open)
That’s it. Now the plug-in is installed in Domino Designer.
How to use
Then how do you use it?
- Open the Package Explorer (it is ready next to the Domino Designer Database Navigator in the XPages perspective)
- Right-click somewhere in the outline of your project (i.e. the database – not your on-disk-project). Select “Find Bugs” which unfolds a small menu
- Select “Find Bugs” on the menu
- Then nothing happens (unless you follow the progress bar at the lower right corner)
- When the progress bar stops running (or before) you can switch to the Find Bugs perspective. Select “Window / Open Perspective / Other…” and locate “FindBugs”
- You are now ready to investigate your Java coding errors/warnings
If you right-click on the title of the database in the Domino Designer Database Navigator then you will suddenly find the Find Bugs menu. This is true for the XPages perspective as well as the Domino Designer perspective:
Here is an example of some code that I have written that was wrong. Tests have not yet tried the particular condition so there is a possibility that I would eventually have ended up shipping the code with this bug.
In the left side you will see the navigator with the varioous warnings – grouped by how “scary” (!!) they are. If you double-click on a warning you will see the code on the right top side. And at the right corner at the bottom there is a description of the problem discovered.
Now it is up to you to find the best solution to the problem. It took me less than an hour to tidy up a current project with 250+ Java classes. And I even learned a lesson on the way (about cloning the equals() method).
This tool has now become a must-have to improve my Java coding.
As a side note – if there is ever one Java book that you should read, it is Josha Bloch’s Effective Java. Find Bugs help you follow the guidance and rules from this book.