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

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
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: [hidden email]
          Reporter: [hidden email]
  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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

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

--- Comment #1 from Dominik Stadler <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

Dominik Stadler <[hidden email]> changed:

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

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #2 from Axel Howind <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #3 from Axel Howind <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #4 from Axel Howind <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #5 from Axel Howind <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63805

--- Comment #6 from Axel Howind <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]