'This' type (original) (raw)

Neal Gafter neal at gafter.com
Tue Mar 3 12:55:04 PST 2009


Not seeing a problem is not the same thing as demonstrating that no problem can occur. One set of problems arise when you use "This" in a superclass type argument, as you did in an example. I simply don't know what subtype relationships that creates.

interface A extends Collection {}

After this, is A a subtype of Collection?

On Tue, Mar 3, 2009 at 12:40 PM, Marek Kozieł <develop4lasu at gmail.com> wrote:

If we think about it onlt as extension for return types it's quite easy.

interface IA{ This method(); } interface IB extends IA { } now: static void some(IB x){ __ x.method() : return type is IB as This for IB;_ __ ((IA)x).method() : return type is visible as IA as This for IA;_ } If u have some doubts, just mail the sample (I do not see any reason for valid code to make ClassCastExceptions to appear). -- Pozdrowionka. / Regards. Lasu aka Marek Kozieł http://lasu2string.blogspot.com/



More information about the coin-dev mailing list