将 Java 代码从 1.8 向后移植到 1.5 是否存在 security/performance 问题?

Are there security/performance issues with backporting Java code from 1.8 to 1.5?

我知道较旧的 JVM 可能存在 security/performance 问题,但我的问题与 JVM 本身无关。是否可以将 security/performance 问题引入为 Java 1.8 编写但后来由于转换过程本身而反向移植到 1.5 的代码?

我没有发现太多人讨论这个问题,但是我确实在 Java 8 lambda 向后移植工具的作者的博客中找到了一些评论,他猜测 backporting Lambda expressions may actually increase performance slightly

Here 您可以找到比较 JVM 1.6 与 7 和 8 的基准测试。我在这里摘录:

My observations:

On the biggest dataset (Machine Reassignment B10), which dwarfs any of the other datasets in size, Java 8 is 20% faster than Java 7, which was already 17% faster than Java 6.

In some cases, Java 8 is slower than Java 7. Specially for the course scheduling datasets, Java 8 is 6% slower than Java 7. Hopefully new releases of Java 8 will resolve this performance regression soon.

On average, Java 8 is only 1% faster than Java 7. This while Java 7 is already 16% faster than Java 6.

Despite that this is the first final release of OpenJDK 8, I did not find any regressions in Java 8. OptaPlanner’s examples are 100% reproducible, so as expected, the different JRE’s give the exact same results at every single iteration.

看起来 java 8 比 6 快一点,我只能假设 java 1.5 比 java 6 慢。

关于你的安全问题,我不知道。我从未使用过 java EE 或 spring,或任何其他需要安全性的东西。