Explain: Use static access with "!unknown!" for "Entry"

Can you please explain the SonarLint message:

        try {
            final Map<MyClass, String> MyMap = ...
            for (Map.Entry<MyClass, String> myValue: MyMap.entrySet()) {

MyClass is a public non-derived class.
Entry in the For loop gives the message:
“Use static access with “!unknown!” for “Entry””.
The hint is to use “!Unknown!” instead of “Map”.

  • Windows 10 20H2
  • IntelliJ Ultimate 2019.3
  • SonarLint plugin version:
1 Like


Are you in connected mode with SonarCloud or SonarQube? And if the latter, which version?