Refinement of EfficientStringsChecker.

It's okay if callers try mixing "static final" values into strings,
since the compiler will inline these to avoid the StringBuilder.

We also expand to catch any arguments that might be dynamically
calculated, such as method invocations.

Identify additional inefficient code patterns:

-- Passing dynamic strings into a StringBuilder, which acquires a
transparent StringBuilder for each append.
-- Using "str += val;" style concatenation, which acquires a
transparent StringBuilder for each append.
-- Using StringBuffer which has synchronization overhead.

Bug: 170978902
Test: atest error_prone_android_framework_test
Change-Id: Ia3758dd55a0e6753b0cc5bc83ae8fe45b6bfde1f
2 files changed