On Wed, 8 Jun 2022 22:07:38 GMT, liach <d...@openjdk.java.net> wrote:

>> Paul Sandoz has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Let java.management participate in preview features.
>
> Just curious, is it still up to incubator modules' discretion to avoid 
> accidental user access to preview content via the modules without enabling 
> preview, like the `PreviewFeatures.ensureEnabled()` in `StructuredTaskScope`?

@liach it depends on the API and its scope. A constructor of 
`StructuredTaskScope` specifies that it implicitly uses a virtual thread 
factory, so it performs a preview runtime check. 

The same check is also performed by `Thread.ofVirtual`, ensuring developers 
cannot reflectively work around 
`--enable-preview` when creating virtual threads. This approach is feasible 
since the API surface is so small.

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

PR: https://git.openjdk.org/jdk/pull/9087

Reply via email to