Re: 8281301: Map.of() calls with null argument should throw more contextual information.

2023-03-01 Thread Kasper Nielsen
I've been in situations as well where a bit more context would have been very useful for some collection NPEs. While lambdas are overkill. I do think there are some more low-level solutions. requireNonNull(k0) can be replaced with with requireNonNull(k0, "key is null"); For the indexed versions

Re: 8281301: Map.of() calls with null argument should throw more contextual information.

2023-02-28 Thread Stuart Marks
Sorry, it appears that you have fallen into a thicket of issues. [*] I'm usually fairly skeptical of these kinds of changes, as they often have more overhead than is apparent. Java requires all arguments to be /evaluated/ before the method is invoked. Evaluating a lambda includes loading and ru

8281301: Map.of() calls with null argument should throw more contextual information.

2023-02-28 Thread Sage Vaillancourt
Hi there. It's my first time posting to the development list, so please forgive any formatting errors. My proposed change is pretty small. Basically, a pattern I see with some frequency is calling Objects.requireNonNull(object, "objectName") before (or within) Map.of(), because otherwise there's n