java编译器的目标版本“jsr14"使用 JDK7/8 [英] java compiler's target version "jsr14" with JDK7/8

查看:24
本文介绍了java编译器的目标版本“jsr14"使用 JDK7/8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我 javacjsr14 目标选项在 JDK7/8 中仍然可用吗?

Can anybody tell me the jsr14 target option of javac will be still available with JDK7/8?

说,

$ javac -source 1.5 -target jsr14 Hello.java

推荐答案

我们在 OSGi 中大量使用 -jsr14,因为它允许我们在我们的 API 中使用泛型,但仍然部署在 1.4 环境中,这些环境在嵌入式中仍然很流行.不幸的是,他们使 JDK 7 不向后兼容 Java 6 和 5.Javac 1.7 忽略了 JAR 文件中实际存在的通用信息.幸运的是,运行时没有问题,因为无论如何都会忽略此信息.而且这并不是一些未记录的功能......

We are heavily using -jsr14 in OSGi because it allows us to use generics in our API but still deploy on 1.4 environments, which are still popular in embedded. Unfortunately, they made JDK 7 not backward compatible with Java 6 and 5. Javac 1.7 ignores the generic information that is actually present in the JAR files. There is fortunately no problem at run-time as this info is ignored anyway. And it is not as if this was some undocumented feature ...

不幸的是,在前面的人通常很少关心那些不能更新到最新和最伟大的人.猜猜甲骨文真的不再关心嵌入式市场了.

Unfortunately, people at the front often have very little regard for the people that cannot just update to the latest and the greatest. Guess Oracle really does not care about the embedded markets anymore.

我们现在可能需要发布两个 JAR,一个用于嵌入式,一个用于 JDK 7.糟透了.

We will likely now have to ship two JARs, one for the embedded and one for JDK 7. Sucks.

这是我们提交的错误报告:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7078419

This is the bug report we filed: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7078419

这篇关于java编译器的目标版本“jsr14"使用 JDK7/8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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