How to enforce static imports for some methods using checkstyle?
For example
I want the following method to be used only from static import:
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
So code like this shouldn't be allowed:
if (Objects.nonNull(varName)) {
Any ideas how to achieve that with (preferably) standard or non standard tools?
You could forbid the String that imports Objects: