SonarQube Java
  1. SonarQube Java
  2. SONARJAVA-197

Rule: 'super.finalize()' should be called at the end of Object.finalize() implementations

    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

      Depreciate rules :

      • Checkstyle: com.puppycrawl.tools.checkstyle.checks.coding.SuperFinalizeCheck
      • PMD: FinalizeDoesNotCallSuperFinalize

      Implements http://jira.sonarsource.com/browse/RSPEC-1114

        Activity

        Hide
        Dinesh Bolkensteyn added a comment -

        Done

        Show
        Dinesh Bolkensteyn added a comment - Done
        Hide
        Dinesh Bolkensteyn added a comment -

        39 violations, there seems to be a false positive on:

        try {
          // ...
        } finally {
          // ...
          super.finalize();
        }
        
        Show
        Dinesh Bolkensteyn added a comment - 39 violations, there seems to be a false positive on: try { // ... } finally { // ... super .finalize(); }
        Hide
        Dinesh Bolkensteyn added a comment -

        I let you reopen the ticket Fabrice if you believe that case is worth fixing

        Show
        Dinesh Bolkensteyn added a comment - I let you reopen the ticket Fabrice if you believe that case is worth fixing
        Hide
        Fabrice Bellingard added a comment -

        Indeed, this case (try-catch) should be considered as correct and not raise an issue.

        What's more, I think that if a "super.finalize()" is detected elsewhere in the method, the message should not be "Add a call to 'super.finalize()' at the end of this Object.finalize() implementation." but "Move this call to 'super.finalize()' at the end of this Object.finalize() implementation." (and the issue should be on the correct line where the "super.finalize()" has been detected).

        Show
        Fabrice Bellingard added a comment - Indeed, this case (try-catch) should be considered as correct and not raise an issue. What's more, I think that if a "super.finalize()" is detected elsewhere in the method, the message should not be "Add a call to 'super.finalize()' at the end of this Object.finalize() implementation." but "Move this call to 'super.finalize()' at the end of this Object.finalize() implementation." (and the issue should be on the correct line where the "super.finalize()" has been detected).
        Hide
        Dinesh Bolkensteyn added a comment -

        Done

        Show
        Dinesh Bolkensteyn added a comment - Done
        Hide
        Fabrice Bellingard added a comment -

        Tested!

        Show
        Fabrice Bellingard added a comment - Tested!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: