GitHub user FSchumacher opened a pull request:

    https://github.com/apache/jmeter/pull/403

    Use simpler code for "static" String concatenation

    ## Description
    Simplify code for String concatenation
    
    ## Motivation and Context
    <!--- Why is this change required? What problem does it solve? -->
    <!--- If it fixes an open issue, please link to the issue here. -->
    Java is smart enough to compile simple string concatenation `"something" + 
x` to
    the same code as `new StringBuilder("something").append(x).toString()`.
    The latter is really hard to read, so use the simpler one.
    
    While at it, use string formats for the logger (as it is some sort of string
    concatenation, too). And since we use the string formatter, we don't have
    to guard the log level anymore for the simple case.
    
    
    ## How Has This Been Tested?
    <!--- Please describe in detail how you tested your changes. -->
    <!--- Include details of your testing environment, tests ran to see how -->
    <!--- your change affects other areas of the code, etc. -->
    
    ## Screenshots (if appropriate):
    
    ## Types of changes
    <!--- What types of changes does your code introduce? Delete as appropriate 
-->
    - code simplification, no functional change
    
    ## Checklist:
    <!--- Go over all the following points, and put an `x` in all the boxes 
that apply. -->
    <!--- If you're unsure about any of these, don't hesitate to ask. We're 
here to help! -->
    - [x] My code follows the [code style][style-guide] of this project.
    
    [style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/FSchumacher/jmeter 
simple-string-instead-stringbuilder

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jmeter/pull/403.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #403
    
----
commit 79890d4312a6797a96624498545e02c1c35f98c1
Author: Felix Schumacher <felix.schumacher@...>
Date:   2018-10-10T19:43:01Z

    Use simpler code for "static" String concatenation
    
    Java is smart enough to compile simple string concatenation to
    the same code as `new StringBuilder("something").append("other 
thing").toString()`.
    The latter is really hard to read, so use the simpler one.
    
    While at it, use string formats for the logger (as it is some sort of string
    concatenation, too). And since we use the string formatter, we don't have
    to guard the log level anymore for the simple case.

----


---

Reply via email to