På Fri, 08 Jun 2007 07:32:53 +0200, skrev Owen Jacobson
<angrybaldguy@gmail.com>:
> That's one of the many little warts Java has. While Foo.class looks
> like a static member expression, it's actually its own type of
> expression -- a class literal, though the term is not used in the
> JLS. The resemblance to static member access is convenient, but not
> carried through completely.
I seem to recall it's synthesized by the compiler into the method
Class class$() { return Class.forName("package.Foo"); }
which makes sense in a way.
Joshua Cranmer - 19 Jun 2007 01:35 GMT
> På Fri, 08 Jun 2007 07:32:53 +0200, skrev Owen Jacobson
> <angrybaldguy@gmail.com>:
[quoted text clipped - 10 lines]
>
> which makes sense in a way.
Actually, starting from Java 1.5, the VM code says that the
CONSTANT_Class_Info can be used as a valid argument for a ldc, so I would
assume that Foo.class would not be translated into an instance variable.