Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect which deprecated classes are actively used?

Tags:

java

jvm

I have a relatively complex java project, with many classes that are probably not used.

Static analysis of the code base is relevant for some of the classes, but some are loaded dynamically (network services, persisted data, etc.)

Is there a method to get a list of deprecated classes that were actively used in the jvm, so I can know if those classes are used?

[I know there may be "sleeper classes" that are used only rarely, but that's a risk I can take]

like image 343
Ophir Yoktan Avatar asked Sep 30 '22 18:09

Ophir Yoktan


1 Answers

The JVM may have an option to print information about all used classes. For example:

java -verbose:class ...

You still would have to filter out the deprecated ones by some other means.

like image 133
Henry Avatar answered Oct 04 '22 04:10

Henry