I am writing a compiler for Java, and would like to implicitly import java.lang
package to all source files (This is what most Java compilers that I know of do).
To do that, I need to somehow obtain either a set of all classes (ie.,Set<Class<?>>
) or a set of all qualified names (ie., Set<String>
) of all classes in the package.
I've looked at the reflections API from this page, but the structure of my project (and other factors) make it a less-than-suitable candidate.
So I'm wondering whether there is any other way to obtain such classes (other than hard-coding the thing, of course!)? The fact that java.lang
is the most popular package in Java kind of suggests that there should be some way(s).