classpath
[Top][All Lists]
Advanced

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

Re: Eclipse 3.0


From: Robert Lougher
Subject: Re: Eclipse 3.0
Date: Tue, 6 Jul 2004 14:44:39 +0100

On Tue, 6 Jul 2004 15:06:16 +0200, Jeroen Frijters <address@hidden> wrote:
> Eric Blake wrote:
> > Robert Lougher wrote:
> > > OK, I'm yelling :)  Please don't use Mark's patch!
> > >
> > > It "fixes" it by stopping resolution finding the method on Object.
> > > However, it is legal to have an invokeinterface on an Object method
> > > (as all interfaces subclass Object).
> > >
> > > Instead, please use the attached patch to the interpreter.  This
> > > converts an invokeinterface on an Object method into an
> > invokevirtual
> > > (which is what 1.4 javac does anyway, but not jikes or 1.3 javac).
> > 
> > The JVMS is clear that invokeinterface is only to be used on
> > interface methods.
> 
> I think you two are talking about two different things. I think Robert
> means that it is legal to use invokeinterface on an Object method
> through an interface type. So this is legal:
> 
>  invokeinterface java/lang/Runnable/toString()Ljava/lang/String;
> 
> Regards,
> Jeroen
> 

Interfaces subclass Object so they inherit all its methods.  This
means you can use invokeinterface on a method which isn't specified in
an interface -- 5.4.3.4 of the JVMS states:

Otherwise, if the referenced method does not have the same name and
descriptor as a method in C or in one of the superinterfaces of C, or
in class Object, interface method resolution throws a
NoSuchMethodError.

Rob.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]