简体   繁体   English

为什么 ThreadLocal 或 AnnotationProcessor 没有在 Java 规范中定义?

[英]Why isnt ThreadLocal or AnnotationProcessor not defined in Java specification?

For a long time, I have been an application developer in java.很长一段时间以来,我一直是一名 Java 应用程序开发人员。 Recently, Java and JVM specification piqued my interest.最近,Java 和 JVM 规范引起了我的兴趣。 I wanted to know more about some of the internals of java on topics that eluded me for a long time.我想更多地了解 Java 的一些内部原理,这些内容是我很长时间以来一直未能解决的主题。

I tried searching for ThreadLocal or Annotation Processors in those documents and I couldnt find them.我尝试在这些文档中搜索 ThreadLocal 或 Annotation Processors,但找不到它们。 Is there a reason behind dearth of information regarding them?缺乏有关它们的信息背后是否有原因? I thought Threadlocal atleast was part of Java packages?我认为 Threadlocal 至少是 Java 包的一部分?

Are specifications not encyclopedias that I imagined them to be?规范不是我想象的百科全书吗? They are fairly huge documents, so I might have missed them completely它们是相当大的文件,所以我可能完全错过了它们

https://docs.oracle.com/javase/specs/jvms/se8/jvms8.pdf https://docs.oracle.com/javase/specs/jls/se8/jls8.pdf https://docs.oracle.com/javase/specs/jvms/se8/jvms8.pdf https://docs.oracle.com/javase/specs/jls/se8/jls8.pdf

Why aren't ThreadLocal or AnnotationProcessor defined in the Java Language Specification (JLS)?为什么 Java 语言规范 (JLS) 中没有定义ThreadLocalAnnotationProcessor

Because they are specified somewhere else.因为它们是在其他地方指定的。


The specification for ThreadLocal is in the javadocs: ThreadLocal的规范在 javadocs 中:

The specifications for annotation processors are also in the javadocs.注释处理器的规范也在 javadocs 中。 Start here:从这里开始:

In general, the JLS only specifies the Java programming language itself.通常,JLS 仅指定 Java 编程语言本身。 Other aspects of the Java environment such as the Java class libraries, the JVM specifications, the Java tool specifications, and many other things are specified (or described) in various technical notes, white papers and JSRs or JEPs. Java 环境的其他方面(例如 Java 类库、JVM 规范、Java 工具规范以及许多其他内容)在各种技术说明、白皮书和 JSR 或 JEP 中指定(或描述)。

In general, all of this information is on the public web, and can be found using Google and intelligently chosen search terms.一般来说,所有这些信息都在公共网络上,可以使用 Google 和智能选择的搜索词找到。 For example, I got the javadocs of ThreadLocal in Java 11 by Googling for javadoc ThreadLocal java 11 .例如,我通过谷歌搜索javadoc ThreadLocal java 11获得了 Java 11 中ThreadLocaljavadoc ThreadLocal java 11

However, if you are looking for internal documentation (eg some design document that explains how ThreadLocal is implemented) you are unlikely to find anything ... beyond the OpenJDK source code itself.然而,如果您正在寻找内部文档(例如一些解释如何实现ThreadLocal设计文档),您不太可能找到任何东西......超出 OpenJDK 源代码本身。 But the source code is freely available and (generally speaking) well commented.但是源代码是免费提供的,并且(一般来说)得到了很好的评论。 Google for the version you are looking for;谷歌搜索您正在寻找的版本; eg openjdk source code java 11 .例如openjdk source code java 11

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

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