Is java byte-code always forward compatible?

Sarveswaran Meenakshi Sundaram :

I understand that the byte code generated by version JDK X is guaranteed to work on JVM Y, provided Y >= X.

Does this hold good for all versions of JDK/JVM? i.e Is it fair to expect class files generated by JDK 1 to work on JVM 11?

Referred to JVM specs, JDK 8 compatibility guide and Java 11 JSR Could not find a precise answer there.

Uwe Plonus :

The bytecode itself should work in future versions. Until now this holds true but nobody knows if this will be true for all future.

What changes, and can break your program, are changes in the API. Deprecated APIs may vanish in the future and then your program will not work anymore and may throw a java.lang.NoSuchMethodException when referencing such a method.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=467515&siteId=1