commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (MATH-349) Dangerous code in "PoissonDistributionImpl"
Date Wed, 23 Mar 2011 20:01:06 GMT

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

Luc Maisonobe closed MATH-349.
------------------------------


Closing issue as it was included in version 2.2, which has been released

> Dangerous code in "PoissonDistributionImpl"
> -------------------------------------------
>
>                 Key: MATH-349
>                 URL: https://issues.apache.org/jira/browse/MATH-349
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Priority: Minor
>             Fix For: 3.0
>
>
> In the following excerpt from class "PoissonDistributionImpl":
> {code:title=PoissonDistributionImpl.java|borderStyle=solid}
>     public PoissonDistributionImpl(double p, NormalDistribution z) {
>         super();
>         setNormal(z);
>         setMean(p);
>     }
> {code}
> (1) Overridable methods are called within the constructor.
> (2) The reference "z" is stored and modified within the class.
> I've encountered problem (1) in several classes while working on issue 348. In those
cases, in order to remove potential problems, I copied/pasted the body of the "setter" methods
inside the constructor but I think that a more elegant solution would be to remove the "setters"
altogether (i.e. make the classes immutable).
> Problem (2) can also create unexpected behaviour. Is it really necessary to pass the
"NormalDistribution" object; can't it be always created within the class?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message