I have a Spring Framework 4.2 project that I can successfully compile with JDK 11 and run with Wildfly that is utilizing Java 11.
I'm looking at upgrading to use Wildfly v26 which utilizes Java 17. Seems like it would work since newer versions of Java are supposed to be able to run code compiled against earlier versions of Java.
My skepticism about this particular project comes from the fact that if I use JDK 17 and attempt to compile my project against Java 11 (via Maven), I get errors related to cglib
which is part of Spring Framework.
From what I understand, cglib
calls internal functions that are not publicly accessible and Java 17 doesn't support that.
So, I'm lacking some understanding here: the Java 17 JRE is supposed to be able to run earlier versions of Java code (as far as I understand), however my JDK 17 can't seem to compile code targeting Java 11. I thought this is a capability we're supposed to have - compiling code for earlier versions with newer versions of the JDK. Perhaps this is one of those edge case scenarios where the actual issue would require a compilation using JDK 11 and then, and only then, would it be able to run with JRE 17.
So, the overarching question is: Can I get my code targeting Java 11 to run (in ANY way) with Java 17 given this particular issue?
Bonus question: What about the compatibility between a JDK, compilation target and runability am I misunderstanding here?