False positive for "Static base class members should not be accessed via derived types" when member is declared in protected interface

Language: Java

Example:

ContactsContract {
   protected interface RawContactsColumns {
      public static final String CONTACT_ID = "contact_id";
   }

   public static final class Phone implements RawContactsColumns {
      ...
   }
}

Expected:
Using the member as ContactsContract.Phone.CONTACT_ID yields no warning.

Actual:
Warning to use ContactsContract$RawContactsColumns instead, even though it cannot be accessed from that package.

Hey there! Some important information is missing from your post:

  • SonarQube version (or SonarCloud?)
  • SonarJava version (relevant for SonarQube)
  • The ID of the rule where the issue is being trigerred (java:1234 or squid:1234, etc.)
  • Java version of your source code