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 59594114A1 for ; Thu, 24 Apr 2014 12:15:22 +0000 (UTC) Received: (qmail 44206 invoked by uid 500); 24 Apr 2014 12:15:19 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 44133 invoked by uid 500); 24 Apr 2014 12:15:19 -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 44122 invoked by uid 99); 24 Apr 2014 12:15:18 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2014 12:15:18 +0000 Date: Thu, 24 Apr 2014 12:15:18 +0000 (UTC) From: "Emmanuel Bourg (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (BCEL-20) InstructionList.copy() fails with Select instruction. 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/BCEL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Emmanuel Bourg updated BCEL-20: ------------------------------- Priority: Major Environment: (was: Operating System: Linux Platform: All) Fix Version/s: 5.2 Priority: (was: P3) Severity: (was: normal) > InstructionList.copy() fails with Select instruction. > ----------------------------------------------------- > > Key: BCEL-20 > URL: https://issues.apache.org/jira/browse/BCEL-20 > Project: Commons BCEL > Issue Type: Bug > Components: Main > Affects Versions: 5.0 > Reporter: wombat > Assignee: Apache Commons Developers > Fix For: 5.2 > > > The implementation of InstructionList.copy() works on the internal targets > fields of the select instructions: > (InstructionList.java line 1110) > InstructionHandle[] itargets = ((Select)bi).getTargets(); > InstructionHandle[] ctargets = ((Select)bc).getTargets(); > But because bc is created from bi by cloning bi, both refer to the same target > array. > Changing ctargets also changes itargets. > The reason for this is, that Select does not override clone. > The following patch fixes this problem: > Index: Select.java > =================================================================== > RCS file: > /home/cvspublic/jakarta-bcel/src/java/org/apache/bcel/generic/Select.java,v > retrieving revision 1.2 > diff -u -r1.2 Select.java > --- Select.java 26 Apr 2002 09:30:11 -0000 1.2 > +++ Select.java 5 Apr 2003 13:37:54 -0000 > @@ -227,6 +227,16 @@ > return false; > } > + protected Object clone() throws CloneNotSupportedException { > + Select result = (Select) super.clone(); > + > + result.match = (int[]) result.match.clone(); > + result.indices = (int[]) result.indices.clone(); > + result.targets = (InstructionHandle[]) result.targets.clone(); > + > + return result; > + } > + > /** > * Inform targets that they're not targeted anymore. > */ -- This message was sent by Atlassian JIRA (v6.2#6252)