Bug 64004

Summary: Replace clone() with copy constructor
Product: POI Reporter: Andreas Beeker <kiwiwings>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 4.1.x-dev   
Target Milestone: ---   
Hardware: All   
OS: All   

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.