While I still have time working on POI, I'd like to contribute patches to update the codebase to take advantage of features introduced in Java 8 and replace parts of the code that use deprecated methods. I would do so in a way that does not change semantics or behaviour (other than hopefully positive impact on performance). Examples I have seen in the code are: - use of StringBuffer instead of StringBuilder - Map lookup and get/put in two steps which can be done in a single operation since in the meantime computeIfAbsent() and other methods were introduced - toArray() with an argument of T[0] (I know it's faster than pre-allocating an array with the correct size, but now we can pass a method reference to the array constructor instead which is even faster and puts less stress on the GC) - places where single operation collection creation could be used, i.e. List.of() for creating an immutable list and many more. If I get a positive feedback, I'll create patches and collect them here (or pull requests if github mirroring works again soon).
Patches welcome! Would be good if you can split them for each type of change so we can apply them in smaller steps and verify if things still work.
Created attachment 36809 [details] BigDecimal: use enum args instead of integers (deprecated in Java 9)
Created attachment 36810 [details] use zero size arg to toArray(), use Collection.addAll()
Created attachment 36811 [details] clean up IntList code The IntList code looked somewhat obfuscated to me (like a literal translation of some functional code), so I cleaned it up in some places. I rearranged some of the loops to a more canonical form, which could in theory also be of benefit performance wise. I did not have measured this one on its won, but together with the other patches time for a full `ant jar` after `ant clean` went down 20 seconds on my machine, so at least it should not be worse than before.
Created attachment 36812 [details] in some places, Objects.equals could be used instead Please apply after or together with the other patches, as there might be side effects (because I removed one or two package private XXXequals() methods in this ptach).
Created attachment 36813 [details] Strings: Replace StringBuffer with StringBuilder, use indexOf(char) instead of indexOf(String) where possible
Applied "BigDecimal: use enum args instead of integers (deprecated in Java 9)" via 1868897
Applied "BigDecimal: use enum args instead of integers (deprecated in Java 9)" via r1868897
Remove references to DatatypeConverter via r1868953
Hi, what's the current status of this? I see that the BigDecimal patch has been applied. I am waiting for you to catch up before I create any more patches. If the patches are too big or I should change something else, just give a feedback here.
Applied "use zero size arg to toArray(), use Collection.addAll()" via 1869919
Applied "clean up IntList code" via r1874257
Applied the remaining bits of "use indexOf(char) instead of indexOf(String) where possible" via r1874262
If I didn't overlook something, all changes should be in now. I will close this issue.