views:

135

answers:

2

Does anyone know of an automated approach to refactoring code to minimize the visibility of classes, and their properties and methods? I'm trying to clean up an old API that has way too many public getters and setters to fit with JavaBean standards. An Eclipse plugin would be ideal, but any tool that could help would be great.

+5  A: 

IntelliJ idea can do a global analysis of code and tell you about all kinds of excessive visibility issues. If there's any dynamic technologies involved, it's also quite good at understanding that they are usages of a given method/class; but it's not perfect.

krosenvold
If you've got all the code that uses it, then yea, IntelliJ (or presumably Eclipse) can tell you all the places it's being used. It may or may not find usages via reflection though depending on the reflection tool.Otherwise, there's not much you can do other than remove it and see what breaks.
Chris Kessel
If there's public api's involved you *obviously* need client code too. The *full codebase* analyzis in Idea is amazing, but you still cannot go on a direct delete rampage without considering each item.
krosenvold
+1  A: 

I use Structure101 to maintain the structure of my application. It's worth a look.

Javamann