Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 48E50DA3B for ; Mon, 21 Jan 2013 01:09:19 +0000 (UTC) Received: (qmail 25970 invoked by uid 500); 21 Jan 2013 01:09:18 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 25920 invoked by uid 500); 21 Jan 2013 01:09:18 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 25913 invoked by uid 99); 21 Jan 2013 01:09:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jan 2013 01:09:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jan 2013 01:09:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9B2812388980; Mon, 21 Jan 2013 01:08:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1436044 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java Date: Mon, 21 Jan 2013 01:08:58 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130121010858.9B2812388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Mon Jan 21 01:08:58 2013 New Revision: 1436044 URL: http://svn.apache.org/viewvc?rev=1436044&view=rev Log: Javadoc Remove unsafe @SuppressWarnings Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java?rev=1436044&r1=1436043&r2=1436044&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java Mon Jan 21 01:08:58 2013 @@ -447,15 +447,17 @@ public abstract class AbstractMapBag /** * Returns an array of all of this bag's elements. + * If the input array has more elements than are in the bag, + * trailing elements will be set to null. * * @param the type of the array elements * @param array the array to populate * @return an array of all of this bag's elements */ - @SuppressWarnings("unchecked") public T[] toArray(T[] array) { final int size = size(); if (array.length < size) { + // This is safe, both are type T array = (T[]) Array.newInstance(array.getClass().getComponentType(), size); } @@ -464,6 +466,7 @@ public abstract class AbstractMapBag while (it.hasNext()) { final E current = it.next(); for (int index = getCount(current); index > 0; index--) { + // TODO this is unsafe array[i++] = (T) current; } }