[ 
https://issues.apache.org/jira/browse/DERBY-5143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009099#comment-13009099
 ] 

Knut Anders Hatlen commented on DERBY-5143:
-------------------------------------------

I think the reason why we added the getTypeMap() method in the first place was 
that the compilation of NetConnection40 would generate the following warning:

Compiling 1 source file to /code/derby/trunk0/classes
/code/derby/trunk0/java/client/org/apache/derby/client/net/NetConnection40.java:48:
 warning: getTypeMap() in org.apache.derby.client.am.Connection implements 
getTypeMap() in java.sql.Connection; return type requires unchecked conversion
found   : java.util.Map
required: java.util.Map<java.lang.String,java.lang.Class<?>>
public class  NetConnection40 extends org.apache.derby.client.net.NetConnection 
{
1 warning

And suppressing unchecked warnings for the entire class wasn't considered a 
good alternative. There may be other ways to silence this specific warning 
only, but I'm not aware of any.

You're of course right that Connection.getTypeMap() should return 
Collections.EMPTY_MAP. I thought it already did, but that's only on the 
embedded driver. Will fix that too.

> 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