RFR: JDK-8275308: Add valueOf(Runtime.Version) factory to SourceVersion [v7]
Joe Darcy
darcy at openjdk.java.net
Thu Oct 28 22:09:53 UTC 2021
> I wanted to get input on the design of API of the method before writing the tests.
>
> The new factory method maps from a Runtime.Version object, a object which formally modes the version of the JDK, to a corresponding SourceVersion object.
>
> Given the current histories of versioning of the JDK and SourceVersion this amount to mapping "JDK N" to RELEASE_N, for example, JDK 17 to RELEASE_17, etc. As mentioned in the API note, this could potentially change in the future if the release model changes. Runtime.Version has added in JDK 9, but earlier versions can be modeled. Note that no attempt is made to map "1.2" to RELEASE_2 and that since Runtime.Version grammar does not allow a leading 0 term, RELEASE_0 will *not* be returned by the new method.
>
> Another design point: an out-of-range feature version is treated as an error so a Runtime.Version with a feature of 19 mapped in JDK 18 will fail with an IllegalArgumentException rather than saturating at RELEASE_18. If saturating would be more helpful for the envisioned use cases, I'm open to changing the spec accordingly.
>
> CSR to follow once the API is nailed down.
Joe Darcy 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 12 additional commits since the last revision:
- Adjust copyrights and add bug id to test.
- Merge branch 'master' into JDK-8275308
- Merge branch 'master' into JDK-8275308
- Add @since tags.
- Respond to review feedback.
- Appease jcheck.
- Initial test support.
- Merge branch 'master' into JDK-8275308
- Add support for reverse conversion.
- Merge branch 'master' into JDK-8275308
- ... and 2 more: https://git.openjdk.java.net/jdk/compare/1f0e7692...f33fa42b
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/5973/files
- new: https://git.openjdk.java.net/jdk/pull/5973/files/4517e54e..f33fa42b
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5973&range=06
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5973&range=05-06
Stats: 12283 lines in 368 files changed: 9506 ins; 1284 del; 1493 mod
Patch: https://git.openjdk.java.net/jdk/pull/5973.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5973/head:pull/5973
PR: https://git.openjdk.java.net/jdk/pull/5973
More information about the compiler-dev
mailing list