Bug 25769 - AbstractCollection.toString differers a bit.
Summary: AbstractCollection.toString differers a bit.
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.19
: P3 normal
Target Milestone: 0.90
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-12 18:04 UTC by Artemus Harper
Modified: 2006-02-02 13:29 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Artemus Harper 2006-01-12 18:04:32 UTC
I know I'm being a bit assine on these issues, but...

Despite Sun's documentation of toString on AbstractCollection, it handles the case where an element of the collection is in fact itsself.

E.g. the following code:
import java.util.*;
public class Test
{
   public static void main(String[] args)
   {
      ArrayList list = new ArrayList();
      list.add(list);
      System.out.println(list);
      ArrayList list2 = new ArrayList();
      list2.add(list);
      list.add(list2);
      System.out.println(list);
   }
}
produces on sun:
[(this Collection)]
<<Stack Overflow error>>

and (what should) on IKVM:
<<Stack Overflow error>>

(what IKVM actually produces is fatal stack overflow error).
Comment 1 Mark Wielaard 2006-02-02 13:29:09 UTC
Mauve test added and fix checked in.
Comment 2 cvs-commit@developer.classpath.org 2006-02-02 14:40:35 UTC
Subject: Bug 25769

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Branch: 	
Changes by:	Mark Wielaard <mark@savannah.gnu.org>	06/02/02 13:29:01

Modified files:
	.              : ChangeLog 
	java/util      : AbstractCollection.java 

Log message:
	Fixes bug #25769 reported by Artemus Harper <subanark@gmail.com>
	* java/util/AbstractCollection.java (toString): Only use Iterator,
	check whether collection contains itself.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6250&tr2=1.6251&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/util/AbstractCollection.java.diff?tr1=1.17&tr2=1.18&r1=text&r2=text



Comment 3 Mark Wielaard 2006-02-06 19:18:40 UTC
Subject: Bug 25769

Author: mark
Date: Mon Feb  6 19:18:36 2006
New Revision: 110662

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110662
Log:
       Backports from 0.21.

       2006-01-26  Mark Wielaard  <mark@klomp.org>

       Fixes bug #25970 reported by Michael Kay <mike@saxonica.com>
       * java/math/BigDecimal.java (compareTo): Don't strip trailing zeros.
       Add trailing zeros to the fraction of the decimal with the smallest
       scale.

       2006-02-02  Mark Wielaard  <mark@klomp.org>

       Fixes bug #25769 reported by Artemus Harper <subanark@gmail.com>
       * java/util/AbstractCollection.java (toString): Only use Iterator,
       check whether collection contains itself.

Modified:
    branches/gcc-4_1-branch/libjava/classpath/ChangeLog.gcj
    branches/gcc-4_1-branch/libjava/classpath/java/math/BigDecimal.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/AbstractCollection.java