Do JDK courses have other specifications besides Javadoc?

Do JDK courses have other specifications besides Javadoc? If so, where?

For example, refer to collections unmodifiableMap. Its Javadoc doesn't say anything about thread safety; So as long as I do it from Javadoc, I can't think it's safe to automatically map the obtained mapping to other threads without taking some special steps of my own to obtain thread safety However, IMHO, any actual implementation will store the internal mapping in a final field, so in Java 5 and later versions, as long as the internal mapping is (the "before" relationship between any access), the generated mapping will be a thread safe result map and any previous modification to the internal map) This is the implementation of openjdk

So how can I figure out if I can take on a given behavior?

Solution

Javadoc is a specification In other words, it is very difficult to write a good specification. The balance between the two will not miss anything useful, not too much (and undermine the ability to achieve in the future)

If I have to guess, I would say that the reason for this non-compliance (except for possible supervision) is that any thread safety is conditional, not that the underlying collection (a) is not published, (b) is not modified after creating an immutable view, which must also be specified carefully

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>