On Wed, 19 Nov 2025 06:45:46 GMT, David Holmes <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/Class.java line 3839:
>> 
>>> 3837:      */
>>> 3838:     public boolean isNestmateOf(Class<?> c) {
>>> 3839:         Objects.requireNonNull(c);
>> 
>> So the behavior change here is calling isNestmateOf(null) on a class object 
>> for a primitive or array class will throw NPE when it didn't throw it 
>> previously.  Technically an incompatible change but I agree it's in the 
>> weeds when it comes to impact.
>
> Removed erroneous comment

I went back through the nestmates design archives that I have to see if this 
particular issue was ever raised but I could not find it called out. I'm not a 
fan of explicit null checks as they penalize all the good code. I also don't 
think the inconsistency is/was an issue. If code does not need to use a 
parameter to complete its function then it also doesn't need to validate the 
unused parameter. YMMV.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28336#discussion_r2540864248

Reply via email to