Without seeing your code, I couldn’t tell you how to solve the issue!
But in any case, this is a controversial rule that is not in the default Quality Profile for Java (at least, it hasn’t been since 2015). If it makes sense for your projects, great. If not, you should remove it.