8387875: [lworld] Provide value-class-preview.md file#2633
Conversation
|
👋 Welcome back liach! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
| `/*value*/ record` in the hardcoded list of source files, and generate preview | ||
| source files where these occurrences are replaced by `value class` and | ||
| `value record`, respectively. | ||
|
|
There was a problem hiding this comment.
So, with the current system, consequently, any needed testing of "is preview enabled" must be done at runtime rather than via a compile-time macro?
(The other little code gen systems used in the JDK have a more expressive set of primitives. In my estimation, the simple system here is good for the purpose it is being used for, but it is helpful to document it here.)
There was a problem hiding this comment.
Yes. I don't understand how a compile-time macro can work - we have one runtime that must support both preview-on and preview-off runs.
There was a problem hiding this comment.
In the space of generate-different-source-code-from-a-template solutions, it would be possible to have code conditionally emitted for one case but not the other. The solution used for JEP 401 currently just uncomments the value modifier.
There was a problem hiding this comment.
We tried to use annotation processors and discovered that it just introduced unnecessary hassles and complexities beyond what is required for JEP 401. I have described the JEP 401 process here; we can tweak this document if we do tweak this pipeline in the future.
There was a problem hiding this comment.
I understand some of the history for the transitory use of annotation processors, but the readers of this document might have not that history (and might not care about it either ;-) ).
Given that the general shape of the solution is "we have generating preview-specific versions of source files which get compiled into preview-specific class files," the current mechanism we are choosing to do the generation has very limited functionality, which is sufficient for the purposes at hand. However, that mechanism is less capable than several analagous mechanisms elsewhere in the JDK build.
|
And once the text of the note if finalized, links to it in |
|
Thanks for taking this on, @liach! |
|
Updated. Please help proofread the latest version, thanks! |
|
After commentsI had some minor comments, and after addressing those I think this is ready from my point-of-view. I'll let @jddarcy decide if anything more is necessary. |
…/lw-value-migration
Webrevs
|
…/lw-value-migration
viktorklang-ora
left a comment
There was a problem hiding this comment.
This is LGTM after considering my latest comments.
…/lw-value-migration
| to value classes. This means that when preview features are enabled, different | ||
| class files are used for the migrated classes in the Java class library. | ||
|
|
||
| To accomplish this, the JDK uses *preview-specific* files in `META-INF/preview`, |
There was a problem hiding this comment.
To clarify,
"To accomplish this, a built JDK uses..."
That is, this section is discussing the artifact people run, not the source structure, etc.
|
Other than the small edit to the text, I think the only remaining task is to add cross references in non-javadoc comments in the affected files, the wrapper classes, etc. to this information. |
|
@dansmithcode Do you think a one liner in each of the migrated class like: would be the best way forward? Feel free to suggest exact wording too. |
…/lw-value-migration
This is some extremely basic overview about value class migrations.
Build: I intentionally skipped the streamlined build system installed by David Beaumont. Instead, I stressed the custom handling used by Value Objects JEP. (The "Preview Classes in Interim
javac" section might go to general documentation later.)Testing: I started from the motivations/goals and describe how those goals are accomplished.
Wrapper class caches: Some simple overview.
There are definitely more topics to cover; feel free to raise.
Paging @jddarcy and @viktorklang-ora for proofreading.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/2633/head:pull/2633$ git checkout pull/2633Update a local copy of the PR:
$ git checkout pull/2633$ git pull https://git.openjdk.org/valhalla.git pull/2633/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2633View PR using the GUI difftool:
$ git pr show -t 2633Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/2633.diff
Using Webrev
Link to Webrev Comment