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

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

问题描述

任何人都可以告诉我JDK7 / 8仍然可以使用 jsr14 目标选项 javac 吗?



说,

  $ javac -source 1.5 -target jsr14 Hello.java 


解决方案

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



不幸的是,前线的人往往很少考虑那些不能更新到最新版本的人而且最伟大的。猜猜Oracle真的不再关心嵌入式市场了。



我们现在可能需要运送两个JAR,一个用于嵌入式,一个用于JDK 7.很简单。 / p>

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


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

Say,

$ javac -source 1.5 -target jsr14 Hello.java

解决方案

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.

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

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天全站免登陆