5 ms·
The best feature of the Java language, in my opinion, is that I can compile Java 4 code using JDK 17. This is what killed my enthusiasm for Python after Python
by foxyv 3y ago
The best feature of the Java language, in my opinion, is that I can compile Java 4 code using JDK 17. This is what killed my enthusiasm for Python after Python 3 not being able to run Python 2 code without some special sauce. Backwards compatibility is just such a huge boon when you maintain applications that have been running for over 20 years.
- dataflow 3y ago> is that I can compile Java 4 code using JDK 17 https://stackoverflow.com/a/33240753 https://stackoverflow.com/a/33240753 ?
- foxyv 3y agoThe best part is you can still get around this. Although I've been lucky enough to not need to do this. I think my oldest project used Java 5 originally and doesn't use Sun classes. https://stackoverflow.com/questions/4065401/using-internal-sun-classes-with-javac https://stackoverflow.com/questions/4065401/using-internal-s...
- hyperman1 3y agoNotice how this uses a sun.* package, i.e. a hidden implementation detail of 1 specific JVM . Java was never guaranteed to have it in the first place. Some of these classes were so usefull that people used them even if they shouldn't. There are compatibility flags in the jvmbto allow access even in java 9, but each new version slowly causes additional pain. One risk of using libraries (or working with other people) is that you don't know if they limited them selves to good enough practices. Most do, a small percentage doesn't, but they cause pain for all of us.
- tjalfi 3y agoI have compiled Fortran programs from the 70s on modern platforms without changing a line. The compiler, OS, and CPU architecture had all disappeared but the programs still worked correctly.
- foxyv 3y agoFortran is the silent king of the world. I think the singularity will be caused by an old piece of extremely optimal Fortran code that has been quietly taking over the world on exceedingly faster hardware.
- pjmlp 3y agoExcept since Java 8 that is no longer true. Nowadays with modules and linked runtimes, deprecated APIs are indeed removed. Plenty of Java 4 code won't run in Java 17, if it happens to use any of those.
- foxyv 3y agoSure the APIs are gone, but you can still compile the code and include the libraries from those APIs and still run the dang thing. Also, the removal of those APIs was done in an extremely responsible manner with long periods of deprecation. Most of those APIs were deprecated in Java 5 anyways.
- pjmlp 3y agoNo you cannot, because some of those APIs depend on native code that is now gone like in Thread.stop(). It doesn't change the fact that Java 4 using those features won't run anylonger without additional effort. Another are that has occasionally had breaking changes were JDBC drivers and related interfaces. Java folks try to minimize breaking changes, yet each release has a section about breaking changes for a reason, throughout Java's history.
- foxyv 3y agoIf you are using obscure features then yeah, you are going to see breaking changes. Just try running Tomcat 7 on Java 8+. But there will always be exceptions like that in any language. Just like Rust has safety guarantees, until you start using "unsafe." But, I have applications that were coded in the 90s that are still running fine on Java 17 with minimal maintenance for security updates. No trans-piling necessary. I don't know about these "Java Folks" but no one is claiming that Java is a magic unicorn. But it is a well designed language that has excellent backwards compatibility.