Maven
  1. Maven
  2. MNG-3266

maven-model RepositoryBase overrides equals() but not hashCode()

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.2.2, 3.0-alpha-6
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      2

      Description

      Overriding equals and not hashCode is considered bad practice. Also, while looking around, I noticed the two subclasses (Repository and PluginRepository) both override equals and just call "super.equals()". There is a cryptic comment nearby that leads me to believe this is a temporary fix for an old problem.

      1. MNG-3266-maven-model.patch
        2 kB
        Jared Roberts
      2. MNG-3266-maven-model-v2.patch
        3 kB
        Jared Roberts

        Issue Links

          Activity

          Hide
          Jared Roberts added a comment -

          This patch implements hashCode() and also removes the subclasses' overrides of equals.

          Show
          Jared Roberts added a comment - This patch implements hashCode() and also removes the subclasses' overrides of equals.
          Hide
          Jared Roberts added a comment -

          The first version of this patch had a NPE in hashCode() since "217 + null != null". I opted to just use the <identifier> tag instead of implementing these methods.

          Show
          Jared Roberts added a comment - The first version of this patch had a NPE in hashCode() since "217 + null != null". I opted to just use the <identifier> tag instead of implementing these methods.
          Hide
          Vincent Siveton added a comment -

          should be fixed by MNG-2817

          Show
          Vincent Siveton added a comment - should be fixed by MNG-2817
          Hide
          Herve Boutemy added a comment -

          patch applied in r895088 for 2.2.x branch and r895089 for 3.0.x
          thank you

          Show
          Herve Boutemy added a comment - patch applied in r895088 for 2.2.x branch and r895089 for 3.0.x thank you

            People

            • Assignee:
              Herve Boutemy
              Reporter:
              Jared Roberts
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: