Bug 64004 - Replace clone() with copy constructor
Summary: Replace clone() with copy constructor
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 4.1.x-dev
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-14 23:04 UTC by Andreas Beeker
Modified: 2019-12-24 11:58 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Beeker 2019-12-14 23:04:02 UTC
Sonar complains about a lot of clone() implementations - mainly in HSSF, DDF.

see also https://www.artima.com/intv/bloch.html#part13

I'll replace them with a copy constructor + copy() method and delegate clone() to copy() where necessary.
Comment 1 Andreas Beeker 2019-12-14 23:45:11 UTC
EscherRecords fixed via r1871563
Comment 2 Andreas Beeker 2019-12-22 21:48:54 UTC
The patch applied via r1871911 is quite a big one.

I've implemented the copy constructor and copy() method for the HSSF classes which implemented Cloneable.

Originally I thought about the Duplication interface having a type parameter to force the implementation for a specific type, but rolled back the generics as this makes the class definitions hard to read and user code would be flagged as using the raw classes.

Furthermore I've cleaned up the javadocs and removed the reference to the authors and the Microsoft Excel 97 Developer's Kit - compared to the constantly updated [MS-XLS] this is probably quite out-dated.

I've kept the clone() methods to be removed in 5.0.0 - I'd prefer to remove those soon than later ...
Comment 3 Andreas Beeker 2019-12-24 11:58:09 UTC
With r1871938 also the HWPF classes are patched.