兼容的 Java 实现可以不包含所有标准库吗?

发布于 2024-10-27 09:58:12 字数 271 浏览 4 评论 0原文

我正在致力于用 JavaScript 编写 JVM 的实现,这意味着用 JavaScript 为标准库编写大量本机代码。然而,标准库中有大量的类仅由少数程序使用,并且尝试将需要本机实现的部分本地实现既乏味又没有多大回报。

实际上是否要求有效的 Java 实现包含所有标准库类的实现?或者我是否可以让核心 Java 库(例如 java.lang.* 及其引用的所有内容)工作,然后声称我有一个兼容的 Java 实现,该实现可能会为引用未实现功能的代码抛出VerifyErrors?

I'm working on writing an implementation of the JVM in JavaScript, which means writing a lot of native code for the standard libraries in JavaScript. However, there are a huge number of classes in the standard library that are used only by a small number of programs, and trying to get the parts that need a native implementation implemented natively is both tedious and not very rewarding.

Is there actually a requirement that a valid Java implementation contain implementations of all the standard library classes? Or could I just get the core Java libraries (say, java.lang.* and everything it references) working and then claim that I had a compliant Java implementation that might throw VerifyErrors for code that references unimplemented features?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七秒鱼° 2024-11-03 09:58:13

实际上,在通过合规性测试套件(Oracle 并未发布该测试套件)之前,您不能声称自己拥有符合该标准的 Java 实现。所以你最好忘记这一点。

所以基本上你可以支持任何你想要的东西,记住开发人员不太可能使用在功能上有任意差距的东西。将自己限制在标准 API 的众所周知的子集(例如 Java ME 配置文件)可能是个好主意。

Actually, you won't be allowed to claim you have a Java implementation compliant to the standard until it's passed the compliance test suite - which Oracle does not publish. So you might as well forget about that.

So basically you can support whatever you want, keeping in mind that developers are unlikely to use something that has arbitrary gaps in functionality. It might be a good idea to restrict yourself to a well-known subset of the Standard API like a Java ME profile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文