JDK 13 RFR of JDK-8219561: Update jdeprscan to avoid the need for start-of-release changes
Joe Darcy
joe.darcy at oracle.com
Mon Feb 25 22:42:29 UTC 2019
Hi Stuart,
Will push with suggested refactoring; thanks for the review,
-Joe
On 2/25/2019 10:40 AM, Stuart Marks wrote:
> Hi Joe,
>
> Thanks for cleaning up jdeprscan.
>
> For computing the set of releases, I'd prefer to see a stream that
> looks like this:
>
> final Set<String> releasesWithForRemoval =
> IntStream.rangeClosed(9, Runtime.version().feature())
> .mapToObj(Integer::toString)
> .collect(Collectors.toUnmodifiableSet());
>
> This collects the values directly to an unmodifiable set, instead of
> populating an array which is then passed to Set.of().
>
> Thanks,
>
> s'marks
>
> On 2/21/19 6:15 PM, Joe Darcy wrote:
>> Hello,
>>
>> Internally jdeprscan initializes a set of strings of releases
>> supporting deprecation with removal. Currently those releases are JDK
>> 9 and subsequent values. The lists is explicitly initialized and must
>> be updated at the start of a release, which adds to the maintenance
>> cost of starting a new release. The update for JDK 13 was:
>>
>> --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
>> Thu Dec 13 17:01:15 2018 +0100
>> +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
>> Thu Dec 13 19:06:11 2018 +0100
>> @@ -106,7 +106,7 @@
>> // Keep these updated manually until there's a compiler API
>> // that allows querying of supported releases.
>> final Set<String> releasesWithoutForRemoval = Set.of("6", "7",
>> "8");
>> - final Set<String> releasesWithForRemoval = Set.of("9", "10",
>> "11", "12");
>> + final Set<String> releasesWithForRemoval = Set.of("9", "10",
>> "11", "12", "13");
>>
>> final Set<String> validReleases;
>> {
>>
>>
>> Initializing the list more programmatically could avoid the need for
>> an explicit update for the start of a release. Please review the
>> patch below for the programmatic initialization:
>>
>> --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
>> Thu Feb 21 15:17:42 2019 -0800
>> +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
>> Thu Feb 21 18:01:59 2019 -0800
>> @@ -45,6 +45,7 @@
>> import java.util.NoSuchElementException;
>> import java.util.Set;
>> import java.util.Queue;
>> +import java.util.stream.IntStream;
>> import java.util.stream.Stream;
>> import java.util.stream.StreamSupport;
>> import java.util.jar.JarEntry;
>> @@ -106,7 +107,12 @@
>> // Keep these updated manually until there's a compiler API
>> // that allows querying of supported releases.
>> final Set<String> releasesWithoutForRemoval = Set.of("6", "7",
>> "8");
>> - final Set<String> releasesWithForRemoval = Set.of("9", "10",
>> "11", "12", "13");
>> + // Set.of("9", "10", "11", "12", "13");
>> + final Set<String> releasesWithForRemoval = Set.of(// "9", "10",
>> "11", ...
>> + IntStream.rangeClosed(9, Runtime.version().feature())
>> + .mapToObj(Integer::toString)
>> + .toArray(String[]::new));
>> +
>>
>> final Set<String> validReleases;
>> {
>>
>> Thanks,
>>
>> -Joe
>>
More information about the core-libs-dev
mailing list