Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 32292 invoked from network); 11 May 2006 04:46:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 May 2006 04:46:19 -0000 Received: (qmail 34651 invoked by uid 500); 11 May 2006 04:38:54 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 34609 invoked by uid 500); 11 May 2006 04:38:53 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 34598 invoked by uid 99); 11 May 2006 04:38:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2006 21:38:53 -0700 X-ASF-Spam-Status: No, hits=0.9 required=10.0 tests=DNS_FROM_RFC_WHOIS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of nbeyer@kc.rr.com designates 24.94.166.122 as permitted sender) Received: from [24.94.166.122] (HELO ms-smtp-02.rdc-kc.rr.com) (24.94.166.122) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2006 21:38:53 -0700 Received: from LITTLEGUY (CPE-24-31-248-236.kc.res.rr.com [24.31.248.236]) by ms-smtp-02.rdc-kc.rr.com (8.13.6/8.13.6) with ESMTP id k4B4cUOP002092 for ; Wed, 10 May 2006 23:38:31 -0500 (CDT) From: "Nathan Beyer" To: Subject: RE: Thanks Stepan! (was: Re: [jira] Resolved: (HARMONY-454) [classlib][luni] java.util.Set generics uplift and related changes) Date: Wed, 10 May 2006 23:38:34 -0500 Message-ID: <002601c674b4$c40d0240$0e01a8c0@LITTLEGUY> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-reply-to: <4461D57E.4070207@gmail.com> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-index: AcZ0LsWmfHR18FPMQhqeqPQWvOCz/AAhH6VA X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Does someone understand why this works this way? This seems so odd. I know there are quirks to the generics syntax, but this in an edge I haven't run into yet. I haven't been able to make this one click in my head yet. This compiles fine: public synchronized void putAll(Map map) { for (Map.Entry entry : map.entrySet()) { ... } } This won't compile at all: public synchronized void putAll(Map map) { Set> entries = map.entrySet(); ... } The error is: Type mismatch: cannot convert from Set> to Set> The suggested quick fix in Eclipse is "Set entries = ...". This reports a warning: public synchronized void putAll(Map map) { Map map2 = (Map)map; } The warning is: Type safety: The cast from Map to Map is actually checking against the erased type Map The suggested quick fix in Eclipse is to the annotation: @SuppressWarnings("unchecked"). -Nathan > -----Original Message----- > From: Tim Ellison [mailto:t.p.ellison@gmail.com] > Sent: Wednesday, May 10, 2006 6:59 AM > To: harmony-dev@incubator.apache.org > Subject: Thanks Stepan! (was: Re: [jira] Resolved: (HARMONY-454) > [classlib][luni] java.util.Set generics uplift and related changes) > > Stepan Mishura (JIRA) wrote: > > > 2) To avoid casting while-loop was replaced with for-loop. Could you > review the change? > > I was scratching my head about this cast, so I was very pleased to see > your elegant solution. > > I must admit that I don't really understand why the for-loop version is > inherently different (other than it 'hides' the casting) -- but I've > learned a new pattern there :-) > > Regards, > Tim > > -- > > Tim Ellison (t.p.ellison@gmail.com) > IBM Java technology centre, UK. > > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > For additional commands, e-mail: harmony-dev-help@incubator.apache.org --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org