Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8287186: JDK modules participating in preview #9087

Closed

Conversation

PaulSandoz
Copy link
Member

@PaulSandoz PaulSandoz commented Jun 8, 2022

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).


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9087/head:pull/9087
$ git checkout pull/9087

Update a local copy of the PR:
$ git checkout pull/9087
$ git pull https://git.openjdk.org/jdk pull/9087/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9087

View PR using the GUI difftool:
$ git pr show -t 9087

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9087.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 8, 2022

👋 Welcome back psandoz! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 8, 2022
@openjdk
Copy link

openjdk bot commented Jun 8, 2022

@PaulSandoz The following labels will be automatically applied to this pull request:

  • compiler
  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added core-libs core-libs-dev@openjdk.org compiler compiler-dev@openjdk.org labels Jun 8, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 8, 2022

Webrevs

@AlanBateman
Copy link
Contributor

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).

@PaulSandoz
Copy link
Member Author

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.

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@openjdk
Copy link

openjdk bot commented Jun 8, 2022

@PaulSandoz This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8287186: JDK modules participating in preview

Reviewed-by: alanb, jlahoda

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 4 new commits pushed to the master branch:

  • 53a0ace: 8286101: Support formatting in @value tag
  • 8f400b9: 8286779: javax.crypto.CryptoPolicyParser#isConsistent always returns 'true'
  • e0baf01: 8287007: [cgroups] Consistently use stringStream throughout parsing code
  • 1769596: 8285263: Minor cleanup could be done in java.security

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 8, 2022
Copy link
Contributor

@lahodaj lahodaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@liach
Copy link
Member

liach commented Jun 8, 2022

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?

Obtaining the Symtab in Preview may be too earlier and result in
initialization errors when wiring up the module system.
@PaulSandoz
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 14, 2022

Going to push as commit fb29770.
Since your change was applied there have been 18 commits pushed to the master branch:

  • 0530f4e: 8288094: cleanup old _MSC_VER handling
  • 1a65332: 8287906: Rewrite of GitHub Actions (GHA) sanity tests
  • c2ccf4c: 8288003: log events for os::dll_unload
  • 03dca56: 8287525: Extend IR annotation with new options to test specific target feature.
  • 86c9241: 8287028: AArch64: [vectorapi] Backend implementation of VectorMask.fromLong with SVE2
  • fbe9266: 8288378: [BACKOUT] DST not applying properly with zone id offset set with TZ env variable
  • 1904353: Merge
  • 7aafc69: 8288105: [PPC64] Problems with -XX:+VerifyStack
  • f4b05a1: 8288173: JDK-8202449 fix causes conformance test failure : api/java_util/Random/RandomGenerator/NextFloat.html
  • d9c1364: 8288101: False build warning-as-error with GCC 9 after JDK-8214976
  • ... and 8 more: https://git.openjdk.org/jdk/compare/b97a4f6cdcd5e497ab901e68923666e493414825...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 14, 2022
@openjdk openjdk bot closed this Jun 14, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 14, 2022
@openjdk
Copy link

openjdk bot commented Jun 14, 2022

@PaulSandoz Pushed as commit fb29770.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@PaulSandoz
Copy link
Member Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler compiler-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
4 participants