In article <SWk1c.412$DU4.202@news.get2net.dk>, Jonas Kongslund
(dont@mail.me.at.all) says...
> Colin Samuel Rosenthal wrote:
>
> > Suppose I have a class with a whole lot of wild-card imports, like
> > java.util.*; etc. Is there a pre-processor which will take this
> > file (and a classpath) and replace the import list with one containing
> > just the actual classes referenced? Or could one reverse-engineer such a
> > list from the compiled .class file?
>
> You have misunderstood the import keyword. You should consider it as a
> compiler directive that is only used at compile time to fully qualify all
> unqualified class names.
Possibly, but I still think you have misunderstood what I am asking for.
I am aware that at compile time it is the fully qualified classes whch
are actually used. That is why it should be possible to obtain the list
of actual (fully-qualified) class names from the class file.
For example, if I have
import java.util.*;
but only use, say, List and Vector im my code, I would like a program
that would take my class file as input and spit out
java.util.List
java.util.Vector
as output. Why? So that I can clean up my source code and make it
conform to the convention of importing only fully-qualified class names.
Actually I think I may have found exactly what I'm looking for here
http://groups.google.com/groups?q=java+import+wildcard&hl=da&lr=&ie=UTF-
8&oe=UTF-8&selm=3adc85be%241%40post.newsfeeds.com&rnum=3
>
> Take a look at
> <
http://users.bigpond.net.au/stephen.davies/papers/javaImports.html>.
good link though.
--
Colin Rosenthal Sabbagh's Second Law: The biggest problem with
communication is the illusion that it has occurred.