Originally posted by DharmendraKumar Sharma: Is there way to get the list of class names(with package name) and method names invoked for a given class(Source).
There must be a way to get such a list, because the compiler needs to do such things. You might look at tools.jar to find out, how they do it. You could parse all import statements for imported packages + java.lang (because of "Foobar".replaceAll ("o", "i"); ). Parse your file for all Class-invokations and methodcalls. Study the JLS to find out, how nameconflicts are avoided. ... Another approach would be to look at Open-Source-Software, how it is managed there (eclipse for example). ... Compiling the class and using reflection would be the fastest solution I guess. Dynamical compiling is again possible with tools.jar, but you have to take care about the special license for that jar (it isn't part of the jre). [ December 16, 2005: Message edited by: Stefan Wagner ]
This information is in the class file in a well-documented and readable format. Surely easier than keeping track of imports and class references in raw source. This will only help you find "static" class references, and won't spot any class.forName( name ).newInstance() style creation.
We use a tool with an interesting approach ... they insert a custom class loader immediately after the boot loader and keep track of all classes loaded. It works as long as all other custom class loaders delegate to their parents correctly.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.