[
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-05-aa-client-deprecation.diff
derby-5840-04-aa-client-level.diff
I mentioned that I had tried to change the source level for the network client
and found that it caused a lot of deprecation warnings to pop up, even though
the methods were deprecated before Java 5. I found an explanation in this bug
report: http://bugs.sun.com/view_bug.do?bug_id=6394563
The compile target in java/client/build.xml specifies nowarn="on", which is
supposed to silence warnings. However, it only silences non-mandatory warnings,
and deprecation warnings became mandatory in Java 5. So when source level
changes from 1.4 to 1.5, the compiler isn't allow to ignore the deprecation
warnings.
The attached patches change the source and target level for the network client
code to 1.5, and clean up the warnings. I've split this change in two separate
patches so that it's easier to see which changes are for generics/unchecked
conversion warnings, and which changes are for the deprecation warnings.
derby-5840-04-aa-client-level.diff changes the compiler level and addresses the
unchecked conversion warnings by using generics in signatures.
One thing to note is that it removes the getTypeMap() implementations in
LogicalConnection40 and NetConnection40, as the getTypeMap() implementations in
their respective super-classes now have the correct generic signature and no
overrides are needed anymore.
derby-5840-05-aa-client-deprecation.diff cleans up the deprecation warnings.
There were three kinds of warnings:
- Use of deprecated class java.io.StringBufferInputStream in Clob,
ClobOutputStream and ClobWriter. This code is only used when accessing clobs on
an old server that doesn't support locators, so I just silenced them using a
@SuppressWarnings("deprecation") annotation for now. I did however refactor the
code so that the annotation only had to be added at one isolated location.
- LogicalCallableStatement and LogicalPreparedStatement implement some
deprecated methods (which they have to implement in order to satisfy the
interface), and the compiler complains because they are implemented by
forwarding the calls to deprecated methods in the physical statement classes.
Adding @Deprecated annotations to the methods in the logical statement classes
silences the warnings, as calling deprecated methods from other deprecated
methods does not cause warnings.
- The ResultSet class uses deprecated methods in java.util.Date. The patch
makes it use non-deprecated methods in java.util.Calendar instead.
The regression tests ran cleanly with these patches, and the compiler didn't
emit any warnings.
> 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: 10.10.0.0
> 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
>
>
> 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