- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
官方只有一个Java Language Specification并且所有 Java 实现都必须遵守它。
API 文档如何:是否所有 Java 实现都需要遵守 this version或者一个实现是否可以以不同的方式定义某些方法和类的行为,只要它与 JLS 兼容?
让我们举一个具体的例子:Java 实现是否可以包含一个不接受 null
元素的 HashMap
?
最佳答案
我相信,是的。
经过仔细检查,我认为不是。
正如 JLS 8 在 p.1.4 中所述:
1.4. Relationship to Predefined Classes and Interfaces
As noted above, this specification often refers to classes of the Java SE platform API. In particular, some classes have a special relationship with the Java programming language. Examples include classes such as Object, Class, ClassLoader, String, Thread, and the classes and interfaces in package java.lang.reflect, among others. This specification constrains the behavior of such classes and interfaces, but does not provide a complete specification for them. The reader is referred to the Java SE platform API documentation.
一方面,他们声明 JLS 文档没有提供完整的规范,并将读者发送到 Java SE 平台 API 文档。
另一方面,当提到 Java SE 的一些 API(复数形式)时,JLS 中有不同的地方。此外,JLS 似乎不包含指向特定 Java SE API 规范的链接:
Some APIs of the Java SE platform, primarily in the Character class, use 32-bit integers to represent code points as individual entities. The Java SE platform provides methods to convert between 16-bit and 32-bit representations.
Character literals can only represent UTF-16 code units (§3.1), i.e., they are limited to values from \u0000 to \uffff. Supplementary characters must be represented either as a surrogate pair within a char sequence, or as an integer, depending on the API they are used with.
9.6.4. Predefined Annotation Types
Several annotation types are predefined in the libraries of the Java SE platform. Some of these predefined annotation types have special semantics. These semantics are specified in this section. This section does not provide a complete specification for the predefined annotations contained here in; that is the role of the appropriate API specifications. Only those semantics that require special behavior on the part of a Java compiler or Java Virtual Machine implementation are specified here.
关于java - JDK 文档是语言规范的一部分吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43629354/
我对第一个问题的直觉是肯定的。对于第二个问题,我在工作中确实看到,有人使用 JDK8 和 ANT,然后将用 JDK6 编写的旧包编译到 1.6。我真的很困惑。 最佳答案 一般来说,java 向后兼容所
据我所知,在windows中使用JDK有两种方式: 下载JDK安装文件并安装。 下载 JDK 二进制文件。 它们有什么区别? 最佳答案 优点:简单易行,突然间一切正常。 缺点:现在一切都使用新版本 -
我正在安装 HANA Studio,并且已下载 JDK 1.8 和 JDK 1.7。我将 JDK 1.8 用于 Eclipse 和我正在处理的其他一些事情,但是当我尝试通过 SAP HANA 生命周期
JDK 7 的哪些特性(不包括 invokedynamic,因为它不被 java 使用)导致新的类文件版本与 JDK 6 不兼容。似乎所有特性都可以通过编译器生成胶水代码来实现。例如 switch 语
在redhat机器上安装cloudera的库来创建cloudera集群是否必须使用Oracle JDK而不是Open JDK? 最佳答案 在撰写本文时,只有 Oracle JDK 版本经过认证可与 C
下面的语句在 Java 7 中有效吗? Timestamp.valueOf("0000-00-00 00:00:00.000000"); 因为使用 JDK 1.6 构建上述代码效果很好,但在使用 JD
更新 在整个评论中,结果证明我采用的基准测试方法是不正确的,因此结果具有误导性。纠正我的方法后(如已接受的答案),结果正如人们所期望的 - JDK 13 的性能与 JDK 11 一样好。有关更多详细信
我们很快就会从 jdk14 迁移到 jdk16。我们的是桌面应用程序。我需要采取什么措施来确保它在客户端机器上正常工作?现在他们中的一些人使用 JRE4 和一些 JRE6.Server-Solaris
我在/usr/lib/jvm 中有 jdk1.7.0 目录以及其他 open-jdk 版本。我希望我的 Ubuntu 12.04 将此 jdk(jdk1.7.0) 视为其主要 jdk,即我不想使用 o
我认为这可能与 Why does a generic cast of a List to List succeed on Sun JDK 6 but fail to compile on Oracle
代码使用 JDK 8 (1.8.0_212) 编译良好,但使用 JDK 11 (11.0.3) Oracle jdk 和 open jdk (aws corretto) 编译失败 尝试使用 javac
是否可以在 cygwin 上安装任何版本的 Sun JDK 或 Open JDK。 我寻找此选项的原因是:有许多工具(例如 jStack、jMap)在 JDK 的 unix 版本中可用,但在 wind
请确认以上说法? 当他们提到 JDK 时,我需要知道他们指的是什么。 最佳答案 Java Development Kit 是我们通常指的一组创建 Java 应用程序的工具,包括 Java Compil
使用 java -version 给我这个。 java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
这个问题在这里已经有了答案: JAVA_HOME should point to a JDK not a JRE (25 个答案) 关闭 4 年前。 您好,感谢您提供的任何帮助。 我刚刚升级到 Ub
没错,自阿里、腾讯之后,华为也终于开源了自家的 JDK——毕昇 JDK! 免费!免费!免费!!! Oracle 要慌了? 毕昇 JDK 毕昇 JDK 是华为内部 OpenJDK 定制版 Hu
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭去年。 Improve this quest
将 Arquillian 添加到 Maven 构建时,我在 Eclipse 中遇到上述异常: Missing artifact sun.jdk:jconsole:jar:jdk
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 5 年前。 Improve this ques
我正在尝试创建一个 pom,它将: 使用 maven-toolchains-plugin 中的正确 JDK基于 java.version 属性。 根据 maven-toolchains-plugin
我是一名优秀的程序员,十分优秀!