How to get all imports defined in a class using java reflection?

I just wanna know the list of all
import defined in a class using
reflection

You can’t because the compiler doesn’t put them into the object file. It throws them away. Import is just a shorthand to the compiler.

Leave a Comment