RFR: 8345836: stable annotation documentation is incomplete

Chen Liang liach at openjdk.org
Tue Dec 10 16:25:56 UTC 2024


On Mon, 9 Dec 2024 23:53:31 GMT, John R Rose <jrose at openjdk.org> wrote:

> The javadoc for jdk.internal.vm.annotation.Stable is incomplete.
> 
> The existing documentation gives an over-simple user model,
> and does not explain how it is implemented.
> Proposed new documentation will detail how the annotation
> is implemented, and how it may be used correctly.
> 
> The improved documentation will makes it easier for JDK programmers
> to use the annotation more aggressively, and more confidently.
> 
> This is a first cut.  Please comment…

src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java line 166:

> 164:  * After constant folding, the compiler can make use of may aspects of
> 165:  * the object: Its dynamic type, its length (if it is an array), and
> 166:  * the values of its fields (if they are themselves constants, either

I wonder if this includes object identity, or the object's identity hash code - for example, published MethodType objects are all identity-based, and using their identity hash should be better than using their nominal hash code.

-------------

PR Review Comment: https://git.openjdk.org/leyden/pull/26#discussion_r1878410313


More information about the leyden-dev mailing list