[4422] in java-interest

home help back first fref pref prev next nref lref last post

Re: interfaces

daemon@ATHENA.MIT.EDU (Pat Niemeyer)
Fri Dec 22 20:22:09 1995

Date: Fri, 22 Dec 1995 18:12:02 -0600 (CST)
From: Pat Niemeyer <pat@icon-stl.net>
To: Ken Arnold - Sun Labs <arnold@suneast.East.Sun.COM>
cc: java-interest@webrunner.neato.org
In-Reply-To: <9512221540.AA10678@cocolat.East.Sun.COM>


On Fri, 22 Dec 1995, Ken Arnold - Sun Labs wrote:

> If Bar and Groo both have a method foo(), you can implement both only
> if you can provide a definition that is compatible with both.  If the
> number of type of parameters is different, you're set.  If the number
> and types of parameters are polymorphicly assignable, and the return
> types are the same, and the throws clauses can be ordered so that one
> is a subset of the other, you can provide a least-common-denomintor
> implementation.  Otherwise you are screwed in the way you describe.  I
> don't think that anyone is currently very excited about solving this
> problem, amid all the other issues that need to be addressed, but if
> you have a good solution, you should submit it as an RFP so that it can
> be considered.


Does it matter if the parameters are polymorphically assignable?  Are you
saying that Java allows covariant argument matching on the implementation
of methods which occur in multiple interfaces?

The beta2 compiler doesn't seem to do this:

	interface foo {
			void foo( Object o );
	}
	interface bar {
			void foo( String s );
	}
	class thing implements foo, bar {
			public void foo( Object o ) { }
			public void foo( String s ) { }
	}

If I leave out either of the foo() bodies it complains that 'thing' should
be abstract.  Is this going to change, or am I misunderstanding something?
I thought that Java only did covariant argument matching on catch clauses 
and the special stuff related to arrays.  Does it happen elsewhere?

Actually, I see now that it does match throws clauses in the way you say.
Could you clarify all of this?  


Thanks,
Pat


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post