db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5840) Clean up compiler warnings introduced by using Java 5 language features
Date Tue, 17 Jul 2012 12:34:35 GMT

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

Knut Anders Hatlen updated DERBY-5840:

    Attachment: derby-5840-06-aa-jdbc3-stubs.diff

The 04 patch broke the build if the JDK was newer than Java 5 and no ant.properties file pointing
to a Java 5 installation was present.

The reason for the build break was that some JDBC methods actually changed between Java 1.4.2
and Java 5:

CallableStatement.getObject(String, Map) -> Object
CallableStatement.getObject(int, Map) -> Object
Connection.setTypeMap(Map) -> void
Connection.getTypeMap() -> Map

In all of these signatures, Map was changed to Map<String,Class<?>> in Java 5.

When we changed the source level of the client's implementation of these interfaces, and the
build used the real Java 5 libraries, we got warnings about unchecked conversions because
the implementation classes did not have generic signatures. So the 04 patch changed the signatures
to silence the warnings.

However, if we compile using the stubs, which still use non-generic signatures, we get a build
error because the compiler doesn't find that we have implemented that method with a more specific

The fix is to update the signatures in the JDBC 3.0 stubs to match the signatures in Java
5, so that we get the same results regardless of which libraries we compile against. The JDBC
3.0 stubs are no longer used to compile code that should run on older JVMs, so it should be
a safe move.

derby-5840-06-aa-jdbc3-stubs.diff does that by changing the signatures of the above mentioned
methods to use generics.

The patch also changes the source and target level in the build target for the stubs (in order
to be allowed to use generic signatures in the code), and fixes a variable declaration in
the java.sql.DriverManager stub in order to silence a warning that appeared because of the
changed source level.

Committed revision 1362464.
> Clean up compiler warnings introduced by using Java 5 language features
> -----------------------------------------------------------------------
>                 Key: DERBY-5840
>                 URL: https://issues.apache.org/jira/browse/DERBY-5840
>             Project: Derby
>          Issue Type: Improvement
>          Components: Miscellaneous
>    Affects Versions:
>            Reporter: Rick Hillegas
>         Attachments: derby-5840-01-aa-compatibilityTests.diff, derby-5840-02-aa-compatibilityTests-again.diff.txt,
derby-5840-03-aa-drda.diff, derby-5840-03-ab-drda.diff, derby-5840-04-aa-client-level.diff,
derby-5840-05-aa-client-deprecation.diff, derby-5840-06-aa-jdbc3-stubs.diff
> Using Java 5 language features forces us to compile code at level 5 or higher. At this
level, the compiler raises warnings not seen at lower levels. This issue is a place to discuss
and attach cleanup to eliminate these warnings.

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


View raw message