commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (Resolved) (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (MATH-284) Avoid ArrayStoreException
Date Sat, 01 Oct 2011 15:17:34 GMT

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

Luc Maisonobe resolved MATH-284.
--------------------------------

    Resolution: Fixed

Fixed in subversion repository as of r1178009.

Thanks for the report and the fix suggestion.
                
> Avoid ArrayStoreException
> -------------------------
>
>                 Key: MATH-284
>                 URL: https://issues.apache.org/jira/browse/MATH-284
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 2.0
>            Reporter: Klaus
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: math-284.patch
>
>
> Add a new method
> org.apache.commons.math,Field#getRuntimeClass():
> ...
>     /**
>      * Returns the runtime class of the FieldElement. 
>      * 
>      * @return The {@code Class} object that represents the runtime
>      *         class of this object.
>      */
>     Class<? extends FieldElement> getRuntimeClass();
> ...
> and replace all occurrences of 
>   Array.newInstance(field.getZero().getClass(),....)
> with
>   Array.newInstance(field.getRuntimeClass(),....)
> to avoid the throwing of ArrayStoreException in the case you have a type hierachy of
Fields with a common interface
> and the array should have the interface type at runtime.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message