bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/34840] New: Mismatch between Sun's Appendable and classpa


From: zwartgat at mac dot com
Subject: [Bug classpath/34840] New: Mismatch between Sun's Appendable and classpath's Appendable
Date: 17 Jan 2008 22:50:58 -0000

The Sun documentation
(<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Appendable.html#append(java.lang.CharSequence,%20int,%20int)>)states:

Appendable append(CharSequence csq,
                  int start,
                  int end)
                  throws IOException
[...]
Parameters:
csq - The character sequence from which a subsequence will be appended. If csq
is null, then characters will be appended as if csq contained the four
characters "null".

So, the following:
    StringBuilder sb = new StringBuilder();
    sb.append("He");
    sb.append(null,2,4);
    sb.append("o, wor");
    sb.append(null,2,3);
    sb.append("d!");
    System.out.println(sb.toString());

should print "Hello, world!". As far as I can tell, the SUN implementation
matches this (I checked both the source and JVM 6.03 on Windows for
StringBuilder, StringBuffer, and StringWriter)

The GNU classpath documentation for Appendable says:

public Appendable append(CharSequence seq,
                         int start,
                         int end)
            throws IOException
[...]
Parameters:
seq - the character sequence to append. If seq is null, then the string "null"
(the string representation of null) is appended.

That makes more sense, but it is not what SUN's spec and implementation do.


-- 
           Summary: Mismatch between Sun's Appendable and classpath's
                    Appendable
           Product: classpath
           Version: 0.96.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zwartgat at mac dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34840





reply via email to

[Prev in Thread] Current Thread [Next in Thread]