RFR: JDK-8275308: Add valueOf(Runtime.Version) factory to SourceVersion [v3]
Michael Bien
duke at openjdk.java.net
Sat Oct 23 04:09:07 UTC 2021
On Thu, 21 Oct 2021 23:58:45 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> 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 four additional commits since the last revision:
>>
>> - Add support for reverse conversion.
>> - Merge branch 'master' into JDK-8275308
>> - Fix typo.
>> - JDK-8275308: Add valueOf(Runtime.Version) factory to SourceVersio
>
> src/java.compiler/share/classes/javax/lang/model/SourceVersion.java line 525:
>
>> 523: if (feature > Runtime.version().feature()) {
>> 524: throw new IllegalArgumentException("No matching SourceVersion for " + rv);
>> 525: } else {
>
> Using `Runtime.version()` as a stand-in for the max `SourceVersion` seems non-obvious. Would it be better to use `SourceVersion.latest().runtimeVersion()` instead?
>
> What about when running this API on JDK N-1?
if could be potentially dropped since valueOf("RELEASE_" + feature) is throwing IAE already.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5973
More information about the compiler-dev
mailing list