SonarQube Java
  1. SonarQube Java
  2. SONARJAVA-135

The rule "Unused private method" generates some false-positives in case of method overloading

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Component/s: Squid
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In following case, a violation is unexpectedly reported:

      class SonarFailure {
      
         SonarFailure(float junk, String someString, String... values) {
            problem(junk, someString, values);
         }
      
         private void problem(float junk, String someString, String... values) {
            System.out.println(junk);
            // the method below is invoked here
            problem(someString, values);
         }
      
         /* This is called by the method above but Sonar marks it as unused */
         private void problem(String csvString, String... values) {
            System.out.println(csvString + values);
         }
      }
      

        Activity

        Hide
        Evgeny Mandrikov added a comment -

        This is a bug in PMD rule pmd:UnusedPrivateMethod, which is now marked as deprecated in favor of squid:UnusedPrivateMethod.

        Show
        Evgeny Mandrikov added a comment - This is a bug in PMD rule pmd:UnusedPrivateMethod, which is now marked as deprecated in favor of squid:UnusedPrivateMethod.
        Hide
        Fabrice Bellingard added a comment - - edited

        Can you also remove it from the default profiles and replace it by the Squid rule?

        Show
        Fabrice Bellingard added a comment - - edited Can you also remove it from the default profiles and replace it by the Squid rule?
        Hide
        Evgeny Mandrikov added a comment -

        Done.

        Show
        Evgeny Mandrikov added a comment - Done.
        Hide
        Fabrice Bellingard added a comment -

        Checked.

        Show
        Fabrice Bellingard added a comment - Checked.

          People

          • Assignee:
            Evgeny Mandrikov
            Reporter:
            Freddy Mallet
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: