You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2016/05/16 04:23:12 UTC

[jira] [Resolved] (COMPRESS-354) PureJavaCrc32C constructor calls overrideable method

     [ https://issues.apache.org/jira/browse/COMPRESS-354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Bodewig resolved COMPRESS-354.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.12

fixed with git commit 3083ea5

It might be worth opening a similar issue with Hadoop since we've copied the class from there.

> PureJavaCrc32C constructor calls overrideable method
> ----------------------------------------------------
>
>                 Key: COMPRESS-354
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-354
>             Project: Commons Compress
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 1.12
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)