this post was submitted on 24 Mar 2024
1022 points (99.2% liked)

Programmer Humor

19480 readers
1809 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 7 months ago (4 children)

Objective-C does not enforce method access (e.g. private methods) at the runtime level. If you are sufficiently determined, there are no restrictions on what methods you can call, unlike Java or C# (AFAIK).

[–] [email protected] 4 points 7 months ago (3 children)

Java absolutely lets you do that with Reflections. You're not supposed to, and it's painfully slow, but the JVM is only marginally smarter than javac (and that's saying something) so there's nothing actually stopping you.

[–] [email protected] 1 points 7 months ago (1 children)

I thought there was security code to stop that kind of thing. Granted, it's been over 10 years since I've done anything with Java more than tinkering with Minecraft mods.

[–] [email protected] 4 points 7 months ago

Java did have a Security Manager that can be used to prevent this sort of thing. The original thinking was that the Java runtime would essentially be an OS, and you could have different applets running within the runtime. This required a permission system where you could confine the permissions of parts of a Java program without confining the entire thing; which led to the Java security manager.

Having said that, the Java Security Manager, while an interesting idea, has never been good. The only place it has ever seen significant use was in webapps, where it earned Java the reputation for being insecure. Nowadays, Java webapps are ancient history due to the success of Javascript.

The security manager was depreciated in Java 17, and I believe removed entirely in Java 21.

load more comments (1 replies)
load more comments (1 replies)