Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: Peter Newsgroups: comp.lang.java.programmer Subject: Re: Assumed final? Date: Tue, 01 Jul 2014 18:54:32 +0800 Organization: Aioe.org NNTP Server Lines: 17 Message-ID: References: NNTP-Posting-Host: EfNlhfDfAo9+0xhze4Avzg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:28881 於 1/7/14上午2:25, markspace 提到: > On 6/30/2014 10:28 AM, Knute Johnson wrote: > >> So it appears that the Java 8 compiler has gotten smarter or I haven't >> been paying enough attention :-). >> > > Gotten smarter, I think. This was added for Java 8 lambdas. So now > instead of having to declare you variables final for anonymous inner > classes/lambdas, the compiler can figure out if it is "effectively > final" (note the text of your error message) and just assume you meant > "final". > > Handy for lambdas because it makes them less verbose in some situations > and a bit more like their aged cousins, closures. nice