<a href="https://shipilev.net/jvm/anatomy-quarks/17-trust-nonstatic-final-fields/" rel="nofollow">https://shipilev.net/jvm/anatomy-quarks/17-trust-nonstatic-f...</a> is a damned shame. User code misses out on an important optimization available only to system-provided classes because certain frameworks have abused JNI and reflection to mutate final fields, which by all rights should be immutable.<p>Platforms, especially compilers and runtimes, need to be absolutely strict in <i>enforcing</i> semantic restrictions so as to preserve optimization opportunities for the future.
Tangential: Apple has a new Swift Java bridge which is pretty cool, supporting both JNI and Panama. I’ve been porting it to Android this past week.<p><a href="https://github.com/swiftlang/swift-java">https://github.com/swiftlang/swift-java</a>
Happy to see this gem shared here. I've learnt a lot about the JVM going through these.<p>This article about the "stack allocation" misnomer in Java in particular is one of my favorites: <a href="https://shipilev.net/jvm/anatomy-quarks/18-scalar-replacement/" rel="nofollow">https://shipilev.net/jvm/anatomy-quarks/18-scalar-replacemen...</a>. What the JVM really does is escape analysis + scalar replacement.
If you work for a few years with JVM based languages this set of articles are so interesting! I remember reading through these for the first time several years ago.
I’ve basically forgotten about Java. It would never occur to me to start a new project in it. Am I the only one? It feels like I’d reach for python if I want fast development and flexibility, Go if I want to handle a bunch of I/O concurrency in a garbage collected way, Swift if I want a nice language that’s compiled and balanced, or Rust if I want performance and safety in a compiled language. Those are just my personal leanings. I know kotlin has made Java more ergonomic, and yet….