SBSC_USE_STRINGBUFFER_CONCATENATION no longer reported in Eclipse plug-in since version 4.7.3
p-bucci opened this issue · comments
Since SpotBugs 4.7.3, in Eclipse (all versions since then, including the most current one, 2023-12, using the embedded JRE 17) the detector StringConcatenation
fails to detect bug SBSC_USE_STRINGBUFFER_CONCATENATION
. I am guessing that the fix to issue #2182 broke the SpotBugs Eclipse plug-in because the byte code generated by the Java compiler embedded in Eclipse does not match the new pattern used by SpotBugs to detect this issue.
Up until SpotBugs 4.7.2, the Eclipse SpotBugs plug-in detected and reported the issue on this code:
Scanner in = new Scanner(System.in);
String s = "";
while (in.hasNextLine()) {
s += in.nextLine();
}
SpotBugs 4.8.3 still does not detect the issue.
Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.
In spite of taking my time to investigate the problem over the past year and report the issue only when I thought there was no way it was my fault, it appears that I did not investigate enough. The behavior I have been observing was that if I installed the SpotBugs 4.7.2 plug-in, it would detect the issue, but with any of the more recent plug-ins, it would not. Given what you experience, it occurred to me to try and test the plug-in with a fresh installation of Eclipse IDE for Java Developers and a brand-new workspace. Indeed, the plug-in is working as expected. It seems that the problem is either in my Eclipse installation (which has been upgraded several times) or my workspace (which I have been using for a long time and has also been updated through several new versions of Eclipse). I will have to investigate further, but I guess the issue can/should be closed. Apologies for wasting your time ;-)