Some lints can be suppressed for a statement. E. g., "division by zero" lint:
//noinspection divzero
int i = 3 / 0;
But some lints can't be suppressed for a statement in the same way. E. g.:
//noinspection UseSparseArrays <-- Has no effect
Map<Integer, String> map = new HashMap<>();
What is the difference between these two lints? Can we suppress lints like "UseSparseArrays" for a statement in some other way? (Don't want to suppress it for the whole method).
What is the difference between these two lints?
After some research, I found an answer:
divzero
is Java compiler lint warning (see divzero
among Xlint options).UseSparseArrays
is Android lint warning (see UseSparseArrays
among Andoid lint warnings) Can we suppress lints like "UseSparseArrays" for a statement in some other way?
According to Android documentation Android lint warnings can be suppressed only for a class or a method with @SuppressLint
.