Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-10796

Avoid creation of intermediate StringBuilder in JsopBuilder

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Done
    • None
    • 1.64.0
    • commons
    • None

    Description

      Since invokedynamic was added to Java, this code in the JsopBuilder class:

      StringBuilder buff = new StringBuilder(length + 2);
      return buff.append('\"').append(s).append('\"').toString(); 

      can be written more simply and more efficiently like this:

       return '\"' + s + '\"';
      

      https://www.baeldung.com/java-string-concatenation-invoke-dynamic

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nuno.santos Nuno Santos
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: