Implement a presubmit to ban string concatenation in Java log statements |
||
Issue descriptionorg.chromium.base.Log methods support printf-style formatting, specifically to avoid doing unnecessary string concatentation, but many callsites don't use it and still just concatenate the string at the callsite. Proguard can't eliminate this code, even when inside Log.d() - it doesn't realise that the StringBuilder calls have no useful effect, so we end up building the entire string even for debug logging that's never printed at all. We should maybe have a presubmit script that bans this, as it will reduce binary size a bit. We should probably also ban android.util.Log as this doesn't have the same features and is still used in some cases.
,
Apr 3 2018
The PRESUBMIT check has been added.
,
Apr 3 2018
Would you mind posting the CL link for cross reference? Thanks!
,
Apr 4 2018
From a git blame, looks like the main ones were: aa68d5ec85d3d 87d9fb6e6ca1f 38736db9311bb |
||
►
Sign in to add a comment |
||
Comment 1 by mariakho...@chromium.org
, Feb 9 2018