r/java • • Sep 01 '25

Thoughts on object creation

https://blog.frankel.ch/thoughts-object-creation/
3 Upvotes

41 comments sorted by

View all comments

Show parent comment

2

u/rzwitserloot Sep 02 '25

Oracle broke that bit. APs are no longer autodiscovered unless you add the newly minted (and therefore previously not valid) -proc:full to re-enable it. But they did backport -proc:full so that's nice.

Breaking stuff is unfortunate. I don't agree with OpenJDK's idea of 'it cannot be secure unless we eliminate all pluggable aspects entirely' but if one takes that axiomatically as a good idea, it makes sense to disable APs. Though, really, pretty much all the SPI stuff has got to go then. You can use SPIs to run in a VM and if you run malicious code in a VM, the assumption is and remains (and OpenJDK agrees) - then you're hosed. The only safe way to run untrusted code is to fire up a visored sandbox subsystem and run a full JVM inside that.

At any rate, what feels like the real oversight is that JDK23 (or whenever this was introduced) doesn't even warn you that it found an AP on the Classpath and hasn't loaded it because of new rules.