Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3339

Reconsider S3027 scope: String.indexOf performance

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.4
    • Component/s: Rules
    • Labels:

      Description

      S3027 is claiming that String.indexOf(char) performs better than String.indexOf(String), while it seems a common agreement, there is no strong evidence and it seems to be dependent on the java version (and potentially other reason).

      The worst part is that with java version >= 11, it seems to be the opposite, changing the code as advised will actually perform worse.

       

      We should reconsider the scope of the rule by:

      • Removing it from Sonar-Way
      • Deprecate the rule.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              johann.beleites Johann Beleites
              Reporter:
              quentin.jaquier Quentin Jaquier
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: