False positive on java:S6073 when using Mockito @Captor

  • Operating system: Windows 11
  • IDE name and flavor/env: Android Studio 2021.3.1
  • SonarQube 8.9.10 LTS
  • SonarLint in connected mode

I have an argument captor like this:

private ArgumentCaptor<MyClass> captor;

then further down:

verify(someObject).foo(anyInt(), captor.capture());

Android Studio/SonarLint thinks I should add an “eq argument matcher” for captor.capture(). This would break the test.

Is this a known issue?


I think this ticket is relevant. Do you agree?:

SONARJAVA-4221 S6073 should support MockitoHamcrest adapter

It was fixed last spring & so is included in the latest versions of SonarQube and SonarLint. You’re on the latest SonarLint version, but in connected mode with the LTS, so I believe you’re getting the older implementation from the LTS.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.