This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: interface dispatch
- To: Godmar Back <gback at cs dot utah dot edu>
- Subject: Re: interface dispatch
- From: Per Bothner <per at bothner dot com>
- Date: 24 Oct 1999 20:13:02 -0700
- Cc: java-discuss at sourceware dot cygnus dot com
- References: <199910242003.OAA24808@faith.cs.utah.edu>
Godmar Back <gback@cs.utah.edu> writes:
> public class I {
> interface A {}
> interface B {
> boolean equals(Object _);
> }
> void f(A x) {
> x.equals(null); // compile this into invokevirtual
> }
> void g(B x) {
> x.equals(null); // compile this into invokeinterface
> }
> }
Techically, you're right, according to the JLS revision. But this is
not very interesting. I can see no way that it matters either way,
except for reflection. Thus when an a method in Object is called, we
can implement it as if it were invokeinterface or invokevirtual; there
is no semantic difference. Since invokevirtual is faster, a compiler
(gcj or jit) should do that.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/