Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-354

PureJavaCrc32C constructor calls overrideable method

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.12
    • Component/s: None
    • Labels:
      None

      Description

      Constructors must not call overrideable methods.

      An object is not guaranteed fully constructed until the constructor exits, so the subclass override may not see the proper parent object.

      In this case, the class is package-protected so it's possible to ensure that subclasses don't override the method.

      However this would have to be checked, so it would be better to fix the issue:
      1) make class final
      2) make reset method final
      3) extract the code into a private method that is used by the ctor and the public method.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sebb Sebb
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: