From commits-return-8606-apmail-commons-commits-archive=commons.apache.org@commons.apache.org Tue Sep 15 05:54:50 2009 Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 17045 invoked from network); 15 Sep 2009 05:54:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Sep 2009 05:54:49 -0000 Received: (qmail 96170 invoked by uid 500); 15 Sep 2009 05:54:49 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 96081 invoked by uid 500); 15 Sep 2009 05:54:48 -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 96071 invoked by uid 99); 15 Sep 2009 05:54:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Sep 2009 05:54:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Tue, 15 Sep 2009 05:54:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EBFD323889CF; Tue, 15 Sep 2009 05:54:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r815018 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java Date: Tue, 15 Sep 2009 05:54:08 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090915055408.EBFD323889CF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bayard Date: Tue Sep 15 05:54:08 2009 New Revision: 815018 URL: http://svn.apache.org/viewvc?rev=815018&view=rev Log: Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956. Also see the following revisions: ------------------------------------------------------------------------ r555925 | skestle | 2007-07-13 03:39:24 -0700 (Fri, 13 Jul 2007) | 2 lines Added Edwin Tellman's patch for COLLECTIONS-243. It all seems pretty reasonable, and it should all be checked again as the project is worked through ------------------------------------------------------------------------ r471201 | scolebourne | 2006-11-04 06:17:26 -0800 (Sat, 04 Nov 2006) | 1 line Remove getBag() - use covariant decorated() ------------------------------------------------------------------------ Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java?rev=815018&r1=815017&r2=815018&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java Tue Sep 15 05:54:08 2009 @@ -41,8 +41,8 @@ * * @author Stephen Colebourne */ -public final class UnmodifiableSortedBag - extends AbstractSortedBagDecorator implements Unmodifiable, Serializable { +public final class UnmodifiableSortedBag + extends AbstractSortedBagDecorator implements Unmodifiable, Serializable { /** Serialization version */ private static final long serialVersionUID = -3190437252665717841L; @@ -56,11 +56,11 @@ * @return an unmodifiable SortedBag * @throws IllegalArgumentException if bag is null */ - public static SortedBag decorate(SortedBag bag) { + public static SortedBag decorate(SortedBag bag) { if (bag instanceof Unmodifiable) { return bag; } - return new UnmodifiableSortedBag(bag); + return new UnmodifiableSortedBag(bag); } //----------------------------------------------------------------------- @@ -70,7 +70,7 @@ * @param bag the bag to decorate, must not be null * @throws IllegalArgumentException if bag is null */ - private UnmodifiableSortedBag(SortedBag bag) { + private UnmodifiableSortedBag(SortedBag bag) { super(bag); } @@ -93,21 +93,22 @@ * @throws IOException * @throws ClassNotFoundException */ + @SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); - collection = (Collection) in.readObject(); + collection = (Collection) in.readObject(); } //----------------------------------------------------------------------- - public Iterator iterator() { - return UnmodifiableIterator.decorate(getCollection().iterator()); + public Iterator iterator() { + return UnmodifiableIterator.decorate(decorated().iterator()); } - public boolean add(Object object) { + public boolean add(E object) { throw new UnsupportedOperationException(); } - public boolean addAll(Collection coll) { + public boolean addAll(Collection coll) { throw new UnsupportedOperationException(); } @@ -119,16 +120,16 @@ throw new UnsupportedOperationException(); } - public boolean removeAll(Collection coll) { + public boolean removeAll(Collection coll) { throw new UnsupportedOperationException(); } - public boolean retainAll(Collection coll) { + public boolean retainAll(Collection coll) { throw new UnsupportedOperationException(); } //----------------------------------------------------------------------- - public boolean add(Object object, int count) { + public boolean add(E object, int count) { throw new UnsupportedOperationException(); } @@ -136,8 +137,8 @@ throw new UnsupportedOperationException(); } - public Set uniqueSet() { - Set set = getBag().uniqueSet(); + public Set uniqueSet() { + Set set = decorated().uniqueSet(); return UnmodifiableSet.decorate(set); }