Re: load module Mark S. Miller (markm@caplet.com)
Tue, 13 Jun 2000 20:50:42 -0700

At 12:44 AM 6/10/00 , Michael Neumann wrote:
>Another question:
>How can I create an instance (or access static's) of an inner class?
>
>Example:

[like your example, except I added the package declaration and made B public:]

package foo;

public class A {

     static public class B {
     }

}

>Here I want to get an instance of A.B .

Thanks for the info about 1.2.x. I've also verified that it works on 1.3. However, by experimentation, I believe I have a simple solution that works now; but I'm not sure if I'm relying only on the Java spec, or on a non-guaranteed implementation detail.

On the Java's I have, A.B is mangled by the Java compiler into A$B. If you are willing to rely on this, then the following works fine:

<import:foo.A$B>

If this mangling is not a guaranteed part of the spec, we can explore other options.

Hope this helps.

         Cheers,
         --MarkM