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?

查看:46
本文介绍了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.91.10
  • spring: 3.x4.x
  • gradle: 1.9 to 1.10
  • spring: 3.x to 4.x

那是因为他们使用的是 ASM 的一些早期版本,但仅从 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天全站免登陆