Class.getRecordComponents security checks

Attila Szegedi szegedia at gmail.com
Sun Feb 21 20:14:48 UTC 2021


Hey folks,

Why are security checks for Class.getRecordComponents as strict as those for e.g. getDeclaredMethods? I would’ve expected they’d be as strict as those for e.g. getMethods. Specifically, the difference is the:

> “the caller's class loader is not the same as the class loader of this class and invocation of s.checkPermission method with RuntimePermission("accessDeclaredMembers") denies access to the declared methods within this class” 

step. Aren’t record accessors supposed to be public?

Attila.


More information about the core-libs-dev mailing list