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

Knut Anders Hatlen updated DERBY-5143:
--------------------------------------

    Attachment: getTypeMap-warning.diff

The attached patch shows how to silence the compiler warning without copying 
the map.

A side effect of this change is that the returned map in the JDBC 4.0 driver is 
exactly the same as the one that would have been returned by the JDBC 3.0 
driver, and it is immutable. One of the JDBC 4.0 tests 
(ConnectionTest.testGetTypeMapReturnsAsExpected) calls put() on the returned 
map, and therefore starts failing with an UnsupportedOperationException now 
that the returned map isn't mutable. I think the test should be changed, and 
the map should stay immutable.

> Remove unnecessary copying of the map in getTypeMap()
> -----------------------------------------------------
>
>                 Key: DERBY-5143
>                 URL: https://issues.apache.org/jira/browse/DERBY-5143
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.8.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: getTypeMap-warning.diff
>
>
> The JDBC 4.0 Connection classes implement getTypeMap() by calling 
> super.getTypeMap() and copying the resulting map. This is done to prevent an 
> unchecked compiler warning that we would see if we simply returned 
> super.getTypeMap() in this method. It would be cheaper and simpler to return 
> super.getTypeMap() and ignore the warning.

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

Reply via email to