[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: maybe a semantic mistake?



Okay, I see.  Well, in any case, either Jikes RVM or the Sun, IBM, and Sable JVM's are doing something wrong, so somebody able to express the problem more precisely than me should send a mail to some well-read Java list and see what people say.  

Ondrej Lhotak wrote:
On Thu, Mar 06, 2003 at 10:39:07PM -0500, Chris Pickett wrote:
  
   Hi,

   I'm confused by Feng's example ... if you call public invoke_f() from an
   instance of C, then isn't it correct for invoke_f() to call the private
   B.f() because invoke_f() is a method belonging to B and therefore should
   be able to access all private methods and variables?  I suppose it comes
    

I think the idea is that if a method wants to call a private method in
the same class, it must use invokespecial, not invokevirtual.

  
   down to interpreting "this": it seems that the VM's (with the exception of
   Jikes RVM) interpret "this" to be an instance of class B whereas Feng is
   saying it should be an instance of class C ... I don't think the VM
   interpretation is necessarily wrong.
    

The instruction is invokevirtual. The actual type of this is C.
Following the specification gives A.f().

  
   Cheers,
   Chris