8387484: [lworld] javac should warn on use of value classes#2601
8387484: [lworld] javac should warn on use of value classes#2601lahodaj wants to merge 2 commits into
Conversation
|
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
|
@lahodaj 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: 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 7 new commits pushed to the
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 (@mcimadamore, @liach, @vicente-romero-oracle) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
| */ | ||
| public boolean declaredUsingPreviewFeature(Symbol sym) { | ||
| return false; | ||
| return sym.isValueClass(); |
There was a problem hiding this comment.
Should this include records too given how its semantics are changed? Maybe in another RFE?
Webrevs
|
Consider source files like this:
When compiled like this:
Note that while the
TestValue.classis marked as preview, there's no warning on the use ofValueClass. This is not aligned with the JEP 12 wording:Currently javac marks the classfile preview using an explicit test in the
ClassWriter, but that does not seem quite right. This PR proposes to mark value classes asPreview.declaredUsingPreviewFeature == true, which should automatically produce a warning, and mark the appropriate classfile as preview.For the example above:
Note this will also report the warning for
Integer, when preview is enabled:Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/2601/head:pull/2601$ git checkout pull/2601Update a local copy of the PR:
$ git checkout pull/2601$ git pull https://git.openjdk.org/valhalla.git pull/2601/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2601View PR using the GUI difftool:
$ git pr show -t 2601Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/2601.diff
Using Webrev
Link to Webrev Comment