You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2019/10/04 16:19:30 UTC

[Bug 63805] New: RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

            Bug ID: 63805
           Summary: RFE: Leverage language features introduced in Java 8,
                    remove use of deprecated methods
           Product: POI
           Version: 4.0.x-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: dev@poi.apache.org
          Reporter: axel@dua3.com
  Target Milestone: ---

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).

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #7 from Dominik Stadler <do...@gmx.at> ---
Applied "BigDecimal: use enum args instead of integers (deprecated in Java 9)"
via 1868897

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #2 from Axel Howind <ax...@dua3.com> ---
Created attachment 36809
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36809&action=edit
BigDecimal: use enum args instead of integers (deprecated in Java 9)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #8 from Dominik Stadler <do...@gmx.at> ---
Applied "BigDecimal: use enum args instead of integers (deprecated in Java 9)"
via r1868897

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

Axel Howind <ax...@dua3.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #14 from Axel Howind <ax...@dua3.com> ---
If I didn't overlook something, all changes should be in now. I will close this
issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #6 from Axel Howind <ax...@dua3.com> ---
Created attachment 36813
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36813&action=edit
Strings: Replace StringBuffer with StringBuilder, use indexOf(char) instead of
indexOf(String) where possible

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #4 from Axel Howind <ax...@dua3.com> ---
Created attachment 36811
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36811&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #12 from Axel Howind <ax...@dua3.com> ---
Applied "clean up IntList code" via r1874257

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #10 from Axel Howind <ax...@dua3.com> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #5 from Axel Howind <ax...@dua3.com> ---
Created attachment 36812
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36812&action=edit
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).

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #9 from Andreas Beeker <ki...@apache.org> ---
Remove references to DatatypeConverter via r1868953

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #3 from Axel Howind <ax...@dua3.com> ---
Created attachment 36810
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36810&action=edit
use zero size arg to toArray(), use Collection.addAll()

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #13 from Axel Howind <ax...@dua3.com> ---
Applied the remaining bits of "use indexOf(char) instead of indexOf(String)
where possible" via r1874262

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63805] RFE: Leverage language features introduced in Java 8, remove use of deprecated methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #11 from Axel Howind <ax...@dua3.com> ---
Applied "use zero size arg to toArray(), use Collection.addAll()" via 1869919

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org