Details

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

      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)

        Activity

        Hide
        Dinesh Bolkensteyn added a comment -

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

        Show
        Dinesh Bolkensteyn added a comment - Wow this is finally done, don't reopen please!
        Hide
        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
        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 added a comment -

        Done

        Show
        Dinesh Bolkensteyn added a comment - Done
        Hide
        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
        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 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 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
        Fabrice Bellingard added a comment -

        Tested!

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

        Show
        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 added a comment -

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

        Show
        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
            Reporter:
            Dinesh Bolkensteyn
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: