Harmony
  1. Harmony
  2. HARMONY-383

java.lang.StringBuilder should implement Appendable

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      java.lang.StringBuilder should implement Appendable, but not implemented in Harmony(project luni).

      1. StringBuffer_Appendable_patch.txt
        0.8 kB
        Nathan Beyer
      2. StringBuilder_Appendable_patch.txt
        0.7 kB
        Nathan Beyer

        Activity

        Paulex Yang created issue -
        Nathan Beyer made changes -
        Field Original Value New Value
        Attachment StringBuilder_Appendable_patch.txt [ 12325701 ]
        Hide
        Nathan Beyer added a comment -

        The patch is fairly trivial; adds Appendable and cleans up comment.

        Show
        Nathan Beyer added a comment - The patch is fairly trivial; adds Appendable and cleans up comment.
        Hide
        Nathan Beyer added a comment -

        Another patch for StringBuffer, which needed this as well.

        Show
        Nathan Beyer added a comment - Another patch for StringBuffer, which needed this as well.
        Nathan Beyer made changes -
        Attachment StringBuffer_Appendable_patch.txt [ 12325702 ]
        Stepan Mishura made changes -
        Assignee Stepan Mishura [ smm ]
        Hide
        Stepan Mishura added a comment -

        Thanks Nathan, Paulex.

        Patch was applied to LUNI module at repo revision 396494.

        Please check that the patch was applied as you expected.

        Note: I found that the spec. for these classes is confusing a little bit, for example for StringBuffer class it says:
        " All Implemented Interfaces: Serializable, Appendable, CharSequence "
        and the spec. adds:
        " public final class StringBuffer extends Object implements Serializable, CharSequence"

        Show
        Stepan Mishura added a comment - Thanks Nathan, Paulex. Patch was applied to LUNI module at repo revision 396494. Please check that the patch was applied as you expected. Note: I found that the spec. for these classes is confusing a little bit, for example for StringBuffer class it says: " All Implemented Interfaces: Serializable, Appendable, CharSequence " and the spec. adds: " public final class StringBuffer extends Object implements Serializable, CharSequence"
        Stepan Mishura made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Nathan Beyer added a comment -

        The patches look good.

        Regarding the spec documentation, I think that might be a bug/quirk of the Javadoc tool. If you look at the 'Serialized Form' of StringBuilder and StringBuffer, you can see it gives away an implementation detail, which is that they both derive from a 'java.lang.AbstractStringBuilder'. My guess is that it's really this AbstractStringBuilder that actually implements Appendable. That's just a guess though.

        Show
        Nathan Beyer added a comment - The patches look good. Regarding the spec documentation, I think that might be a bug/quirk of the Javadoc tool. If you look at the 'Serialized Form' of StringBuilder and StringBuffer, you can see it gives away an implementation detail, which is that they both derive from a 'java.lang.AbstractStringBuilder'. My guess is that it's really this AbstractStringBuilder that actually implements Appendable. That's just a guess though.
        Hide
        Stepan Mishura added a comment -

        Verified by Nathan.

        Show
        Stepan Mishura added a comment - Verified by Nathan.
        Stepan Mishura made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Paulex Yang added a comment -

        Looks good, thank you, Stepan.

        I agree with Nathan that the issue Stepan mentioned dues to JavaDoc's limitation. The following short test shows that StringBuilder does implement Appendable.

        public static void main(String[] args) throws IOException

        { StringBuilder builder = new StringBuilder(); Appendable a = (Appendable)builder; a.append("test"); System.out.println(a.toString()); }
        Show
        Paulex Yang added a comment - Looks good, thank you, Stepan. I agree with Nathan that the issue Stepan mentioned dues to JavaDoc's limitation. The following short test shows that StringBuilder does implement Appendable. public static void main(String[] args) throws IOException { StringBuilder builder = new StringBuilder(); Appendable a = (Appendable)builder; a.append("test"); System.out.println(a.toString()); }

          People

          • Assignee:
            Stepan Mishura
            Reporter:
            Paulex Yang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development