🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19481

Re: Inner Classes & this$0

#19481
From: Barry Donovan
Date: Wed, 28 Jan 1998 00:00
70 lines
2912 bytes
Hi Steve,

Steve Sommers wrote:

> According to Barry Boone's Java Certification exam guide the only way
> to
> reference the current instance of the outer class is:
> <i>outerclassname.this</i>.  He doesn't mention <i>this$0</i>
> anywhere.
> This is only one source, naturally, but it seems the method Boone
> mentions
> should work for any environment.
>

Yeah - I've had another closer look at the Inner Classes Specification
and it looks like you're quite
right - this is the convention that should be
followed.............However, I dont think I'm completely wrong
either ;-) - the Borland compiler does not handle Inner Classes
according to the specification found on the
Javasoft web site IMHO.

The actual example that Sun (The FixedStack example) gives also uses the
<i>OuterClass.this</i>
convention
(http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc1.html).

I originally made the mistake and looked at the resultant code that is
generated which showed that the
compiler is supposed to produce a private instance variable called
this$0 which references the
outer class instance
(http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html)
and so this
is what I was using. After looking at the specification more closely I
now believe that I shouldnt use this and
should adopt the method proposed by Boone.

Still, this$0 is quite, correctly IMO, accepted by the JDK & Symantec
Compilers.
And, if you reverse engineer the inner class bytecode produced by the
JBuilder compiler you get a
final instance variable referring to the outerclass instance which is
called <b>this0</b>. This is not what
should be produced according to the Inner Class specification.

Thanks for taking the time to reply to this and make me look at things a
little closer!!

Bazz.



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Barry Donovan
Chief Software Engineer

Nifco Synergy Ltd. http://www.nifcosynergy.com
E-MAIL:            barry@nifcosynergy.com
Phone:             (604) 986-0889 ext. 133
Fax:               (604) 986-0869
ADDRESS:           2030 Marine Drive, Suite 100
                   North Vancouver, B.C. Canada V7P 1V7

Bite my lips and close my eyes - take me away to Paradise.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <34CF6876.ACB4B051@nifcosynergy.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34BC0487.9EBB9687@nifcosynergy.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,af8275ac87b32045
X-Google-Attributes: gidf74b3,public
From: Barry Donovan <barry@nifcosynergy.com>
Subject: Re: Inner Classes & this$0
Date: 1998/01/28
Message-ID: <34CF6876.ACB4B051@nifcosynergy.com>
X-Deja-AN: 320012517
Content-Transfer-Encoding: 7bit
References: <34BC0487.9EBB9687@nifcosynergy.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: None
Newsgroups: borland.public.jbuilder.java.language