Git Product home page Git Product logo

Comments (6)

jbachorik avatar jbachorik commented on July 24, 2024

[author="jbachorik", created="Mon, 17 May 2010 13:29:18 +0200"]

The intended functionality sounds reasonable.

Anyway, I have few comments for the patch:

1. Consider renaming newStringBuffer() method to newStringBuilder(boolean threadSafe) - giving the API caller the option to create either StringBuilder(thread-unsafe) or StringBuffer (thread-safe)
2. Consider dropping the specialized versions of the "append" method, keeping only the "append(StringBuffer buffer, String strToAppend)" version. The specialized versions can be replaced by calling "append(buffer, str(nonString))" - otherwise you would need to wrap pretty large portion of the "append" methods from the backing StringBuilder/Buffer

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Tue, 18 May 2010 20:32:46 +0200"]

The problem here then, is that both StringBuffer and StringBuilder extends java.lang.Object, and the BTrace Script needs to declare the type of the Builder/Buffer (to avoid having to work with Object).

I guess its possible to do one of two things:

#. Add both a newStringBuffer() and newStringBuilder() methods, and both append(StringBuffer, String) append(StringBuilder, String).
#. Create a BtraceStringBuffer that will either keep one StringBuilder or one StringBuffer.

I'd chose the first option, though, that makes the code slightly cleaner and lighter.

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Thu, 17 Jun 2010 12:40:48 +0200"]

Jaroslav: Are you able to comment on the two proposed solutions ?

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="jbachorik", created="Thu, 24 Jun 2010 08:03:02 +0200"]

newStringBuilder()/newStringBuffer() approach seems to be the correct one

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Tue, 29 Jun 2010 08:04:22 +0200"]

Would it then be OK to move this issue to the 1.2 release and commit the patch for the StringBuffer while at the same time opeing a new issue to implement the newStringBuilder() methods ?

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="jbachorik", created="Fri, 9 Jul 2010 16:21:38 +0200"]

I've adapted your proposed patch to use java.lang.Appendable instead of StringBuffer/StringBuilder, thus having only one set of methods for working with appendable buffers.

Fixed http://kenai.com/projects/btrace/sources/hg/revision/325

from btrace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.