简体   繁体   English

在使用与OpenJDK 1.8不同的JDK的Eclipse项目中使用OpenJML

[英]Use OpenJML in Eclipse project that uses JDK different from OpenJDK 1.8

OpenJML is available as Eclipse Plugin (install site http://jmlspecs.sourceforge.net/openjml-updatesite ) and it seems to get installed OK in Eclipse Photon. OpenJML可以作为Eclipse插件(安装站点http://jmlspecs.sourceforge.net/openjml-updatesite )获得,并且似乎可以在Eclipse Photon中成功安装。

But docs say it shall run only on OpenJDK 1.8 and it cannot be any other JDK (say, Oracle JDK). 但是文档说它只能在OpenJDK 1.8上运行,不能是任何其他JDK(例如Oracle JDK)。 Also it cannot be (OpenJDK) version different than 1.8 (say 1.9). 另外,它(OpenJDK)的版本不能不同于1.8(例如1.9)。

My Projects in Eclipse all use (Oracle) JDK, besides soon we plan upgrading from JDK 1.8 to 1.9. 我在Eclipse中的项目都使用(Oracle)JDK,此外,我们计划不久从JDK 1.8升级到1.9。

Can I setup OpenJML so that it uses its wanted OpenJDK 1.8, while my project uses whatever it needs? 我可以设置OpenJML使其使用所需的OpenJDK 1.8,而我的项目则使用所需的东西吗?

OpenJML builds upon the OpenJDK 1.8 Compiler internally. OpenJML在内部基于OpenJDK 1.8编译器。 Of course, you can run OpenJML (with JRE 1.8) and the Java 9 compiler against the same Java sources (outside of eclipse; in a build tool), but OpenJML won't understand new language features (Modules, etc.) or API changes. 当然,您可以针对相同的Java源代码(eclipse之外;在构建工具中)运行OpenJML(带有JRE 1.8)和Java 9编译器,但是OpenJML无法理解新的语言功能(模块等)或API。变化。 So you need to stick with Java 1.8 API and features, hence besides of JVM improvements, you don't get any benefit of using Java 9. 因此,您需要坚持使用Java 1.8 API和功能,因此,除了改进JVM外,使用Java 9也没有任何好处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM