RFR: 8371953: Document null handling in core reflection APIs [v6]

David Holmes dholmes at openjdk.org
Thu Nov 20 04:55:56 UTC 2025


On Wed, 19 Nov 2025 13:31:56 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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.
>
> I think checking ahead is better. If we move c.isPrimitive call to be before isPrimitive, the new consistent NPE becomes a compatibility risk. Better perform checks early to prevent compatibility constraints. And I don't think c is an unused parameter here.

Yes you are right.

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

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


More information about the core-libs-dev mailing list