Java是向后兼容的,但是当我们将jdk从1.6升级到1.8时,为什么我们需要升级许多库? [英] Java is backward compatible, but why we need to upgrade many libraries when we upgrade jdk from 1.6 to 1.8?

查看:1177
本文介绍了Java是向后兼容的,但是当我们将jdk从1.6升级到1.8时,为什么我们需要升级许多库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我们在一个Java项目中将Jdk版本从 1.6 升级到 1.8 。但是有一些编译或运行时错误,所以我必须升级一些库:

Recently, we upgrade the Jdk version from 1.6 to 1.8 in one of my Java project. But there are some compilation or runtime errors, so I have to upgrade some libraries:


  • gradle: 1.9 1.10

  • spring: 3.x to 4.x

  • gradle: 1.9 to 1.10
  • spring: 3.x to 4.x

因为他们使用的是早期版本的ASM,但它只支持jdk 1.8来自 5.x

That because they are using some early versions of ASM, but which supports jdk 1.8 only from 5.x

Java表示它是向后兼容的,但为什么原始版本库不能直接使用jdk 1.8吗?

Java said it is backward compatible, but why the original versions of libraries can't work with jdk 1.8 directly?

推荐答案

因为 ASM 是一个使用Java字节码操作的工具。字节码格式改为引入新功能。因此,您必须升级该工具以支持新的字节码。

Because ASM is a tool that operates on the Java byte-code. And the byte-code format changed to introduce new features. As such, you had to upgrade the tool to support the new byte-code.

注意,使用较旧版本的JDK编译的软件不会始终使用较新版本的Java。例如, enum 在早期版本的JDK中不是关键字。

Note, that software compiled with an older version of the JDK does not always work with newer versions of Java. For example, enum was not a keyword in early versions of the JDK.

这篇关于Java是向后兼容的,但是当我们将jdk从1.6升级到1.8时,为什么我们需要升级许多库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆