SonarQube Java
  1. SonarQube Java
  2. SONARJAVA-271

Rule: super.clone() method should be called when overriding the Object.clone() method

    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

      Activity

      Hide
      Dinesh Bolkensteyn added a comment -

      Done

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

      Manually tested !

      Show
      Freddy Mallet added a comment - Manually tested !
      Hide
      Freddy Mallet added a comment -

      @Dinesh, I'm reopening this ticket as this rule also replaces PMD "Clone method must implement Cloneable" http://jira.sonarsource.com/browse/RSPEC-329

      Show
      Freddy Mallet added a comment - @Dinesh, I'm reopening this ticket as this rule also replaces PMD "Clone method must implement Cloneable" http://jira.sonarsource.com/browse/RSPEC-329
      Hide
      Dinesh Bolkensteyn added a comment -

      @Freddy It is not clear to me if we only need to add the depreciation link, or if the behavior of the rule must be updated.

      It seems in this case that behavior has been updated.

      Show
      Dinesh Bolkensteyn added a comment - @Freddy It is not clear to me if we only need to add the depreciation link, or if the behavior of the rule must be updated. It seems in this case that behavior has been updated.
      Hide
      Dinesh Bolkensteyn added a comment -

      Well afterall it seems that there's just a depreciation link missing.

      But I don't really get it, because AFAIK, we don't cover PMD's CloneMethodMustImplementCloneable rule with this one.

      Show
      Dinesh Bolkensteyn added a comment - Well afterall it seems that there's just a depreciation link missing. But I don't really get it, because AFAIK, we don't cover PMD's CloneMethodMustImplementCloneable rule with this one.
      Hide
      Dinesh Bolkensteyn added a comment -

      Done, but check my previous comment Freddy please.

      Show
      Dinesh Bolkensteyn added a comment - Done, but check my previous comment Freddy please.
      Hide
      Freddy Mallet added a comment -

      If a class has a clone() method which comply with this rule "super.clone() method should be called when overriding the Object.clone() method", as a side effect the class MUST implement the Cloneable interface otherwise a CloneNotSupportedException will be thrown by the root Object.clone() method. qed !

      Show
      Freddy Mallet added a comment - If a class has a clone() method which comply with this rule "super.clone() method should be called when overriding the Object.clone() method", as a side effect the class MUST implement the Cloneable interface otherwise a CloneNotSupportedException will be thrown by the root Object.clone() method. qed !
      Hide
      Freddy Mallet added a comment -

      Manually tested !

      Show
      Freddy Mallet added a comment - Manually tested !

        People

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

          Dates

          • Created:
            Updated:
            Resolved: