Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 16D23DB18 for ; Tue, 31 Jul 2012 18:24:36 +0000 (UTC) Received: (qmail 77115 invoked by uid 500); 31 Jul 2012 18:24:35 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 77021 invoked by uid 500); 31 Jul 2012 18:24:35 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 77001 invoked by uid 99); 31 Jul 2012 18:24:35 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2012 18:24:35 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 35DC4142851 for ; Tue, 31 Jul 2012 18:24:35 +0000 (UTC) Date: Tue, 31 Jul 2012 18:24:35 +0000 (UTC) From: "Thomas Neidhart (JIRA)" To: issues@commons.apache.org Message-ID: <1447285257.122727.1343759075225.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Resolved] (COLLECTIONS-231) Not return the base interface on decorate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COLLECTIONS-231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Neidhart resolved COLLECTIONS-231. ----------------------------------------- Resolution: Fixed Change done with the exception of Unmodifiable decorators. > Not return the base interface on decorate > ----------------------------------------- > > Key: COLLECTIONS-231 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-231 > Project: Commons Collections > Issue Type: Improvement > Components: Map > Affects Versions: 3.2 > Reporter: Torsten Curdt > Fix For: 4.0 > > > At the moment I don't see a reason why the static "decorate" method does not return ListOrderedMap but just the base interface OrderedMap. > I want to decorate a Map to be a ListOrderedMap but due to the fact that the constructor is not visible and decorate only returns the base interface OrderedMap an unnecessary cast is required. > ListOrderedMap map = (ListOrderedMap)ListOrderedMap.decorate(new MyMap()); > As the decorate method is static and not part of any interface it should be fine to return the real type instead of the base. Otherwise I'd suggest to make the constructor visible. From the API POV It is not really understandable why this > ListOrderedMap map = new ListOrderedMap(); > is fine and creates a HashMap under the hood while this > ListOrderedMap map = new ListOrderedMap(new MyMap())); > is not ok. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira