RFR: 8261031: Move some ClassLoader name checking to native/VM

Mandy Chung mchung at openjdk.java.net
Wed Feb 3 19:55:45 UTC 2021


On Wed, 3 Feb 2021 12:21:30 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> This patch moves some sanity checking done in ClassLoader.java to the corresponding endpoints in native or VM code.

I'm unsure the benefit of moving the check done by `checkName` to the VM but `preDefineClass` still calls `checkName`.   The overhead of `checkName` should be fairly negligible?

src/java.base/share/native/libjava/ClassLoader.c line 291:

> 289:     }
> 290:     // disallow slashes in input, change '.' to '/'
> 291:     if (verifyFixClassname(clname)) {

perhaps we should replace all use of `fixClassname` with `verifyFixClassname` and remove `fixClassname`.

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

PR: https://git.openjdk.java.net/jdk/pull/2378


More information about the core-libs-dev mailing list