Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-15 Thread Jaikiran Pai
On Thu, 20 Feb 2025 09:30:02 GMT, Andrey Turbanov wrote: > We have helpful NPE messages now - they are more user-friendly. > And shorter methods are more likely to be inlined. src/java.base/share/classes/java/lang/String.java line 3649: > 3647: Iterable elements) { > 3648: O

RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-11 Thread Andrey Turbanov
We have helpful NPE messages now - they are more user-friendly. And shorter methods are more likely to be inlined. - Commit messages: - [PATCH] Avoid explicit Objects.requireNonNull where we know implicit NPE will happen - [PATCH] Avoid explicit Objects.requireNonNull where we know

Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-11 Thread Andrey Turbanov
On Thu, 6 Mar 2025 12:38:01 GMT, Jaikiran Pai wrote: >> We have helpful NPE messages now - they are more user-friendly. >> And shorter methods are more likely to be inlined. > > src/java.base/share/classes/java/lang/String.java line 3649: > >> 3647: Iterable elements) { >> 3648:

Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-07 Thread Raffaello Giulietti
On Thu, 20 Feb 2025 09:30:02 GMT, Andrey Turbanov wrote: > We have helpful NPE messages now - they are more user-friendly. > And shorter methods are more likely to be inlined. At some point we will probably have [null-restricted types](https://openjdk.org/jeps/8303099). Then it will be possibl

Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-06 Thread Joe Darcy
On Thu, 6 Mar 2025 20:01:47 GMT, Andrey Turbanov wrote: >> src/java.base/share/classes/java/lang/String.java line 3649: >> >>> 3647: Iterable elements) { >>> 3648: Objects.requireNonNull(delimiter); >>> 3649: Objects.requireNonNull(elements); >> >> Hello Andrey, I ha

Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-06 Thread Roger Riggs
On Thu, 20 Feb 2025 09:30:02 GMT, Andrey Turbanov wrote: > We have helpful NPE messages now - they are more user-friendly. > And shorter methods are more likely to be inlined. To confirm your intuition, please show the before/after performance differences if any. - PR Comment: htt

Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-06 Thread Andrey Turbanov
On Thu, 20 Feb 2025 09:30:02 GMT, Andrey Turbanov wrote: > We have helpful NPE messages now - they are more user-friendly. > And shorter methods are more likely to be inlined. While having prerequirements checks often is good, I think not having it in String.join can be a good thing. 1. String.

Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-06 Thread Raffaello Giulietti
On Thu, 20 Feb 2025 09:30:02 GMT, Andrey Turbanov wrote: > We have helpful NPE messages now - they are more user-friendly. > And shorter methods are more likely to be inlined. I second @jaikiran in that the `Objects.requireNonNull()` are there to clearly validate the arguments right at method e

Re: RFR: 8351344: Avoid explicit Objects.requireNonNull in String.join

2025-03-06 Thread Chen Liang
On Thu, 20 Feb 2025 09:30:02 GMT, Andrey Turbanov wrote: > We have helpful NPE messages now - they are more user-friendly. > And shorter methods are more likely to be inlined. Looks nice to me, thanks! src/java.base/share/classes/java/lang/String.java line 3650: > 3648: var delim = del