Can @Stable (or something similar) be made accessible?
shade at redhat.com
Fri Jan 12 10:37:37 UTC 2018
On 01/12/2018 05:33 AM, Jason Greene wrote:
> MethodHandle.invokeExact() can match the performance of direct invocation, but it requires
> constant folding to do so. Otherwise results are similar to Java reflection(e.g ).
> While TrustFinalNonStaticFields can be used, it’s a sledgehammer where a scalpel is really be
> more appropriate.
So, the easier way out would be enable TrustFinalNonStaticFields to be used with finer-grained
control, that JEP 165 (Compiler Control) provides. Then you can tell which user-side
classes/packages are safe for trusting, and which are not. IIRC, the reason why
TrustFinalNonStaticFields is not on by default is because we cannot rely that everyone is not
writing to final fields and expecting update to be visible.
...which makes this one partially go away:
> It seems odd that the much more aggressive facility (TrustFinalNonStaticFields) is simpler to
> use than a more targeted one.
More information about the core-libs-dev