Opened 5 years ago

Closed 5 years ago

#17830 closed defect (fixed)

use StringBuilder correctly

Reported by: iwakeh Owned by: karsten
Priority: Medium Milestone:
Component: Metrics/Library Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: #17822 Points:
Reviewer: Sponsor:

Description

This is not java 7 related, but should be included here:

Code like this

 crypto = new StringBuilder();
 crypto.append(line + "\n");

defeats the purpose of using StringBuilder, because String concatenation using + will internally be accomplished by using another StringBuilder (see Javadoc).

This should also be added to the coding guidelines (or did we write these for Onionoo only?).

Child Tickets

Change History (4)

comment:1 Changed 5 years ago by karsten

Status: newaccepted

Sure, sound like a good change. (See #17823 for the discussion when to make these changes.)

Regarding coding guidelines, it's quite possible that we wrote these for Onionoo only. We should add this guideline to metrics-lib's CONTRIB.md in any case.

comment:2 Changed 5 years ago by karsten

Status: acceptedneeds_review

comment:3 Changed 5 years ago by iwakeh

this revision looks fine, see #17824 for more.

comment:4 Changed 5 years ago by karsten

Resolution: fixed
Status: needs_reviewclosed

Great. Merged to master. Thanks! Resolving.

Note: See TracTickets for help on using tickets.