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 9B271EB17 for ; Wed, 30 Jan 2013 18:46:03 +0000 (UTC) Received: (qmail 30476 invoked by uid 500); 30 Jan 2013 18:46:03 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 30370 invoked by uid 500); 30 Jan 2013 18:46:03 -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 30362 invoked by uid 99); 30 Jan 2013 18:46:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 18:46:03 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 74.125.82.46 as permitted sender) Received: from [74.125.82.46] (HELO mail-wg0-f46.google.com) (74.125.82.46) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 18:45:57 +0000 Received: by mail-wg0-f46.google.com with SMTP id fg15so1404356wgb.1 for ; Wed, 30 Jan 2013 10:45:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=UVu6JugufgrtWjsZQx/OYKnnkh47m5BVTpupe9T6dhA=; b=inpNEeIQtprJwb4ghFW9OEVEe7e7AaZxf87moJAAoj9bd7HAPWl7RxllHZw2mo1RAF LG+bLvfFB1wq9Q+/186bpMSeMR+d8VMdM+acPL9NVMnS7lXJDr7i2D34TSacu8Pc5Qk2 h9AArKrvKTjuzSATUuaZ3MuZEMKfdn6xTh3i1e69RYeYEqaXYNpmGXRNuehnlusKd9+J RmMxgSjc3NGkqcpHVba4djjTVkuGSrCLXOR5jV0D5zxCsoi+SNOkRU2FceHPOrCjNIHI o8Sa028iBr1sJhWkd66tnS0XSZJcXz+59NU68e/nc3u9Q82OASsaTSos2KYS162HaFxw qQFA== MIME-Version: 1.0 X-Received: by 10.180.24.9 with SMTP id q9mr10752734wif.14.1359571535936; Wed, 30 Jan 2013 10:45:35 -0800 (PST) Received: by 10.194.234.164 with HTTP; Wed, 30 Jan 2013 10:45:35 -0800 (PST) In-Reply-To: References: <20130130170551.BF19323888E7@eris.apache.org> Date: Wed, 30 Jan 2013 18:45:35 +0000 Message-ID: Subject: Re: svn commit: r1440524 - /commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java From: sebb To: Commons Developers List , joerg.schaible@gmx.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On 30 January 2013 18:18, J=F6rg Schaible wrote: > Hi, > > sebb wrote: > > [snip] > >>>> /** a map of the required options */ >>>> + // N.B. This can contain either a String (addOption) or an >>>> OptionGroup (addOptionGroup) >>>> + // TODO this seems wrong >>>> private List requiredOpts =3D new ArrayList(); >>>> >>> >>> Indeed, I also spotted this and failed to resolve it, as the logic in t= he >>> parsers is somehow taken advantage of it in a way I do not yet fully >>> understand. >> >> Me neither. >> >> Maybe the code would still work if the entries were always OptionGroups. >> This could perhaps be done by converting the Option into a >> single-entry OptionGroup and storing that, rather than storing the >> Option key String. >> In theory that might work ... > > Or create a package local marker interface OptionEntry and let both class= es > implement it. Not possible, because String is final. One might try to store the Option instead of its key (String). However, the key is used to avoid duplicate entries - addOption() removes any entry with a matching key. This would be difficult to do with Option entries. Option instances with equal keys are not necessarily equal, though the reverse is true. Also Option instances are not immutable (in fact the key is not even immutable - longOpt can be changed after instantiation). All a bit messsy. > - J=F6rg > > > > --------------------------------------------------------------------- > 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