How can I find (and exclude) all unacceptable fields declared in an interface?

After eliminating any particular pattern of meaninglessness, I need to identify and possibly delete the fields that are declared in some interface as follows:

public interface X { String A = "xxx"; String B = "zzz"; } 

Of course, I can use Eclipse to β€œfind all links” for one identifier after another, but in front of thousands of them it may look like a very boring complete job for several days.

I tried both Google CodePro and warnings that the Java compiler can spit out on demand, but found only options for non-public fields in classes, and not for public fields in interfaces.

My next attempt would be: Comment on everything, and go through the list of errors. All fields that are not listed in the error list can be deleted (in my case!). This will also be a boring day, because instead of listing all the fields that have active links, I'm looking for a list of all the fields that are not referenced anywhere.

So how can I effectively find all of these urgent fields?

I mean: I see that it’s dangerous to look at these links for this project, because another project that my Eclipse workspace is not aware of may have links. Perhaps this was the rationale for not suggesting the warning / analysis option I'm looking for in Eclipse or CodePro.

This is not true. If it is not referenced in my project, I want to exclude it.

+4
source share
2 answers

I think UCDetector is what you want: http://www.ucdetector.org/

+9
source

If IntelliJ IDEA is an option for you, even a free community version will highlight unused interface methods in place

0
source

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


All Articles