error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

StringSplitter Pattern not Consistently Detected

Open iadcode opened this issue 2 years ago • 1 comments

Expected: Code snippet that uses String.split(String), e.g. "me:you".split(":"), should consistently trigger StringSplitter pattern. Actual: When passed as parameter into certain other methods List.of(T...), Stream.of(T...), Arrays.asList(T...) and Assertions.assertThat(T[]) (from AssertJ), the above snippet does not trigger StringSplitter (please see minimal example project at https://github.com/iadcode/sample-string-splitter).

JDK: 11.0.16.1 (also observed on 17.0.4.1) Maven: 2.8.6 Errorprone Maven Plugin: 2.15.0

Screenshots of Compiling Example Project Test Case 1 - StringSplitter is triggered 189276130-1bd357f7-7648-4c81-abf0-9b814fd02bae

Test Case 2 - StringSplitter not triggered 189276181-02f0a151-b1dc-4fc0-86d6-0386524046fe

iadcode avatar Sep 09 '22 05:09 iadcode

Hi all. Can I ask if we have had any luck with this issue?

Since this issue was raised, we have observed StringSplitter is not being triggered in more cases:

  • When passed in as a parameter to a method (not just a selective number of methods as originally stated in the issue).
  • When being assigned to a field on the class instead of a local variable.

Thank you very much for your time.

raphaelNguyen avatar Jun 19 '23 01:06 raphaelNguyen