Removing the extra constructor calls will avoid heap allocations while behaving just the same as the original code.
Findbugs bug fixes
The patch addresses the obvious cases, i.e. all cases in non-test code, and tests where the string copy is immediately discarded, or where string identity is not likely to be of concern.
I left a few cases that looked like they might be implicitly testing non-interned strings.
Note that the removed comment in SolrDefaultHighlighter no longer holds (at least in OpenJDK and Oracle Java); see http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-May/010257.html for details.
Looks good to me.
It looks good to me too. I'll merge it.
Commit 390ef9af9fa081c90370f69b001cf7ec83c8f1bb in lucene-solr's branch refs/heads/master from Adrien Grand
[ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=390ef9a ]
LUCENE-7743: Avoid calling new String(String).
Commit 03e50781463827a5d8188fccf0307f72dea4e450 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand
[ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=03e5078 ]