Article View: borland.public.jbuilder.java.language
Article #7520Re: changing reference in a method
From: Joi Ellis [TeamB]
Date: Mon, 18 Jun 2001 19:35
Date: Mon, 18 Jun 2001 19:35
25 lines
1841 bytes
1841 bytes
Yonatan Taub <yonatanta@bashan.co.il> wrote:
> Sorry, I've got that sentence composed all wrong.
> What I meant is that you can specify an argument as final like:
> public void foo(final Object o) {}
> Since you can't assign the reference to another object anyway, what's the
> point of declaring an argument as final?
Well, I don't know the spec well enough to explain it, but I do know
that the inner classes I write often refuse to compile until I set the
arguments on the inner class methods as final. I believe it tells the
compiler that 'yes, I know I am not allowed to muck with these values' and
it is able to leave them on the stack unstead of allocating local copies
of the stuff. (or maybe it just refers to the original object, I dunno...)
It's all still magic, to me...
--
Joi Ellis (TeamB) http://www.teamb.com/
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<3b2e57e9_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!130.133.1.3!fu-berlin.de!news.boerde.de!dnews!not-for-mailReferences:
<3b2ccfc1_1@dnews> <3b2cd6b8_2@dnews> <3b2cde4d$1_2@dnews> <3b2d0dfa_2@dnews> <3b2e2da2_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,de239f43bd446264
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-18 12:41:20 PST
Message-ID: <3b2e57e9_2@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: changing reference in a method
Newsgroups: borland.public.jbuilder.java.language
References: <3b2ccfc1_1@dnews> <3b2cd6b8_2@dnews> <3b2cde4d$1_2@dnews> <3b2d0dfa_2@dnews> <3b2e2da2_1@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 18 Jun 2001 12:35:05 -0700
X-Trace: dnews 992892905 209.46.41.66 (18 Jun 2001 12:35:05 -0700)
Lines: 25
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!130.133.1.3!fu-berlin.de!news.boerde.de!dnews!not-for-mail