-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Java 11's readString and writeString on modern JREs #233
Conversation
As the commits list shows I had to fix two bugs in the test code to pass on Windows. These are actually not dependend of the actual changes done in this PR, but had not been detected prior without those changes. Hence I do not provide them in distinct PRs, but keep them as part of this one. |
@michael-o Kindly requesting your review. :-) |
TBH I would make just p-u jdk11 mandatory to get rid of this over complicated multi release jars.... |
@olamy I am +1 with only supporting JDK11 from now on, but is it realisitic? Also it wouldn't solve the core problem: As soon as JDK 21 comes up with even easier and even faster APIs, I certainly want to use it -- and we are back at multi-release JARs. Having said that, anybody willing to incorporate my PR? |
I am a bit disappointed that this PR simply is ignored mostly. Using Java 11's API provides superior performance, so is really beneficial. Why not simply merging this PR (it does not harm) to allow me to benefit from the changes, but go on with @olamy's proposal after that? Any comment is better than being silent! Thanks! :-) |
What superior performance? |
Thank you for continuing the discussion about this PR. :-) JDK 11's So the actual question is: Why not using the JDK 11 APIs in Plexus Utils? (*) Disclaimer: I am part of the OpenJDK team working on I/O performance improvements, and I am the one who turned Plexus Utils into a multi-release JAR in 2021. My intention is to evangelize the use of modern Java's API so libraries will gain performance benefits automatically whenever we do an internal optimization inside of OpenJDK. |
Interesting and reasonable explanation. |
@mkarg Please squash, I will test and merge. |
Thank you. Squash is pushed. |
As the latest Java release was 19 (and 20 will be here in few weeks), it makes sense to allow users of those JREs to take advantage of their superior APIs. In this PR, I am proposing to use the single-line
Files.readString
andFiles.writeString
methods on all modern JREs (11+) instead of dealing with interim custom byte-to-String operations needed since JRE 7 through 10. For the sake of this, I have adopted the multi-release pattern toFileUtils
in the same way we already applied it years ago toBaseIOUtils
. As such, JRE 11 through 21 (and further) will be as fast as possible when reading / writing text files.