[ 
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-25-aa-diskhashtable.diff

DiskHashtable.getRemove() is annotated with @SuppressWarnings("unchecked") 
because it has an unchecked cast from Object to Vector<Object>. The cast is 
needed because the retValue variable that holds the Vector may also hold a 
DataValueDescriptor[], and is therefore of type Object.

The attached patch, derby-5840-25-aa-diskhashtable.diff, replaces the single, 
weakly typed retValue variable with two strongly typed variables. When the 
overloading of the variable is gone, there is no need to cast it, and the 
warnings go away.

The patch also makes the method return an ArrayList instead of a Vector. 
DiskHashtable instances are private to the transaction in which they are used, 
so returning synchronized collections shouldn't be necessary. Furthermore, all 
calls to DiskHashtable.getRemove() go through BackingStoreHashtable, which 
already returns an ArrayList instead of a Vector if the hash table hasn't spilt 
to disk yet. So the use of Vector in DiskHashtable seems to be because of its 
old age rather than its need for synchronization.

There's also a unit test store/TestDiskHashtable.java that accesses 
DiskHashtable directly and checks the type of the returned value. The patch 
updates the test so that it accepts any List implementation, not only Vector.

All regression tests ran cleanly with the patch.
                
> 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.1.1
>            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, derby-5840-07-aa-drda-for-each.diff, 
> derby-5840-08-aa-jdbc3-embedded.diff, 
> derby-5840-09-aa-test-deprecation-and-unchecked.diff, 
> derby-5840-10-aa-derbynet-perf-system.diff, 
> derby-5840-11-aa-engine-i18n-store-tools.diff, derby-5840-12-aa-jdbcapi.diff, 
> derby-5840-13-aa.diff, derby-5840-13-aa-remove-suppression.diff, 
> derby-5840-14-aa-bigdecimal.diff, derby-5840-15-aa-more-suppressions.diff, 
> derby-5840-16-aa-class-size-catalog.diff, 
> derby-5840-17-aa-property-conglomerate.diff, derby-5840-18-aa-arrayutil.diff, 
> derby-5840-19-aa-ddutils.diff, derby-5840-20-aa-collectnodes.diff, 
> derby-5840-21-aa-arrays.diff, derby-5840-22-aa-grouped-aggregates.diff, 
> derby-5840-23-aa-parsers.diff, derby-5840-24-aa-clone.diff, 
> derby-5840-25-aa-diskhashtable.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
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to