Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
  1. #21
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Tolls View Post
    StringBuffer sb = new StringBuffer();
    sb.append("xx");

    ...
    Yes, that should work if all is fine; starting from Java 1.5 both StringBuilder and StringBuffer (secretly) extend an (package scope) AbstractStringBuilder class. If you are mixing up Java versions and a version 5 StringBuilder (or StringBuffer) class is loaded an AbstractStringBuilder super class needs to be loaded as well. Before version 1.5 there was no abstract class like that and it won't work. That's what all the havoc was about.

    Basically the Javadocs lie: it says that both the Builder and the Buffer class directly extend from the Object class while secretly there's that AbstractStringBuilder class in between the inheritance tree.

    kind regards,

    Jos

  2. #22
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    Which is why I was wondering what odd version they were using...assuming they had compiled under one version and were running under another.

  3. #23
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Tolls View Post
    Which is why I was wondering what odd version they were using...assuming they had compiled under one version and were running under another.
    My guess is that they are using the ordinary mess they have created themselves, the mess that brings joy to us all when we least expect it ;-)

    kind regards,

    Jos

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •