Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: Rules
    • Labels:
      None

      Description

      Checks for:

      • Duplication throws (i.e. declare twice the same exception)
      • Declare a throw that is RuntimeException or a subclass of it (no need to declare them)
      • Declare a throw that is a subclass of another declared throw (there is no need to declare the sub one)

        Issue Links

          Activity

          Hide
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment -

          Wow this is finally done, don't reopen please!

          Show
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment - Wow this is finally done, don't reopen please!
          Hide
          fabemn OLD - Fabrice Bellingard added a comment - - edited

          Great Dinesh, that works very well!

          Some minor feedback though

          • I updated the RSPEC for the description of the rule:
            • It is listed multiple times
            • It is a subclass of another listed exception (<= remove the 's')
          • Also, in the message:
            • would it be possible to replace the '/' by '.' in the class name?
            • could you replace "which is a subclass of another one." by "which is a subclass of another declared exception."
          • it's best to use "ul" in place of "ol" in this description
          Show
          fabemn OLD - Fabrice Bellingard added a comment - - edited Great Dinesh, that works very well! Some minor feedback though I updated the RSPEC for the description of the rule: It is listed multiple times It is a subclass of another listed exception (<= remove the 's') Also, in the message: would it be possible to replace the '/' by '.' in the class name? could you replace "which is a subclass of another one." by "which is a subclass of another declared exception." it's best to use "ul" in place of "ol" in this description
          Hide
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment -

          Done

          Show
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment - Done
          Hide
          fabemn OLD - Fabrice Bellingard added a comment - - edited

          Actually, when analysing SonarQube, I get lots of false positives, like on "org.sonar.api.resources.InputFile" (of sonar-plugin-api).

          What's more, when a method has an annotation, the issue is on the line of the annotation whereas it would be best to have it on the line where the exception is declared.

          Show
          fabemn OLD - Fabrice Bellingard added a comment - - edited Actually, when analysing SonarQube, I get lots of false positives, like on "org.sonar.api.resources.InputFile" (of sonar-plugin-api). What's more, when a method has an annotation, the issue is on the line of the annotation whereas it would be best to have it on the line where the exception is declared.
          Hide
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment -

          Well spotted again!

          As discussed, that issue was not possible to reproduce on a single file level (i.e. the problem cannot be reproduced on InputFile alone, it only shows up when Sonar is analyzed).

          The root cause was in how the bytecode, in particular outgoing method edges, where loaded: If a method was reloaded with more details, all edges were duplicated.

          It now should be fixed.

          Show
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment - Well spotted again! As discussed, that issue was not possible to reproduce on a single file level (i.e. the problem cannot be reproduced on InputFile alone, it only shows up when Sonar is analyzed). The root cause was in how the bytecode, in particular outgoing method edges, where loaded: If a method was reloaded with more details, all edges were duplicated. It now should be fixed.
          Hide
          fabemn OLD - Fabrice Bellingard added a comment -

          Tested!

          Just a typo in one of the messages: "listed more then one time." => "listed more than once."

          Show
          fabemn OLD - Fabrice Bellingard added a comment - Tested! Just a typo in one of the messages: "listed more then one time." => "listed more than once ."
          Hide
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment -

          I was unable to find this message, perhaps the typo was in a Checkstyle/PMD rule.

          Show
          dinesh.bolkensteyn Dinesh Bolkensteyn added a comment - I was unable to find this message, perhaps the typo was in a Checkstyle/PMD rule.

            People

            • Assignee:
              dinesh.bolkensteyn Dinesh Bolkensteyn
              Reporter:
              dinesh.bolkensteyn Dinesh Bolkensteyn
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: