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

FP in S2390: do not report an issue on static class nested in the parent.

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.10
    • Component/s: Rules
    • Labels:

      Description

      public class Parent {
      
        private static class Child extends Parent { }
      
        public static final Parent INSTANCE1 = new Child(); // FP
      
      }
      

      The rule reports an issue when a parent class references a member of a subclass during its own initialization. When the Child class is in fact a static class nested in the Parent, this is not always a problem as other elements as to be taken into account (order?, ...).

       

      We should not report an issue when the Child is a static class nested into the parent.

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quentin.jaquier Quentin Jaquier
                Reporter:
                quentin.jaquier Quentin Jaquier
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: