Is there a Java tool to reduce the visibility of methods

I have an outdated code base that I want to reorganize in order to reduce the visibility of methods to the minimum possible (closed, protected, by default), so that the code still works. Many of the methods in the code base are unjustifiably public, and I would like to change this to reduce the load on the interface and simplify the documentation as the code evolves in the future. Is there a tool that will analyze the code base and generate a list of suggested methods whose visibility can be reduced? I can specify all the entry points to the code (only the main methods), and the code base does not use reflection.

The Eclipse plugin will be even better.

+4
source share
2 answers

Although there are tools that you can use to report the appearance of methods whose visibility may be reduced, I don’t know about anything that allows you to transform the code to solve these problems.

However, you can find an interesting look at JTransformer and Ekeko . Both allow you to query and perform custom code transformations based on logical programming methods. JTransformer may be a little more mature, but Ekeko also looks pretty interesting. As far as I know, both of them are open source and include the Eclipse plugin.

+1
source

UCDetector ( - " " ) http://www.ucdetector.org/ eclipse . , .

+1

Source: https://habr.com/ru/post/1535837/


All Articles