JDK 13 RFR of JDK-8219561: Update jdeprscan to avoid the need for start-of-release changes

Joe Darcy joe.darcy at oracle.com
Fri Feb 22 02:15:10 UTC 2019


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