RFR: 8353197: Document preconditions for JavaLangAccess methods [v2]
Alan Bateman
alanb at openjdk.org
Wed May 7 07:40:14 UTC 2025
On Wed, 7 May 2025 07:29:55 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> Document preconditions on certain `JavaLangAccess` methods that use operations either unsafe and/or without range checks.
>
> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix typo in pre-existing JavaDoc
src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 302:
> 300: * <b>WARNING: This method does not perform any bound checks.</b>
> 301: */
> 302: int countPositives(byte[] ba, int off, int len);
Maybe we should change countPositives to do a bounds check and have a private method in StringCoding be the `@IntrinsicCandidate`. This would make it easier to audit. Right now it's hard to audit because there are usages of JLA.countPositives in faraway classes. I'm not suggested we do this as part of this PR of course but it would mean the warning comment could be removed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24982#discussion_r2076997921
More information about the security-dev
mailing list