Skip to content

Commit bca1a6d

Browse files
committed
Update to Java 18 / JDK 18: General Availability
Fixes #15
1 parent 16808e2 commit bca1a6d

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/ListOpenJavaDevelopmentKits.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@
3939
class ListOpenJavaDevelopmentKits {
4040

4141
/** Current General-Availability release number. */
42-
static final String GA = System.getProperty("GA", "17");
42+
static final String GA = System.getProperty("GA", "18");
43+
44+
/** Current Soon-Archived release number. */
45+
static final String SA = System.getProperty("SA", "17");
4346

4447
/** Early-Access Releases, as comma separated names. */
45-
static final String EA = System.getProperty("EA", "19,18,loom,metropolis,panama,valhalla");
48+
static final String EA = System.getProperty("EA", "19,loom,metropolis,panama,valhalla");
4649

4750
/** Include archived releases flag. */
4851
static final boolean ARCHIVES = Boolean.getBoolean("ARCHIVES");
@@ -66,6 +69,7 @@ class ListOpenJavaDevelopmentKits {
6669
public static void main(String... args) {
6770
if (args.length == 0) {
6871
listGeneralAvailabilityRelease();
72+
listSoonArchivedRelease();
6973
listEarlyAccessReleases();
7074
if (ARCHIVES) listArchivedReleases();
7175
} else {
@@ -94,6 +98,21 @@ static List<String> generateGeneralAvailabilityAliasKeys(String[] components) {
9498
return List.of(alias1, alias2);
9599
}
96100

101+
static void listSoonArchivedRelease() {
102+
var html = browse("https://jdk.java.net/" + SA + "/");
103+
var directs = parse(html);
104+
print("Soon-Archived Release", directs);
105+
106+
var aliases = alias(directs, ListOpenJavaDevelopmentKits::generateSoonArchivedAliasKeys);
107+
print("Soon-Archived Release (Alias)", aliases);
108+
}
109+
110+
static List<String> generateSoonArchivedAliasKeys(String[] components) {
111+
components[1] = "latest";
112+
var alias1 = String.join(",", components);
113+
return List.of(alias1);
114+
}
115+
97116
static void listEarlyAccessReleases() {
98117
var names = List.of(EA.split(","));
99118
if (names.isEmpty()) return;
@@ -140,6 +159,7 @@ static void listArchivedReleases() {
140159

141160
static List<String> generateArchivedAliasKeys(String[] components) {
142161
if (components[0].equals(GA)) return List.of(); // "latest" is covered by GA
162+
if (components[0].equals(SA)) return List.of(); // "latest" is covered by SA
143163
components[1] = "latest";
144164
var alias = String.join(",", components);
145165
return List.of(alias);

0 commit comments

Comments
 (0)