android.text.TextUtils.isEmpty methods should be hardcoded

Existing rule squid:S2637 cares about

In Android SDK there is similar method [android.text.TextUtils.isEmpty]( which I propose to add and check also

Code example

import android.text.TextUtils;


public void test(String param1) {
    if (TextUtils.isEmpty(param1)) {

    System.out.println(param1.length()); // currently it's false positive, after fix it must not warn

Type: Code Smell

I have tried to report the issue to but no success what is the next step? if someone can point me to right git repo I can prepare PR by my own

Hello Alexander,

I analyzed your reproducer on SonarCloud that is running in the background SonarJava 5.7 and I’m not able to reproduce your FP.

Can you try to do the same so we work together with the same context?



I am experiencing same problem on Android. SonarCloud insists “@NonNull” values should not be set to null". Even tho I check it with “TextUtils.isEmpty(value)”. I’ve also tried creating my own function to duplicate TextUtils, but result is the same

1 Like