Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D88710FEA for ; Thu, 14 Nov 2013 22:39:49 +0000 (UTC) Received: (qmail 13910 invoked by uid 500); 14 Nov 2013 22:39:49 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 13830 invoked by uid 500); 14 Nov 2013 22:39:48 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 13822 invoked by uid 99); 14 Nov 2013 22:39:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Nov 2013 22:39:48 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paulus.benedictus@gmail.com designates 209.85.128.50 as permitted sender) Received: from [209.85.128.50] (HELO mail-qe0-f50.google.com) (209.85.128.50) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Nov 2013 22:39:41 +0000 Received: by mail-qe0-f50.google.com with SMTP id 1so1771866qee.9 for ; Thu, 14 Nov 2013 14:39:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=VzweWi4qQ6J6Qs+/mkx60lKYWhDXTsp+AVNaQgMkcvA=; b=GnmNHd8wFxvLIq19j6bDVCUHwv9/2igMAGHBft+CMRFlPWOhmwROiMaRSDDXNEiVJ1 AwgDiM+M9Fks4WmTU6/sYyx6V0sYSqEn66k4LKbonFlJeyRXASrfcpw6qDkOSigG1daq 4/kv/rwpRaDsfjWKXdzvun/tQz4ESX7/tB1ERIL1xlcZIC1i2tgQXGjshUy7opbzDkvz 1iYL9iBOisYHKFEGkq59qdj4jRkC+dI7xeOpg/EEIlfklXWjpYNnjyUK/wAf+KqINkWG 61w5VqzpeAtUgSvFSoHVh02bk4rvTfJxRSVe9gk2+IDOTpxKz+LpBVRL+aWx0yYikTNJ t7WA== MIME-Version: 1.0 X-Received: by 10.224.6.197 with SMTP id a5mr3606857qaa.52.1384468760917; Thu, 14 Nov 2013 14:39:20 -0800 (PST) Sender: paulus.benedictus@gmail.com Received: by 10.96.189.70 with HTTP; Thu, 14 Nov 2013 14:39:20 -0800 (PST) In-Reply-To: <5285505A.7060409@gmail.com> References: <5283F3DF.403@gmail.com> <52853B70.4040409@gmail.com> <5285505A.7060409@gmail.com> Date: Thu, 14 Nov 2013 16:39:20 -0600 X-Google-Sender-Auth: mlDm5K-5wPTjbrMKMBGPMlyGpqo Message-ID: Subject: Re: [collections] MultiMap clash with Java 8 From: Paul Benedict To: Commons Developers List Content-Type: multipart/alternative; boundary=001a11c250b6b27cdf04eb2ac083 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c250b6b27cdf04eb2ac083 Content-Type: text/plain; charset=ISO-8859-1 For anyone's observation, I sent this question to the Open JDK list because I am so surprised how adding default methods can break custom interface extensions. I was really hoping default methods would be much more subtle but it turns out this could be a common occurrence going forward. What if JDK 9 introduces new default methods with other clashes to us? I ask rhetorically but I think you can see my point. On Thu, Nov 14, 2013 at 4:36 PM, Phil Steitz wrote: > On 11/14/13 1:06 PM, Thomas Neidhart wrote: > > On 11/14/2013 06:12 AM, Gary Gregory wrote: > >> How about the name removeEntry|Entries since there is a Map.Entry. > > Also possible, but there is a subtle difference imho: > > > > * removeMapping does not assume that such a mapping exists, whereas > > * removeEntry sounds like you remove an entry that you are sure exists > > For MultiMap, shouldn't it also be "removeValue" if we go that way, > since what is being removed (IIUC) is one of the values in the > collection that is the entry? > > > > The method may not succeed, as there is no such mapping currently in the > > map. > > > > But I would be fine with removeEntry too. > > What about the methods for MultiKeyMap? Any comments? > > Your proposal on that looks good to me. I am ambivalent on > removeValue, removeEntry, removeMapping, slightly favoring the last > (your original proposal). > > I agree with your recommendation on return values. > > Phil > > > > Thomas > > > >> Gary > >> > >> > >> On Wed, Nov 13, 2013 at 4:49 PM, Thomas Neidhart > >> wrote: > >> > >>> Hi, > >>> > >>> during the vote for collections 4.0 we have discovered a problem wrt > the > >>> MultiMap interface in general and specifically the MultiKeyMap. > >>> > >>> Java 8 introduces a new default method in the Map interface: > >>> > >>> boolean remove(Object key, Object value) > >>> > >>> This clashes with the method in MultiMap: > >>> > >>> V remove(K key, V value) > >>> > >>> and the remove methods for multiple keys in MultiKeyMap: > >>> > >>> V remove(K key1, K key2) > >>> > >>> > >>> Just changing the return type does not solve the problem, as one can > not > >>> re-define a method in an interface without using the @Override > >>> annotation, but this would only work when compiling with JDK 8 and fail > >>> for other JDKs. > >>> > >>> For the MultiKeyMap it would be semantically wrong too, thus I propose > a > >>> name change. > >>> > >>> For MultiMap: > >>> > >>> boolean removeMapping(K key, V value) > >>> > >>> For MultiKeyMap (for all remove(K ...) methods): > >>> > >>> V removeMultiKey(K key1, K key2) > >>> V removeMultiKey(K key1, K key2, K key3) > >>> ... > >>> > >>> > >>> In the case of the MultiMap, I think returning a boolean makes more > >>> sense, similar as Java 8 does it. > >>> > >>> For the MultiKeyMap, returning the previously mapped value is > preferable > >>> imho. > >>> > >>> Any objections? > >>> > >>> Thomas > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > >>> For additional commands, e-mail: dev-help@commons.apache.org > >>> > >>> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > > For additional commands, e-mail: dev-help@commons.apache.org > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > -- Cheers, Paul --001a11c250b6b27cdf04eb2ac083--