Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Inefficient Appendable Append fix for spotbugs/spotbugs#704 #391

Draft
wants to merge 3 commits into
base: spotbugs
Choose a base branch
from

Conversation

manishaghaisas
Copy link

Fixes spotbugs/spotbugs#704
New performance rule for Appendable appending CharSequence

Brief description of the files submitted:-
InefficientAppendableAppend.java new detector to examine following two signatures of Appendable and report if the CharSequence.toString() is passed as first argument.

append(CharSequence csq)
append(CharSequence csq, int start, int end)

IAA_Sample.java contains samples.
mesages.xml and findbugs.xml - Changes are still WIP.

Opening a draft pull request in order to discuss the following -

  1. This detector has some overlap with the InefficientStringBuffering detector. There is duplicate reporting for the following pattern.
StringBuffer sb = new StringBuffer("foo");
 sb.append(sb.toString());
  1. The InefficientStringBuffering detector fails to report an issue for the other method signature append(CharSequence csq, int start, int end)
    Would like to discuss the best approach to address both issues.

@manishaghaisas manishaghaisas changed the title Iaa Draft: Inefficient Appendable Append fix for spotbugs/spotbugs#704 Mar 30, 2020
@manishaghaisas
Copy link
Author

@ThrawnCA @mebigfatguy Any of you free to discuss how best to tackle issue of duplicate reporting by InefficientStringBuffering and new detector InefficientAppendableAppend for the following pattern

StringBuffer sb = new StringBuffer("foo");
sb.append(sb.toString());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New performance rule for Appendable appending CharSequence
1 participant