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

Knut Anders Hatlen updated DERBY-6292:
--------------------------------------

    Attachment: d6292-1a.diff

The attached patch makes the suggested change to 
FormatableArrayHolder.getArray(). In order to avoid the need for reflection, 
the meaning of the Class parameter of that method is changed from the component 
type of the returned array to the actual type of the returned array.

Callers had to be updated to pass in an array class as argument instead of a 
component type. The callers no longer need to cast the returned value since 
Arrays.copyOf() is strongly typed.

All tests ran cleanly with the patch.
                
> Use Arrays.copyOf() in FormatableArrayHolder.getArray()
> -------------------------------------------------------
>
>                 Key: DERBY-6292
>                 URL: https://issues.apache.org/jira/browse/DERBY-6292
>             Project: Derby
>          Issue Type: Improvement
>          Components: Services
>    Affects Versions: 10.11.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Trivial
>         Attachments: d6292-1a.diff
>
>
> FormatableArrayHolder.getArray() creates an array of the correct type using 
> reflection and copies it manually. Java 6 introduced a copyOf() method in 
> java.util.Arrays that could do all of this automatically. Now that Java 6 is 
> the minimum level on trunk, we could take advantage of the library method and 
> simplify the code.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to