Re: RFR: 8287186: JDK modules participating in preview [v2]

2022-06-14 Thread Paul Sandoz
On Wed, 8 Jun 2022 22:07:38 GMT, liach  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


Re: RFR: 8287186: JDK modules participating in preview [v3]

2022-06-13 Thread Paul Sandoz
> Allow JDK modules that use preview features (preview language features or 
> preview API features from dependent modules) to participate without the need 
> to compile with `--enable-preview`.
> 
> It's difficult to enable participation using an annotation due to the nature 
> in which symbols are encountered when processing source as there is no 
> guaranteed order to the processing of certain symbols.
> 
> Instead a JDK module participates if the `java.base` package 
> `jdk.internal.javac` is exported to that module (@lahodaj clever idea!). An 
> internal annotation `jdk.internal.javac.ParticipatesInPreview` can be 
> declared on the module. Such a declaration cannot be enforced but does by its 
> use require the `jdk.internal.javac`'s export list to be updated.
> 
> The modules `jdk.incubator.vector` and `jdk.incubator.concurrent` have been 
> updated accordingly, both of which participate in preview APIs (APIs in 
> `java.lang.foreign` and `Thread.ofVirtual`, respectively).

Paul Sandoz has updated the pull request with a new target base due to a merge 
or a rebase. The incremental webrev excludes the unrelated changes brought in 
by the merge/rebase. The pull request contains four additional commits since 
the last revision:

 - Merge remote-tracking branch 'upstream/master' into 
JDK-8287186-preview-participating
 - Let java.management participate in preview features.
 - Unused import.
 - Generalize the pariticipating in preview APIs.

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/9087/files
  - new: https://git.openjdk.org/jdk/pull/9087/files/9defdf23..abd1fbf6

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9087=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9087=01-02

  Stats: 17219 lines in 554 files changed: 13408 ins; 1651 del; 2160 mod
  Patch: https://git.openjdk.org/jdk/pull/9087.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9087/head:pull/9087

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


Re: RFR: 8287186: JDK modules participating in preview [v2]

2022-06-08 Thread liach
On Wed, 8 Jun 2022 18:24:35 GMT, Paul Sandoz  wrote:

>> Allow JDK modules that use preview features (preview language features or 
>> preview API features from dependent modules) to participate without the need 
>> to compile with `--enable-preview`.
>> 
>> It's difficult to enable participation using an annotation due to the nature 
>> in which symbols are encountered when processing source as there is no 
>> guaranteed order to the processing of certain symbols.
>> 
>> Instead a JDK module participates if the `java.base` package 
>> `jdk.internal.javac` is exported to that module (@lahodaj clever idea!). An 
>> internal annotation `jdk.internal.javac.ParticipatesInPreview` can be 
>> declared on the module. Such a declaration cannot be enforced but does by 
>> its use require the `jdk.internal.javac`'s export list to be updated.
>> 
>> The modules `jdk.incubator.vector` and `jdk.incubator.concurrent` have been 
>> updated accordingly, both of which participate in preview APIs (APIs in 
>> `java.lang.foreign` and `Thread.ofVirtual`, respectively).
>
> 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`?

-

PR: https://git.openjdk.java.net/jdk/pull/9087


Re: RFR: 8287186: JDK modules participating in preview [v2]

2022-06-08 Thread Jan Lahoda
On Wed, 8 Jun 2022 18:24:35 GMT, Paul Sandoz  wrote:

>> Allow JDK modules that use preview features (preview language features or 
>> preview API features from dependent modules) to participate without the need 
>> to compile with `--enable-preview`.
>> 
>> It's difficult to enable participation using an annotation due to the nature 
>> in which symbols are encountered when processing source as there is no 
>> guaranteed order to the processing of certain symbols.
>> 
>> Instead a JDK module participates if the `java.base` package 
>> `jdk.internal.javac` is exported to that module (@lahodaj clever idea!). An 
>> internal annotation `jdk.internal.javac.ParticipatesInPreview` can be 
>> declared on the module. Such a declaration cannot be enforced but does by 
>> its use require the `jdk.internal.javac`'s export list to be updated.
>> 
>> The modules `jdk.incubator.vector` and `jdk.incubator.concurrent` have been 
>> updated accordingly, both of which participate in preview APIs (APIs in 
>> `java.lang.foreign` and `Thread.ofVirtual`, respectively).
>
> Paul Sandoz has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Let java.management participate in preview features.

javac + `jdk.internal.javac` changes look good to me.

-

Marked as reviewed by jlahoda (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/9087


Re: RFR: 8287186: JDK modules participating in preview [v2]

2022-06-08 Thread Alan Bateman
On Wed, 8 Jun 2022 18:24:35 GMT, Paul Sandoz  wrote:

>> Allow JDK modules that use preview features (preview language features or 
>> preview API features from dependent modules) to participate without the need 
>> to compile with `--enable-preview`.
>> 
>> It's difficult to enable participation using an annotation due to the nature 
>> in which symbols are encountered when processing source as there is no 
>> guaranteed order to the processing of certain symbols.
>> 
>> Instead a JDK module participates if the `java.base` package 
>> `jdk.internal.javac` is exported to that module (@lahodaj clever idea!). An 
>> internal annotation `jdk.internal.javac.ParticipatesInPreview` can be 
>> declared on the module. Such a declaration cannot be enforced but does by 
>> its use require the `jdk.internal.javac`'s export list to be updated.
>> 
>> The modules `jdk.incubator.vector` and `jdk.incubator.concurrent` have been 
>> updated accordingly, both of which participate in preview APIs (APIs in 
>> `java.lang.foreign` and `Thread.ofVirtual`, respectively).
>
> Paul Sandoz has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Let java.management participate in preview features.

The updates to java.base, java.management, and jdk.incubator.* looks fine, it's 
good to have the reflection code go away.

-

Marked as reviewed by alanb (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/9087


Re: RFR: 8287186: JDK modules participating in preview

2022-06-08 Thread Paul Sandoz
On Wed, 8 Jun 2022 17:21:08 GMT, Alan Bateman  wrote:

> Can java.management participate too? It would allow 
> sun.management.Util.isVirtual(Thread) to go away (lots of methods in 
> sun.management.ThreadImpl need to test if a thread is virtual).

Pushed update.

-

PR: https://git.openjdk.java.net/jdk/pull/9087


Re: RFR: 8287186: JDK modules participating in preview [v2]

2022-06-08 Thread Paul Sandoz
> Allow JDK modules that use preview features (preview language features or 
> preview API features from dependent modules) to participate without the need 
> to compile with `--enable-preview`.
> 
> It's difficult to enable participation using an annotation due to the nature 
> in which symbols are encountered when processing source as there is no 
> guaranteed order to the processing of certain symbols.
> 
> Instead a JDK module participates if the `java.base` package 
> `jdk.internal.javac` is exported to that module (@lahodaj clever idea!). An 
> internal annotation `jdk.internal.javac.ParticipatesInPreview` can be 
> declared on the module. Such a declaration cannot be enforced but does by its 
> use require the `jdk.internal.javac`'s export list to be updated.
> 
> The modules `jdk.incubator.vector` and `jdk.incubator.concurrent` have been 
> updated accordingly, both of which participate in preview APIs (APIs in 
> `java.lang.foreign` and `Thread.ofVirtual`, respectively).

Paul Sandoz has updated the pull request incrementally with one additional 
commit since the last revision:

  Let java.management participate in preview features.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9087/files
  - new: https://git.openjdk.java.net/jdk/pull/9087/files/5e7ca855..9defdf23

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9087=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9087=00-01

  Stats: 44 lines in 5 files changed: 4 ins; 29 del; 11 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9087.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9087/head:pull/9087

PR: https://git.openjdk.java.net/jdk/pull/9087


Re: RFR: 8287186: JDK modules participating in preview

2022-06-08 Thread Alan Bateman
On Wed, 8 Jun 2022 15:46:24 GMT, Paul Sandoz  wrote:

> Allow JDK modules that use preview features (preview language features or 
> preview API features from dependent modules) to participate without the need 
> to compile with `--enable-preview`.
> 
> It's difficult to enable participation using an annotation due to the nature 
> in which symbols are encountered when processing source as there is no 
> guaranteed order to the processing of certain symbols.
> 
> Instead a JDK module participates if the `java.base` package 
> `jdk.internal.javac` is exported to that module (@lahodaj clever idea!). An 
> internal annotation `jdk.internal.javac.ParticipatesInPreview` can be 
> declared on the module. Such a declaration cannot be enforced but does by its 
> use require the `jdk.internal.javac`'s export list to be updated.
> 
> The modules `jdk.incubator.vector` and `jdk.incubator.concurrent` have been 
> updated accordingly, both of which participate in preview APIs (APIs in 
> `java.lang.foreign` and `Thread.ofVirtual`, respectively).

Can java.management participate too? It would allow 
sun.management.Util.isVirtual(Thread) to go away (lots of methods in 
sun.management.ThreadImpl need to test if a thread is virtual).

-

PR: https://git.openjdk.java.net/jdk/pull/9087


RFR: 8287186: JDK modules participating in preview

2022-06-08 Thread Paul Sandoz
Allow JDK modules that use preview features (preview language features or 
preview API features from dependent modules) to participate without the need to 
compile with `--enable-preview`.

It's difficult to enable participation using an annotation due to the nature in 
which symbols are encountered when processing source as there is no guaranteed 
order to the processing of certain symbols.

Instead a JDK module participates if the `java.base` package 
`jdk.internal.javac` is exported to that module (@lahodaj clever idea!). An 
internal annotation `jdk.internal.javac.ParticipatesInPreview` can be declared 
on the module. Such a declaration cannot be enforced but does by its use 
require the `jdk.internal.javac`'s export list to be updated.

The modules `jdk.incubator.vector` and `jdk.incubator.concurrent` have been 
updated accordingly, both of which participate in preview APIs (APIs in 
`java.lang.foreign` and `Thread.ofVirtual`, respectively).

-

Commit messages:
 - Unused import.
 - Generalize the pariticipating in preview APIs.

Changes: https://git.openjdk.java.net/jdk/pull/9087/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=9087=00
  Issue: https://bugs.openjdk.org/browse/JDK-8287186
  Stats: 98 lines in 7 files changed: 62 ins; 28 del; 8 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9087.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9087/head:pull/9087

PR: https://git.openjdk.java.net/jdk/pull/9087