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

8267578: Remove unnecessary preview checks #4157

Closed
wants to merge 1 commit into from

Conversation

@lgxbslgx
Copy link
Member

@lgxbslgx lgxbslgx commented May 23, 2021

Hi all,

The following preview checks are unnecessary because they are standard features now.

Attr.java

        allowReifiableTypesInInstanceof =
                Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source) &&
                (!preview.isPreview(Feature.REIFIABLE_TYPES_INSTANCEOF) || preview.isEnabled());

JavacParser.java

        this.allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
                Feature.SWITCH_EXPRESSION.allowedInSource(source);

Resolve.java

        allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
                Feature.SWITCH_EXPRESSION.allowedInSource(source);

It is good to remove them.
Thanks for review.

Best Regards,
-- Guoxiong


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4157/head:pull/4157
$ git checkout pull/4157

Update a local copy of the PR:
$ git checkout pull/4157
$ git pull https://git.openjdk.java.net/jdk pull/4157/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4157

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4157.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented May 23, 2021

👋 Welcome back gli! 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.

Loading

@openjdk openjdk bot added the rfr label May 23, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 23, 2021

@lgxbslgx The following label will be automatically applied to this pull request:

  • compiler

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

Loading

@openjdk openjdk bot added the compiler label May 23, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 23, 2021

Webrevs

Loading

@JimLaskey
Copy link
Member

@JimLaskey JimLaskey commented May 23, 2021

These checks need to remain to allow the Javac compiler to generate code for earlier releases. Please close.

Loading

Copy link
Member

@JimLaskey JimLaskey left a comment

These checks need to remain to allow the Javac compiler to generate code for earlier releases. Please close.

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented May 23, 2021

Mailing list message from Jonathan Gibbons on compiler-dev:

Guoxiong,

To be clear, it is an overall requirement that in order to bootstrap-compile the JDK, we must be able to compile javac with the previously available release. Given the short interval between releases, this sometimes evaluates to a numerically 2-earlier release. For example, after we open up the repos for JDK 18 next month, JDK 17 will not be available until September, so we still need to compile javac with JDK 16 until then.

-- Jon

Loading

1 similar comment
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 23, 2021

Mailing list message from Jonathan Gibbons on compiler-dev:

Guoxiong,

To be clear, it is an overall requirement that in order to bootstrap-compile the JDK, we must be able to compile javac with the previously available release. Given the short interval between releases, this sometimes evaluates to a numerically 2-earlier release. For example, after we open up the repos for JDK 18 next month, JDK 17 will not be available until September, so we still need to compile javac with JDK 16 until then.

-- Jon

Loading

Copy link
Contributor

@lahodaj lahodaj left a comment

Looks good to me.

@JimLaskey - please note that javac does not support preview features from previous versions (as per JEP 12). So once a feature is made final, it is safe to remove the preview checks, AFAIK, it just was not done for these few cases.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented May 24, 2021

@lgxbslgx 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:

8267578: Remove unnecessary preview checks

Reviewed-by: 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 1 new commit pushed to the master branch:

  • 3113910: 8267553: Extra JavaThread assignment in ClassLoader::create_class_path_entry()

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@JimLaskey, @lahodaj) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

Loading

@openjdk openjdk bot added the ready label May 24, 2021
@lgxbslgx
Copy link
Member Author

@lgxbslgx lgxbslgx commented May 24, 2021

@JimLaskey @jonathan-gibbons @lahodaj Thanks for your comments and reviews.

This patch only cleans up the preview checks instead of something about releases.

The similar cleanup codes are common when we implement the standard feature. Please see the following two cases.

  1. 8260517: implement Sealed Classes as a standard feature in Java
-        this.allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
-                Feature.SEALED_CLASSES.allowedInSource(source);
+        this.allowSealedTypes = Feature.SEALED_CLASSES.allowedInSource(source);
  1. 8255013: implement Record Classes as a standard feature in Java, follow-up
-        this.allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
-                Feature.RECORDS.allowedInSource(source);
+        this.allowRecords = Feature.RECORDS.allowedInSource(source);

We can consider that the codes of this patch were forgotten to cleanup during previous standard features.

Loading

@JimLaskey
Copy link
Member

@JimLaskey JimLaskey commented May 24, 2021

Apologies. I misread the nature of the change.

Loading

@lgxbslgx
Copy link
Member Author

@lgxbslgx lgxbslgx commented May 24, 2021

/integrate

Loading

@openjdk openjdk bot added the sponsor label May 24, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 24, 2021

@lgxbslgx
Your change (at version 3a6238d) is now ready to be sponsored by a Committer.

Loading

@lahodaj
Copy link
Contributor

@lahodaj lahodaj commented May 24, 2021

/sponsor

Loading

@openjdk
Copy link

@openjdk openjdk bot commented May 24, 2021

@lahodaj @lgxbslgx Since your change was applied there have been 3 commits pushed to the master branch:

  • 49f622c: 8208747: [a11y] [macos] In Optionpane Demo, inside ComponentDialog Example, unable to navigate to all items, with VO on
  • 54520fb: 8267580: The method JavacParser#peekToken is wrong when the first parameter is not zero
  • 3113910: 8267553: Extra JavaThread assignment in ClassLoader::create_class_path_entry()

Your commit was automatically rebased without conflicts.

Pushed as commit f453166.

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

Loading

@lgxbslgx lgxbslgx deleted the JDK-8267578 branch May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants