JDK 文档是语言规范的一部分吗?

Is the JDK documentation part of the language specification?

只有一个官方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 文档 没有提供完整的规范 并将 reader 发送到 Java SE平台 API 文档.

另一方面,当提到Java SE 的某些APIs(复数形式)时,JLS 中有不同的地方。此外,似乎 JLS 不包含指向特定 Java SE API 规范的链接:

3.1. Unicode

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.

3.10.4. Character Literals

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.