2 ms·
Field modifiers are a semantic constraint not a security constraint. It is right and proper that you should be able to bypass them with the appropriate backflip
by rusk 2y ago
Field modifiers are a semantic constraint not a security constraint. It is right and proper that you should be able to bypass them with the appropriate backflips.
The main issue is safety cause you might modify something that isn’t modifiable and cause a SEGV and that is precisely the concern access modifiers are meant to address.
- blibble 2y agothey certainly were a security constraint back in the day before Java gave up on trying to use the type system for security e.g. SecurityManager for applets will not let you setAccessible(true) on private fields of system classes
- rusk 2y agoYes but that’s the security manager doing it not the field modifiers. It’s just reusing the modifiers as security metadata.