Can @Stable (or something similar) be made accessible?

Jason Greene jason.greene at redhat.com
Fri Jan 12 16:28:07 UTC 2018


> On Jan 12, 2018, at 6:50 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> 

-snip-

> So, the worst case scenario is: a value written into @Stable field/array  is never visible in some code no matter what you do. It can lead to nasty bugs when different parts of program don't agree on observed value. It can happen when user doesn't obey @Stable contract and performs multiple writes into a @Stable field/array. Current implementation in HotSpot doesn’t
> forbid that.
> 


This isn’t much different from the already allowed fine tuning of memory model effects (e.g., observing stale values from a plain write). In those scenarios, as is the case with @Stable, developers have to be aware of and honor the respective contract. It could be argued that bugs arising from contract violations of @Stable are easier to catch, due to their persistent nature.

-Jason


More information about the core-libs-dev mailing list