From commons-dev-return-102620-apmail-jakarta-commons-dev-archive=jakarta.apache.org@jakarta.apache.org Wed Jun 13 07:03:37 2007 Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 74979 invoked from network); 13 Jun 2007 07:03:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2007 07:03:33 -0000 Received: (qmail 25552 invoked by uid 500); 13 Jun 2007 07:03:29 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 25476 invoked by uid 500); 13 Jun 2007 07:03:29 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 25455 invoked by uid 99); 13 Jun 2007 07:03:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2007 00:03:29 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2007 00:03:25 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 59E137141ED for ; Wed, 13 Jun 2007 00:03:01 -0700 (PDT) Message-ID: <33479837.1181718181248.JavaMail.jira@brutus> Date: Wed, 13 Jun 2007 00:03:01 -0700 (PDT) From: "Ben Speakmon (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Commented: (CLI-21) [cli] clone method in Option should use super.clone() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CLI-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504143 ] Ben Speakmon commented on CLI-21: --------------------------------- My comment from the mailing list thread: Implementing clone() properly is a pain and hard to get right. If someone really needs distinct copies of Option classes (why?!), I'd suggest providing a copy constructor instead. If compatibility is a really big deal, you could change clone() to call Object.clone(), which throws an exception. Think of it as a gentle hint to the user not to use the method anymore -- and the exception message could also point out the new copy constructor. > [cli] clone method in Option should use super.clone() > ----------------------------------------------------- > > Key: CLI-21 > URL: https://issues.apache.org/jira/browse/CLI-21 > Project: Commons CLI > Issue Type: Bug > Components: CLI-1.x > Affects Versions: 1.0 > Environment: Operating System: other > Platform: Other > Reporter: Nathan McDonald > Fix For: 1.1 > > > In > org.apache.commons.cli.Option > public method clone is implemented by creating a new instance through one of > the class Constructors, and then assigning values as required through the > setter methods. > This means that any subclasses of the Option class will not return a true > clone, but a new Option instance instead. > A proper implementation of clone should use super.clone() to create a new > instance, rather than calling the class constructor. This allows shallows > clones to propogate correctly down to subclasses. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org