Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-1291

Semantic : Accessibility should be check from callsite, not owner

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.5
    • Fix Version/s: 3.6
    • Component/s: Semantic
    • Labels:
      None

      Description

      When checking accessiblity of a symbol found during resolution, it should be checked from the call site and not from the owner type.

      currently, such cases won't resolve methods properly :

      package p1;
      public class A extends B {}
      class B {
      public int foo(){};
      }
      
      package p2;
      class C  {
        void fun(A a) {
           a.foo(); // Method not resolved if accessibility checked from owner as classes are not in the same package
        }
      }
      

        Attachments

          Activity

            People

            Assignee:
            nicolas.peru Nicolas Peru
            Reporter:
            nicolas.peru Nicolas Peru
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: