views:

96

answers:

2

I'm looking for a Java tool which can automate reducing the visibility of classes and methods which don't need to be public. I want to reduce the amount of methods/classes that are public so that the only remaining public ones are the ones I want to expose as part of the public API. I have quite a lot of classes and methods so would like a tool to automate this.

I expected some better tools for doing this - is there anything in IntelliJ that can help?

+1  A: 

You can use JDepend or CAP to view type references. It's not that helpful for methods though.

If there aren't that many methods, this approach will work.

In Eclipse you can search for all references to a method by selecting it and hitting Ctrl+Shift+G.

Rich Seller
I will have a look at JDepend and CAP. There are lots of methods - the Ctrl+Shift+G method would take too long.
Supertux
It also works at the type level, so as a first pass if there are no type references (or at least none outside the package) you can make the type and all methods less visible
Rich Seller
A: 

It's not an automated solution but could you bring up the Package View in eclipse, then start making methods and classes private. If it causes a problem you will see it almost instanly in the package viewer.

Ben