1

For some lint checks I can suppress them with a comment or a method annotation. ConstantConditions is a good example:

Android Studio screenshot showing multiple suppress options

However for other checks I can only suppress via a method annotation. CheckResult is an example.

Android Studio screenshot showing only one option

Is there any reason for this difference? Is it just that Android tools team hasn't added a comment-based suppression check?

tir38
  • 9,810
  • 10
  • 64
  • 107

1 Answers1

1

Basically, Android Studio comes with a two sets of inspections:

  1. inspections from Intellij IDEA
  2. inspections from Android Lint

So, ConstantConditions is an Intellij IDEA inspection, and CheckResult is coming from Android Lint.

I think the reason that Android Lint checks usually disabled with @SuppressLint annotation is just that it's technically easier to understand that check is suppressed or not for a particular source code element.

Actually, you can suppress a check will comment like this:

//noinspection CheckResult

But it only works when running lint from the command line, but not in Android Studio.

italankin
  • 779
  • 8
  • 14