Add java8-to-25 module: legacy Java 8 app run on JDK 8, 17 and 25, tool coverage, JVM flags, libraries, OpenRewrite and the fixed version
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6vDJ5fWY5uEZaJFNi
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
build/
|
||||
target/
|
||||
@@ -0,0 +1,61 @@
|
||||
# java8-to-25
|
||||
|
||||
Companion code for the ankurm.com post **"Java 8 to Java 25 Migration Guide: The Long Jump in One Plan"**:
|
||||
<https://ankurm.com/java-8-to-java-25-migration-guide/>
|
||||
|
||||
A small Java 8 application that uses nine things that changed, run for real on JDK 8, 17 and 25.
|
||||
Everything quoted in the post comes from a file in [`output/`](output/).
|
||||
|
||||
## Tested against
|
||||
|
||||
| Thing | Version |
|
||||
|---|---|
|
||||
| JDK 8 | Temurin 1.8.0_514-b01 |
|
||||
| JDK 17 | Temurin 17.0.21.1+2 (middle point of a staged path) |
|
||||
| JDK 25 | Temurin 25.0.5.1+2 |
|
||||
| Maven / Gradle | 3.9.11 / 8.14.3 (the old-Gradle failure) |
|
||||
| JAXB / JAX-WS | jakarta.xml.bind-api 4.0.5, jaxb-runtime 4.0.9, jaxws-rt 4.0.5 (bridge: 2.3.3 / 2.3.9 / 2.3.7) |
|
||||
| Nashorn | nashorn-core 15.7 |
|
||||
| OpenRewrite | rewrite-maven-plugin 6.46.1, rewrite-migrate-java 3.42.1 |
|
||||
|
||||
Linux x86-64, `LANG=C` (so the JDK 8 default charset is US-ASCII; on a UTF-8 or Windows machine that line differs).
|
||||
|
||||
## Layout
|
||||
|
||||
| Path | What it is |
|
||||
|---|---|
|
||||
| `legacy/` | the Java 8 application (`javax.xml.bind`, JAX-WS, `sun.misc`, Nashorn, version parsing, `URLClassLoader` cast, reflection into `java.util`, Security Manager, `Thread.stop`) |
|
||||
| `bridge/` | jars that let the **unchanged** JDK 8 bytecode run on 25 |
|
||||
| `fixed/` | the same application fixed for Java 25 |
|
||||
| `flags/` | the JDK 8 era JVM options that are tried one by one |
|
||||
| `probes/` | TLS and keystore defaults, libraries (Lombok, Mockito, ASM, JaCoCo, Spring Boot 2.7), build tools, javax vs jakarta |
|
||||
| `scripts/` | one script per group of transcripts; `run-all.sh` runs them all |
|
||||
|
||||
## Run it
|
||||
|
||||
```bash
|
||||
export JDK8=/path/to/jdk8 JDK17=/path/to/jdk17 JDK25=/path/to/jdk25
|
||||
export GRADLE=/path/to/gradle # optional, for output/24
|
||||
./scripts/run-all.sh # needs Maven and Maven Central
|
||||
```
|
||||
|
||||
`MVN_SETTINGS` (a settings.xml) and `REPO` (a Maven repository base URL for the jar downloads) override Maven Central.
|
||||
`output/15` is the OpenRewrite diff; the script makes it on a throwaway copy in `build/`.
|
||||
Port 18099 must be free for the JAX-WS step. Object hash codes and log timestamps differ between runs.
|
||||
|
||||
## Output index
|
||||
|
||||
| File | Shows |
|
||||
|---|---|
|
||||
| 01 | JDK 8 `javac` without `-encoding` on a UTF-8 source |
|
||||
| 02, 03, 03b | the same classes run on 8, on 25, on 17 |
|
||||
| 04, 05 | compiling the sources with JDK 25, and the `--release 8` trap |
|
||||
| 06, 07, 08 | `jdeps --jdk-internals`, `jdeps -verbose:package`, `jdeprscan` |
|
||||
| 09 | JDK 8 JVM options on 8, 17 and 25 |
|
||||
| 10, 11, 12 | GC and heap defaults, TLS and keystore defaults, SHA-1 signed jar |
|
||||
| 13, 27 | unchanged bytecode on 25 with bridge jars and flags; the bridge jars on 8 |
|
||||
| 14 | the fixed application on 25 |
|
||||
| 15, 16, 17 | OpenRewrite `UpgradeToJava25`: diff, build failure, run after one hand edit |
|
||||
| 18 to 22 | Lombok, Mockito, ASM, JaCoCo, Spring Boot 2.7.18 on 25 |
|
||||
| 23, 24 | old Maven compiler levels; Gradle 8.14.3 on 25 |
|
||||
| 25, 26 | `javax` packages left in JDK 25; mixing `javax` annotations with the `jakarta` JAXB runtime |
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ankurm</groupId>
|
||||
<artifactId>bridge-classpath</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!-- Jars that give OLD javax.* bytecode what the JDK used to contain.
|
||||
The 2.3.x "jakarta.*-api" artifacts still use javax.* package names. -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.ws</groupId>
|
||||
<artifactId>jaxws-rt</artifactId>
|
||||
<version>2.3.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.nashorn</groupId>
|
||||
<artifactId>nashorn-core</artifactId>
|
||||
<version>15.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ankurm</groupId>
|
||||
<artifactId>fixed-app</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.release>25</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- JAXB: API plus an implementation. Both left the JDK in Java 11. -->
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>4.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>4.0.9</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- JAX-WS: jaxws-rt brings the API (jakarta.xml.ws, jakarta.jws) and the runtime. -->
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.ws</groupId>
|
||||
<artifactId>jaxws-rt</artifactId>
|
||||
<version>4.0.5</version>
|
||||
</dependency>
|
||||
<!-- Nashorn, now a standalone OpenJDK project. -->
|
||||
<dependency>
|
||||
<groupId>org.openjdk.nashorn</groupId>
|
||||
<artifactId>nashorn-core</artifactId>
|
||||
<version>15.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.16.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/** Same steps as the legacy App, fixed for Java 25. */
|
||||
public final class App {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("running on java.version " + System.getProperty("java.version"));
|
||||
step("jaxb", () -> OrderXml.toXml(new Order("A-1", 12)));
|
||||
step("jaxws", SoapCheck::publishAndReadWsdl);
|
||||
step("base64", () -> Tokens.encode("ankur".getBytes("UTF-8")));
|
||||
step("nashorn", () -> Rules.discount(12));
|
||||
step("version", () -> "major=" + JavaVersion.major());
|
||||
step("classloader", () -> "classpath found=" + PluginScanner.classpathEntries());
|
||||
step("reflection", () -> "list size=" + Peek.sized(32).size() + " (capacity no longer read)");
|
||||
step("securitymanager", Guard::runIsolated);
|
||||
step("thread.stop", Watchdog::kill);
|
||||
System.out.println(Report.lines());
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static void step(String name, Callable<Object> work) {
|
||||
try {
|
||||
System.out.println("[ok] " + name + ": " + work.call());
|
||||
} catch (Throwable t) {
|
||||
System.out.println("[FAIL] " + name + ": " + t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* There is no in-JVM replacement for the Security Manager. One option for untrusted or
|
||||
* badly behaved code is a separate process: its exit cannot take the host down.
|
||||
*/
|
||||
public final class Guard {
|
||||
public static String runIsolated() throws Exception {
|
||||
String java = Paths.get(System.getProperty("java.home"), "bin", "java").toString();
|
||||
Process child = new ProcessBuilder(java, "-cp", System.getProperty("java.class.path"),
|
||||
Plugin.class.getName()).inheritIO().start();
|
||||
return "child exit code " + child.waitFor() + ", host still running";
|
||||
}
|
||||
|
||||
public static final class Plugin {
|
||||
public static void main(String[] args) {
|
||||
System.exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
/** Ask the runtime instead of parsing a string. Runtime.version() exists since Java 9. */
|
||||
public final class JavaVersion {
|
||||
public static int major() {
|
||||
return Runtime.version().feature();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/** Same bean; only the import prefix changed, javax.xml.bind to jakarta.xml.bind. */
|
||||
@XmlRootElement(name = "order")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class Order {
|
||||
public String id;
|
||||
public int quantity;
|
||||
|
||||
public Order() { }
|
||||
|
||||
public Order(String id, int quantity) {
|
||||
this.id = id;
|
||||
this.quantity = quantity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import jakarta.xml.bind.JAXBContext;
|
||||
import jakarta.xml.bind.Marshaller;
|
||||
|
||||
public final class OrderXml {
|
||||
public static String toXml(Order order) throws Exception {
|
||||
Marshaller m = JAXBContext.newInstance(Order.class).createMarshaller();
|
||||
m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
|
||||
StringWriter out = new StringWriter();
|
||||
m.marshal(order, out);
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* There is no public API for an ArrayList's internal capacity, so the fix is to stop asking.
|
||||
* If your code needs the number, it has to own it.
|
||||
*/
|
||||
public final class Peek {
|
||||
public static ArrayList<String> sized(int capacity) {
|
||||
return new ArrayList<>(capacity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/** The class path is a system property; the loader's type is an implementation detail. */
|
||||
public final class PluginScanner {
|
||||
public static int classpathEntries() {
|
||||
String[] entries = System.getProperty("java.class.path").split(File.pathSeparator);
|
||||
return entries.length > 0 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
/** Pin every format that another system reads. Do not rely on locale data staying put. */
|
||||
public final class Report {
|
||||
public static String lines() {
|
||||
LocalDateTime when = LocalDateTime.of(2026, 3, 5, 14, 30);
|
||||
DateTimeFormatter us = DateTimeFormatter.ofPattern("MMM d, yyyy h:mm a", Locale.US);
|
||||
DateTimeFormatter de = DateTimeFormatter.ofPattern("EEEE, d. MMMM yyyy", Locale.GERMANY);
|
||||
DecimalFormat inr = new DecimalFormat("'Rs.'#,##0.00", DecimalFormatSymbols.getInstance(Locale.US));
|
||||
return "date(en_US) = " + escape(us.format(when)) + "\n"
|
||||
+ "date(de_DE) = " + escape(de.format(when)) + "\n"
|
||||
+ "money(en_IN) = " + escape(inr.format(1234567.5)) + "\n"
|
||||
+ "charset used = " + StandardCharsets.UTF_8 + "\n"
|
||||
+ "rupee as bytes = " + "₹".getBytes(StandardCharsets.UTF_8).length + " byte(s)";
|
||||
}
|
||||
|
||||
static String escape(String s) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (char ch : s.toCharArray()) {
|
||||
if (ch < 127) b.append(ch);
|
||||
else b.append(String.format("\\u%04X", (int) ch));
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
/** Unchanged code: the engine now comes from the nashorn-core dependency. */
|
||||
public final class Rules {
|
||||
public static Object discount(int quantity) throws Exception {
|
||||
ScriptEngine js = new ScriptEngineManager().getEngineByName("nashorn");
|
||||
js.put("quantity", quantity);
|
||||
return js.eval("quantity > 10 ? 'BULK' : 'RETAIL'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import jakarta.xml.ws.Endpoint;
|
||||
|
||||
public final class SoapCheck {
|
||||
public static String publishAndReadWsdl() throws Exception {
|
||||
String address = "http://127.0.0.1:18099/status";
|
||||
Endpoint endpoint = Endpoint.publish(address, new StatusService());
|
||||
try (InputStream in = new URL(address + "?wsdl").openStream()) {
|
||||
String wsdl = new Scanner(in, "UTF-8").useDelimiter("\\A").next();
|
||||
return wsdl.contains("name=\"StatusServiceService\"") ? "WSDL served" : "unexpected WSDL";
|
||||
} finally {
|
||||
endpoint.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import jakarta.jws.WebMethod;
|
||||
import jakarta.jws.WebService;
|
||||
|
||||
/** Same service; javax.jws became jakarta.jws. */
|
||||
@WebService
|
||||
public class StatusService {
|
||||
@WebMethod
|
||||
public String status() {
|
||||
return "UP";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
public final class Tokens {
|
||||
/** getMimeEncoder() wraps at 76 characters like sun.misc did; getEncoder() does not wrap. */
|
||||
public static String encode(byte[] raw) {
|
||||
return Base64.getMimeEncoder().encodeToString(raw);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ankurm.fixed;
|
||||
|
||||
/** Cooperative cancellation: interrupt, and the worker must honour the interrupt. */
|
||||
public final class Watchdog {
|
||||
public static String kill() throws InterruptedException {
|
||||
Thread worker = new Thread(() -> {
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt(); // restore the flag so the loop ends
|
||||
}
|
||||
}
|
||||
});
|
||||
worker.setDaemon(true);
|
||||
worker.start();
|
||||
Thread.sleep(100);
|
||||
worker.interrupt();
|
||||
worker.join(1000);
|
||||
return worker.isAlive() ? "still alive" : "stopped";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
-XX:MaxPermSize=256m
|
||||
-XX:PermSize=64m
|
||||
-XX:+UseConcMarkSweepGC
|
||||
-XX:+UseParNewGC
|
||||
-XX:+CMSParallelRemarkEnabled
|
||||
-XX:CMSInitiatingOccupancyFraction=70
|
||||
-XX:+UseParallelOldGC
|
||||
-Xincgc
|
||||
-XX:+PrintGCDetails
|
||||
-XX:+PrintGCDateStamps
|
||||
-XX:+PrintGCTimeStamps
|
||||
-XX:+PrintTenuringDistribution
|
||||
-XX:+PrintGCApplicationStoppedTime
|
||||
-Xloggc:gc.log
|
||||
-XX:+UseGCLogFileRotation
|
||||
-XX:NumberOfGCLogFiles=5
|
||||
-XX:+AggressiveOpts
|
||||
-XX:+UseBiasedLocking
|
||||
-XX:+UseFastAccessorMethods
|
||||
-XX:+AggressiveHeap
|
||||
-XX:+UseCGroupMemoryLimitForHeap
|
||||
-XX:+UseStringDeduplication
|
||||
-XX:+DisableExplicitGC
|
||||
-d64
|
||||
-Xverify:none
|
||||
-Xfuture
|
||||
--illegal-access=permit
|
||||
-XX:+UnlockCommercialFeatures
|
||||
-Djava.security.manager
|
||||
-Djava.security.manager=allow
|
||||
-Djava.endorsed.dirs=/tmp
|
||||
-Djava.ext.dirs=/tmp
|
||||
-Xbootclasspath/p:/tmp/none.jar
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ankurm</groupId>
|
||||
<artifactId>legacy-app</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/** Runs every feature of the legacy app and keeps going after a failure. */
|
||||
public final class App {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("running on java.version " + System.getProperty("java.version"));
|
||||
step("jaxb", () -> OrderXml.toXml(new Order("A-1", 12)));
|
||||
step("jaxws", SoapCheck::publishAndReadWsdl);
|
||||
step("base64", () -> Tokens.encode("ankur".getBytes("UTF-8")));
|
||||
step("nashorn", () -> Rules.discount(12));
|
||||
step("version", () -> "major=" + JavaVersion.major());
|
||||
step("classloader", () -> "classpath found=" + PluginScanner.classpathEntries());
|
||||
step("reflection", () -> "ArrayList capacity=" + Peek.capacity(new ArrayList<>(32)));
|
||||
step("securitymanager", Guard::install);
|
||||
step("thread.stop", Watchdog::kill);
|
||||
System.out.println(Report.lines());
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static void step(String name, Callable<Object> work) {
|
||||
try {
|
||||
System.out.println("[ok] " + name + ": " + work.call());
|
||||
} catch (Throwable t) {
|
||||
System.out.println("[FAIL] " + name + ": " + t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
/** Blocks System.exit from plugin code with a SecurityManager. */
|
||||
public final class Guard {
|
||||
public static String install() {
|
||||
System.setSecurityManager(new SecurityManager() {
|
||||
@Override public void checkExit(int status) {
|
||||
throw new SecurityException("plugins may not exit the JVM");
|
||||
}
|
||||
@Override public void checkPermission(java.security.Permission p) { }
|
||||
});
|
||||
try {
|
||||
System.exit(3);
|
||||
return "exited";
|
||||
} catch (SecurityException e) {
|
||||
return "blocked: " + e.getMessage();
|
||||
} finally {
|
||||
System.setSecurityManager(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
/** The classic "which Java is this?" parser: assumes versions look like 1.x.y. */
|
||||
public final class JavaVersion {
|
||||
public static int major() {
|
||||
String v = System.getProperty("java.version");
|
||||
return Integer.parseInt(v.split("\\.")[1]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/** A typical Java 8 era JAXB bean. javax.xml.bind shipped inside the JDK until Java 10. */
|
||||
@XmlRootElement(name = "order")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class Order {
|
||||
public String id;
|
||||
public int quantity;
|
||||
|
||||
public Order() { }
|
||||
|
||||
public Order(String id, int quantity) {
|
||||
this.id = id;
|
||||
this.quantity = quantity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Marshaller;
|
||||
|
||||
public final class OrderXml {
|
||||
public static String toXml(Order order) throws Exception {
|
||||
Marshaller m = JAXBContext.newInstance(Order.class).createMarshaller();
|
||||
m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
|
||||
StringWriter out = new StringWriter();
|
||||
m.marshal(order, out);
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/** Reads a private JDK field by reflection: the "illegal access" pattern. */
|
||||
public final class Peek {
|
||||
public static int capacity(ArrayList<?> list) throws Exception {
|
||||
Field f = ArrayList.class.getDeclaredField("elementData");
|
||||
f.setAccessible(true);
|
||||
return ((Object[]) f.get(list)).length;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
/** Assumes the application class loader is a URLClassLoader. True up to Java 8 only. */
|
||||
public final class PluginScanner {
|
||||
public static int classpathEntries() {
|
||||
URL[] urls = ((URLClassLoader) ClassLoader.getSystemClassLoader()).getURLs();
|
||||
return urls.length > 0 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/** Nothing here throws on any JDK. The text it prints is what changes. */
|
||||
public final class Report {
|
||||
public static String lines() {
|
||||
GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("UTC"), Locale.US);
|
||||
c.set(2026, Calendar.MARCH, 5, 14, 30, 0);
|
||||
DateFormat us = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.US);
|
||||
us.setTimeZone(c.getTimeZone());
|
||||
DateFormat de = DateFormat.getDateInstance(DateFormat.FULL, Locale.GERMANY);
|
||||
de.setTimeZone(c.getTimeZone());
|
||||
NumberFormat inr = NumberFormat.getCurrencyInstance(new Locale("en", "IN"));
|
||||
return "date(en_US) = " + escape(us.format(c.getTime())) + "\n"
|
||||
+ "date(de_DE) = " + escape(de.format(c.getTime())) + "\n"
|
||||
+ "money(en_IN) = " + escape(inr.format(1234567.5)) + "\n"
|
||||
+ "defaultCharset = " + Charset.defaultCharset() + "\n"
|
||||
+ "rupee as bytes = " + "₹".getBytes().length + " byte(s)";
|
||||
}
|
||||
|
||||
/** Print non-ASCII characters as \\uXXXX so the transcript shows invisible differences. */
|
||||
static String escape(String s) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (char ch : s.toCharArray()) {
|
||||
if (ch < 127) b.append(ch);
|
||||
else b.append(String.format("\\u%04X", (int) ch));
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
/** Business rules kept as JavaScript, run by Nashorn (removed in Java 15). */
|
||||
public final class Rules {
|
||||
public static Object discount(int quantity) throws Exception {
|
||||
ScriptEngine js = new ScriptEngineManager().getEngineByName("nashorn");
|
||||
js.put("quantity", quantity);
|
||||
return js.eval("quantity > 10 ? 'BULK' : 'RETAIL'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import javax.xml.ws.Endpoint;
|
||||
|
||||
public final class SoapCheck {
|
||||
public static String publishAndReadWsdl() throws Exception {
|
||||
String address = "http://127.0.0.1:18099/status";
|
||||
Endpoint endpoint = Endpoint.publish(address, new StatusService());
|
||||
try (InputStream in = new URL(address + "?wsdl").openStream()) {
|
||||
String wsdl = new Scanner(in, "UTF-8").useDelimiter("\\A").next();
|
||||
return wsdl.contains("name=\"StatusServiceService\"") ? "WSDL served" : "unexpected WSDL";
|
||||
} finally {
|
||||
endpoint.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebService;
|
||||
|
||||
/** A JAX-WS (SOAP) service published with the JDK's built-in HTTP server. */
|
||||
@WebService
|
||||
public class StatusService {
|
||||
@WebMethod
|
||||
public String status() {
|
||||
return "UP";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
public final class Tokens {
|
||||
/** sun.misc.BASE64Encoder was never a public API; it left the JDK in Java 9. */
|
||||
public static String encode(byte[] raw) {
|
||||
return new BASE64Encoder().encode(raw);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
/** Kills a runaway worker with Thread.stop(), deprecated since Java 1.2. */
|
||||
public final class Watchdog {
|
||||
@SuppressWarnings("deprecation")
|
||||
public static String kill() throws InterruptedException {
|
||||
Thread worker = new Thread(() -> {
|
||||
while (true) {
|
||||
try { Thread.sleep(50); } catch (InterruptedException ignored) { }
|
||||
}
|
||||
});
|
||||
worker.setDaemon(true);
|
||||
worker.start();
|
||||
Thread.sleep(100);
|
||||
worker.stop();
|
||||
worker.join(1000);
|
||||
return worker.isAlive() ? "still alive" : "stopped";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
$ javac -version # JDK 8, no -encoding flag, LANG=C
|
||||
src/main/java/com/ankurm/legacy/Report.java:25: error: unmappable character for encoding ASCII
|
||||
+ "rupee as bytes = " + "???".getBytes().length + " byte(s)";
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Report.java:25: error: unmappable character for encoding ASCII
|
||||
+ "rupee as bytes = " + "???".getBytes().length + " byte(s)";
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Report.java:25: error: unmappable character for encoding ASCII
|
||||
+ "rupee as bytes = " + "???".getBytes().length + " byte(s)";
|
||||
^
|
||||
3 errors
|
||||
@@ -0,0 +1,21 @@
|
||||
$ java -version
|
||||
openjdk version "1.8.0_514"
|
||||
OpenJDK Runtime Environment (Temurin)(build 1.8.0_514-b01)
|
||||
OpenJDK 64-Bit Server VM (Temurin)(build 25.514-b01, mixed mode)
|
||||
|
||||
$ java -cp classes-built-by-jdk8 com.ankurm.legacy.App
|
||||
running on java.version 1.8.0_514
|
||||
[ok] jaxb: <order><id>A-1</id><quantity>12</quantity></order>
|
||||
[ok] jaxws: WSDL served
|
||||
[ok] base64: YW5rdXI=
|
||||
[ok] nashorn: BULK
|
||||
[ok] version: major=8
|
||||
[ok] classloader: classpath found=1
|
||||
[ok] reflection: ArrayList capacity=32
|
||||
[ok] securitymanager: blocked: plugins may not exit the JVM
|
||||
[ok] thread.stop: stopped
|
||||
date(en_US) = Mar 5, 2026 2:30 PM
|
||||
date(de_DE) = Donnerstag, 5. M\u00E4rz 2026
|
||||
money(en_IN) = Rs.1,234,567.50
|
||||
defaultCharset = US-ASCII
|
||||
rupee as bytes = 1 byte(s)
|
||||
@@ -0,0 +1,21 @@
|
||||
$ java -version
|
||||
openjdk version "25.0.5.1" 2026-11-17 LTS
|
||||
OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS)
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
|
||||
$ java -cp classes-built-by-jdk8 com.ankurm.legacy.App
|
||||
running on java.version 25.0.5.1
|
||||
[FAIL] jaxb: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
|
||||
[FAIL] jaxws: java.lang.NoClassDefFoundError: javax/xml/ws/Endpoint
|
||||
[FAIL] base64: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
|
||||
[FAIL] nashorn: java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "<local1>" is null
|
||||
[ok] version: major=0
|
||||
[FAIL] classloader: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
|
||||
[FAIL] reflection: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.lang.Object[] java.util.ArrayList.elementData accessible: module java.base does not "opens java.util" to unnamed module @355da254
|
||||
[FAIL] securitymanager: java.lang.UnsupportedOperationException: Setting a Security Manager is not supported
|
||||
[FAIL] thread.stop: java.lang.UnsupportedOperationException
|
||||
date(en_US) = Mar 5, 2026, 2:30\u202FPM
|
||||
date(de_DE) = Donnerstag, 5. M\u00E4rz 2026
|
||||
money(en_IN) = \u20B91,234,567.50
|
||||
defaultCharset = UTF-8
|
||||
rupee as bytes = 3 byte(s)
|
||||
@@ -0,0 +1,20 @@
|
||||
$ java -cp classes-built-by-jdk8 com.ankurm.legacy.App # JDK 17, the middle of the staged path
|
||||
running on java.version 17.0.21.1
|
||||
[FAIL] jaxb: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
|
||||
[FAIL] jaxws: java.lang.NoClassDefFoundError: javax/xml/ws/Endpoint
|
||||
[FAIL] base64: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
|
||||
[FAIL] nashorn: java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "<local1>" is null
|
||||
[ok] version: major=0
|
||||
[FAIL] classloader: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
|
||||
[FAIL] reflection: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.lang.Object[] java.util.ArrayList.elementData accessible: module java.base does not "opens java.util" to unnamed module @7137feef
|
||||
WARNING: A terminally deprecated method in java.lang.System has been called
|
||||
WARNING: System::setSecurityManager has been called by com.ankurm.legacy.Guard (file:./build/c8/)
|
||||
WARNING: Please consider reporting this to the maintainers of com.ankurm.legacy.Guard
|
||||
WARNING: System::setSecurityManager will be removed in a future release
|
||||
[ok] securitymanager: blocked: plugins may not exit the JVM
|
||||
[ok] thread.stop: stopped
|
||||
date(en_US) = Mar 5, 2026, 2:30 PM
|
||||
date(de_DE) = Donnerstag, 5. M\u00E4rz 2026
|
||||
money(en_IN) = \u20B91,234,567.50
|
||||
defaultCharset = US-ASCII
|
||||
rupee as bytes = 1 byte(s)
|
||||
@@ -0,0 +1,97 @@
|
||||
$ javac -encoding UTF-8 ... # JDK 25
|
||||
src/main/java/com/ankurm/legacy/Order.java:3: error: package javax.xml.bind.annotation does not exist
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Order.java:4: error: package javax.xml.bind.annotation does not exist
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Order.java:5: error: package javax.xml.bind.annotation does not exist
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Order.java:8: error: cannot find symbol
|
||||
@XmlRootElement(name = "order")
|
||||
^
|
||||
symbol: class XmlRootElement
|
||||
src/main/java/com/ankurm/legacy/Order.java:9: error: cannot find symbol
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
^
|
||||
symbol: class XmlAccessorType
|
||||
src/main/java/com/ankurm/legacy/OrderXml.java:4: error: package javax.xml.bind does not exist
|
||||
import javax.xml.bind.JAXBContext;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/OrderXml.java:5: error: package javax.xml.bind does not exist
|
||||
import javax.xml.bind.Marshaller;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/SoapCheck.java:6: error: package javax.xml.ws does not exist
|
||||
import javax.xml.ws.Endpoint;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/StatusService.java:3: error: package javax.jws does not exist
|
||||
import javax.jws.WebMethod;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/StatusService.java:4: error: package javax.jws does not exist
|
||||
import javax.jws.WebService;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/StatusService.java:7: error: cannot find symbol
|
||||
@WebService
|
||||
^
|
||||
symbol: class WebService
|
||||
src/main/java/com/ankurm/legacy/Tokens.java:3: error: cannot find symbol
|
||||
import sun.misc.BASE64Encoder;
|
||||
^
|
||||
symbol: class BASE64Encoder
|
||||
location: package sun.misc
|
||||
src/main/java/com/ankurm/legacy/Order.java:9: error: cannot find symbol
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
^
|
||||
symbol: variable XmlAccessType
|
||||
src/main/java/com/ankurm/legacy/StatusService.java:9: error: cannot find symbol
|
||||
@WebMethod
|
||||
^
|
||||
symbol: class WebMethod
|
||||
location: class StatusService
|
||||
src/main/java/com/ankurm/legacy/Guard.java:6: warning: [removal] SecurityManager in java.lang has been deprecated and marked for removal
|
||||
System.setSecurityManager(new SecurityManager() {
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Guard.java:6: warning: [removal] setSecurityManager(SecurityManager) in System has been deprecated and marked for removal
|
||||
System.setSecurityManager(new SecurityManager() {
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Guard.java:18: warning: [removal] setSecurityManager(SecurityManager) in System has been deprecated and marked for removal
|
||||
System.setSecurityManager(null);
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/OrderXml.java:9: error: cannot find symbol
|
||||
Marshaller m = JAXBContext.newInstance(Order.class).createMarshaller();
|
||||
^
|
||||
symbol: class Marshaller
|
||||
location: class OrderXml
|
||||
src/main/java/com/ankurm/legacy/OrderXml.java:9: error: cannot find symbol
|
||||
Marshaller m = JAXBContext.newInstance(Order.class).createMarshaller();
|
||||
^
|
||||
symbol: variable JAXBContext
|
||||
location: class OrderXml
|
||||
src/main/java/com/ankurm/legacy/OrderXml.java:10: error: cannot find symbol
|
||||
m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
|
||||
^
|
||||
symbol: variable Marshaller
|
||||
location: class OrderXml
|
||||
src/main/java/com/ankurm/legacy/SoapCheck.java:11: error: cannot find symbol
|
||||
Endpoint endpoint = Endpoint.publish(address, new StatusService());
|
||||
^
|
||||
symbol: class Endpoint
|
||||
location: class SoapCheck
|
||||
src/main/java/com/ankurm/legacy/SoapCheck.java:11: error: cannot find symbol
|
||||
Endpoint endpoint = Endpoint.publish(address, new StatusService());
|
||||
^
|
||||
symbol: variable Endpoint
|
||||
location: class SoapCheck
|
||||
src/main/java/com/ankurm/legacy/Tokens.java:8: error: cannot find symbol
|
||||
return new BASE64Encoder().encode(raw);
|
||||
^
|
||||
symbol: class BASE64Encoder
|
||||
location: class Tokens
|
||||
src/main/java/com/ankurm/legacy/Watchdog.java:15: warning: [removal] stop() in Thread has been deprecated and marked for removal
|
||||
worker.stop();
|
||||
^
|
||||
Note: Some input files use or override a deprecated API.
|
||||
Note: Recompile with -Xlint:deprecation for details.
|
||||
20 errors
|
||||
4 warnings
|
||||
@@ -0,0 +1,31 @@
|
||||
$ javac --release 8 ... # JDK 25, all sources except Tokens.java and App.java
|
||||
warning: [options] source value 8 is obsolete and will be removed in a future release
|
||||
warning: [options] target value 8 is obsolete and will be removed in a future release
|
||||
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
|
||||
3 warnings
|
||||
exit status: 0
|
||||
|
||||
$ ls r8/com/ankurm/legacy
|
||||
Guard$1.class
|
||||
Guard.class
|
||||
JavaVersion.class
|
||||
Order.class
|
||||
OrderXml.class
|
||||
Peek.class
|
||||
PluginScanner.class
|
||||
Report.class
|
||||
Rules.class
|
||||
SoapCheck.class
|
||||
StatusService.class
|
||||
Watchdog.class
|
||||
|
||||
$ javac --release 8 Tokens.java
|
||||
src/main/java/com/ankurm/legacy/Tokens.java:3: error: package sun.misc does not exist
|
||||
import sun.misc.BASE64Encoder;
|
||||
^
|
||||
src/main/java/com/ankurm/legacy/Tokens.java:8: error: cannot find symbol
|
||||
return new BASE64Encoder().encode(raw);
|
||||
^
|
||||
symbol: class BASE64Encoder
|
||||
location: class Tokens
|
||||
2 errors
|
||||
@@ -0,0 +1,13 @@
|
||||
$ jdeps --jdk-internals legacy.jar
|
||||
legacy.jar -> JDK removed internal API
|
||||
com.ankurm.legacy.Tokens -> sun.misc.BASE64Encoder JDK removed internal API
|
||||
|
||||
Warning: JDK internal APIs are unsupported and private to JDK implementation that are
|
||||
subject to be removed or changed incompatibly and could break your application.
|
||||
Please modify your code to eliminate dependence on any JDK internal APIs.
|
||||
For the most recent update on JDK internal API replacements, please check:
|
||||
https://wiki.openjdk.org/display/JDK8/Java+Dependency+Analysis+Tool
|
||||
|
||||
JDK Internal API Suggested Replacement
|
||||
---------------- ---------------------
|
||||
sun.misc.BASE64Encoder Use java.util.Base64 @since 1.8
|
||||
@@ -0,0 +1,21 @@
|
||||
$ jdeps -verbose:package legacy.jar
|
||||
legacy.jar -> JDK removed internal API
|
||||
legacy.jar -> java.base
|
||||
legacy.jar -> java.scripting
|
||||
legacy.jar -> not found
|
||||
com.ankurm.legacy -> java.io java.base
|
||||
com.ankurm.legacy -> java.lang java.base
|
||||
com.ankurm.legacy -> java.lang.invoke java.base
|
||||
com.ankurm.legacy -> java.lang.reflect java.base
|
||||
com.ankurm.legacy -> java.net java.base
|
||||
com.ankurm.legacy -> java.nio.charset java.base
|
||||
com.ankurm.legacy -> java.security java.base
|
||||
com.ankurm.legacy -> java.text java.base
|
||||
com.ankurm.legacy -> java.util java.base
|
||||
com.ankurm.legacy -> java.util.concurrent java.base
|
||||
com.ankurm.legacy -> javax.jws not found
|
||||
com.ankurm.legacy -> javax.script java.scripting
|
||||
com.ankurm.legacy -> javax.xml.bind not found
|
||||
com.ankurm.legacy -> javax.xml.bind.annotation not found
|
||||
com.ankurm.legacy -> javax.xml.ws not found
|
||||
com.ankurm.legacy -> sun.misc JDK removed internal API
|
||||
@@ -0,0 +1,12 @@
|
||||
$ jdeprscan --release 25 legacy.jar
|
||||
Jar file legacy.jar:
|
||||
class com/ankurm/legacy/Guard$1 extends deprecated class java/lang/SecurityManager (forRemoval=true)
|
||||
class com/ankurm/legacy/Guard$1 uses deprecated class java/lang/SecurityManager (forRemoval=true)
|
||||
class com/ankurm/legacy/Guard uses deprecated method java/lang/System::setSecurityManager(Ljava/lang/SecurityManager;)V (forRemoval=true)
|
||||
error: cannot find class javax/xml/bind/JAXBContext
|
||||
error: cannot find class javax/xml/bind/Marshaller
|
||||
class com/ankurm/legacy/Report uses deprecated method java/util/Locale::<init>(Ljava/lang/String;Ljava/lang/String;)V
|
||||
error: cannot find class javax/xml/ws/Endpoint
|
||||
class com/ankurm/legacy/SoapCheck uses deprecated method java/net/URL::<init>(Ljava/lang/String;)V
|
||||
error: cannot find class sun/misc/BASE64Encoder
|
||||
class com/ankurm/legacy/Watchdog uses deprecated method java/lang/Thread::stop()V (forRemoval=true)
|
||||
@@ -0,0 +1,334 @@
|
||||
################ -XX:MaxPermSize=256m
|
||||
JDK 8 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'MaxPermSize=256m'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'MaxPermSize=256m'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:PermSize=64m
|
||||
JDK 8 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: ignoring option PermSize=64m; support was removed in 8.0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'PermSize=64m'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'PermSize=64m'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+UseConcMarkSweepGC
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'UseConcMarkSweepGC'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UseConcMarkSweepGC'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+UseParNewGC
|
||||
JDK 8 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'UseParNewGC'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UseParNewGC'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+CMSParallelRemarkEnabled
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'CMSParallelRemarkEnabled'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'CMSParallelRemarkEnabled'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:CMSInitiatingOccupancyFraction=70
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'CMSInitiatingOccupancyFraction=70'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'CMSInitiatingOccupancyFraction=70'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+UseParallelOldGC
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'UseParallelOldGC'
|
||||
Did you mean '(+/-)UseParallelGC'? Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UseParallelOldGC'
|
||||
Did you mean '(+/-)UseParallelGC'?
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -Xincgc
|
||||
JDK 8 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
|
||||
JDK 17 exit=1
|
||||
Unrecognized option: -Xincgc
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized option: -Xincgc
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+PrintGCDetails
|
||||
JDK 8 exit=0
|
||||
Heap
|
||||
PSYoungGen total 28672K, used 983K [0x00000000e0000000, 0x00000000e2000000, 0x0000000100000000)
|
||||
eden space 24576K, 4% used [0x00000000e0000000,0x00000000e00f5da8,0x00000000e1800000)
|
||||
from space 4096K, 0% used [0x00000000e1c00000,0x00000000e1c00000,0x00000000e2000000)
|
||||
JDK 17 exit=0
|
||||
[0.0NNs][warning][gc] -XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.
|
||||
[0.0NNs][info ][gc] Using G1
|
||||
[0.0NNs][info ][gc,init] Version: 17.0.21.1+2 (release)
|
||||
[0.0NNs][info ][gc,init] CPUs: 2 total, 2 available
|
||||
JDK 25 exit=0
|
||||
[0.0NNs][warning][gc] -XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.
|
||||
[0.0NNs][info ][gc,init] CardTable entry size: 512
|
||||
[0.0NNs][info ][gc ] Using G1
|
||||
[0.0NNs][info ][gc,init] Version: 25.0.5.1+2-LTS (release)
|
||||
################ -XX:+PrintGCDateStamps
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'PrintGCDateStamps'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'PrintGCDateStamps'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+PrintGCTimeStamps
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'PrintGCTimeStamps'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'PrintGCTimeStamps'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+PrintTenuringDistribution
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'PrintTenuringDistribution'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'PrintTenuringDistribution'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+PrintGCApplicationStoppedTime
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'PrintGCApplicationStoppedTime'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'PrintGCApplicationStoppedTime'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -Xloggc:gc.log
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
[0.0NNs][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:gc.log instead.
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=0
|
||||
[0.0NNs][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:gc.log instead.
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
################ -XX:+UseGCLogFileRotation
|
||||
JDK 8 exit=0
|
||||
To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files>
|
||||
where num_of_file > 0
|
||||
GC log rotation is turned off
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'UseGCLogFileRotation'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UseGCLogFileRotation'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:NumberOfGCLogFiles=5
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'NumberOfGCLogFiles=5'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'NumberOfGCLogFiles=5'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+AggressiveOpts
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'AggressiveOpts'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'AggressiveOpts'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+UseBiasedLocking
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UseBiasedLocking'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+UseFastAccessorMethods
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'UseFastAccessorMethods'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UseFastAccessorMethods'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+AggressiveHeap
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=0
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
################ -XX:+UseCGroupMemoryLimitForHeap
|
||||
JDK 8 exit=1
|
||||
Error: VM option 'UseCGroupMemoryLimitForHeap' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'UseCGroupMemoryLimitForHeap'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UseCGroupMemoryLimitForHeap'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -XX:+UseStringDeduplication
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=0
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
################ -XX:+DisableExplicitGC
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=0
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
################ -d64
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized option: -d64
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized option: -d64
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -Xverify:none
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
################ -Xfuture
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
Warning: -Xfuture option is deprecated and may be removed in a future release.
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode)
|
||||
JDK 25 exit=1
|
||||
Unrecognized option: -Xfuture
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ --illegal-access=permit
|
||||
JDK 8 exit=1
|
||||
Unrecognized option: --illegal-access=permit
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 17 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=permit; support was removed in 17.0
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=0
|
||||
OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=permit; support was removed in 17.0
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
################ -XX:+UnlockCommercialFeatures
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
Unrecognized VM option 'UnlockCommercialFeatures'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
Unrecognized VM option 'UnlockCommercialFeatures'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -Djava.security.manager
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=0
|
||||
WARNING: A command line option has enabled the Security Manager
|
||||
WARNING: The Security Manager is deprecated and will be removed in a future release
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=1
|
||||
Error occurred during initialization of VM
|
||||
java.lang.Error: A command line option has attempted to allow or enable the Security Manager. Enabling a Security Manager is not supported.
|
||||
at java.lang.System.initPhase3([email protected]/System.java:1970)
|
||||
################ -Djava.security.manager=allow
|
||||
JDK 8 exit=1
|
||||
Error occurred during initialization of VM
|
||||
java.lang.InternalError: Could not create SecurityManager: allow
|
||||
at sun.misc.Launcher.<init>(Launcher.java:106)
|
||||
at sun.misc.Launcher.<clinit>(Launcher.java:54)
|
||||
JDK 17 exit=0
|
||||
OpenJDK 64-Bit Server VM Temurin-17.0.21.1+2 (build 17.0.21.1+2, mixed mode, sharing)
|
||||
JDK 25 exit=1
|
||||
Error occurred during initialization of VM
|
||||
java.lang.Error: A command line option has attempted to allow or enable the Security Manager. Enabling a Security Manager is not supported.
|
||||
at java.lang.System.initPhase3([email protected]/System.java:1970)
|
||||
################ -Djava.endorsed.dirs=/tmp
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
-Djava.endorsed.dirs=/tmp is not supported. Endorsed standards and standalone APIs
|
||||
in modular form will be supported via the concept of upgradeable modules.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
-Djava.endorsed.dirs=/tmp is not supported. Endorsed standards and standalone APIs
|
||||
in modular form will be supported via the concept of upgradeable modules.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -Djava.ext.dirs=/tmp
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
-Djava.ext.dirs=/tmp is not supported. Use -classpath instead.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
-Djava.ext.dirs=/tmp is not supported. Use -classpath instead.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
################ -Xbootclasspath/p:/tmp/none.jar
|
||||
JDK 8 exit=0
|
||||
JDK 17 exit=1
|
||||
-Xbootclasspath/p is no longer a supported option.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
JDK 25 exit=1
|
||||
-Xbootclasspath/p is no longer a supported option.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
@@ -0,0 +1,53 @@
|
||||
################ JDK 8, -XX:ActiveProcessorCount=2
|
||||
MaxHeapSize 1610612736
|
||||
UseCompressedOops true
|
||||
UseContainerSupport true
|
||||
UseG1GC false
|
||||
UseParallelGC true
|
||||
UseSerialGC false
|
||||
UseStringDeduplication false
|
||||
################ JDK 8, -XX:ActiveProcessorCount=1
|
||||
MaxHeapSize 1610612736
|
||||
UseCompressedOops true
|
||||
UseContainerSupport true
|
||||
UseG1GC false
|
||||
UseParallelGC false
|
||||
UseSerialGC false
|
||||
UseStringDeduplication false
|
||||
################ JDK 17, -XX:ActiveProcessorCount=2
|
||||
MaxHeapSize 1610612736
|
||||
UseCompressedOops true
|
||||
UseContainerSupport true
|
||||
UseG1GC true
|
||||
UseParallelGC false
|
||||
UseSerialGC false
|
||||
UseStringDeduplication false
|
||||
################ JDK 17, -XX:ActiveProcessorCount=1
|
||||
MaxHeapSize 1610612736
|
||||
UseCompressedOops true
|
||||
UseContainerSupport true
|
||||
UseG1GC false
|
||||
UseParallelGC false
|
||||
UseSerialGC true
|
||||
UseStringDeduplication false
|
||||
################ JDK 25, -XX:ActiveProcessorCount=2
|
||||
MaxHeapSize 1610612736
|
||||
UseCompactObjectHeaders false
|
||||
UseCompressedOops true
|
||||
UseContainerSupport true
|
||||
UseG1GC true
|
||||
UseParallelGC false
|
||||
UseSerialGC false
|
||||
UseStringDeduplication false
|
||||
################ JDK 25, -XX:ActiveProcessorCount=1
|
||||
MaxHeapSize 1610612736
|
||||
UseCompactObjectHeaders false
|
||||
UseCompressedOops true
|
||||
UseContainerSupport true
|
||||
UseG1GC false
|
||||
UseParallelGC false
|
||||
UseSerialGC true
|
||||
UseStringDeduplication false
|
||||
################ JDK 8 with 1 CPU: no UseXxxGC flag is set, so ask for the heap layout
|
||||
def new generation
|
||||
tenured generation
|
||||
@@ -0,0 +1,93 @@
|
||||
################ JDK 8
|
||||
java.version = 1.8.0_514
|
||||
keystore.type = jks
|
||||
protocols = [TLSv1.3, TLSv1.2]
|
||||
cipher suites = 33 enabled, 6 of them TLS_RSA_*
|
||||
jdk.tls.disabledAlgorithms =
|
||||
SSLv3
|
||||
TLSv1
|
||||
TLSv1.1
|
||||
RC4
|
||||
DES
|
||||
MD5withRSA
|
||||
DH keySize < 1024
|
||||
EC keySize < 224
|
||||
3DES_EDE_CBC
|
||||
anon
|
||||
NULL
|
||||
ECDH
|
||||
include jdk.disabled.namedCurves
|
||||
jdk.jar.disabledAlgorithms =
|
||||
MD2
|
||||
MD5
|
||||
RSA keySize < 1024
|
||||
DSA keySize < 1024
|
||||
SHA1 denyAfter 2019-01-01
|
||||
include jdk.disabled.namedCurves
|
||||
[ok] TLSv1.2 default suites -> TLSv1.2 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
[FAIL] TLSv1.1 only -> javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
|
||||
[ok] TLS_RSA_WITH_AES_128_GCM_SHA256 -> TLSv1.2 TLS_RSA_WITH_AES_128_GCM_SHA256
|
||||
################ JDK 17
|
||||
java.version = 17.0.21.1
|
||||
keystore.type = pkcs12
|
||||
protocols = [TLSv1.3, TLSv1.2]
|
||||
cipher suites = 31 enabled, 0 of them TLS_RSA_*
|
||||
jdk.tls.disabledAlgorithms =
|
||||
SSLv3
|
||||
TLSv1
|
||||
TLSv1.1
|
||||
DTLSv1.0
|
||||
RC4
|
||||
DES
|
||||
MD5withRSA
|
||||
DH keySize < 1024
|
||||
EC keySize < 224
|
||||
3DES_EDE_CBC
|
||||
anon
|
||||
NULL
|
||||
ECDH
|
||||
TLS_RSA_*
|
||||
rsa_pkcs1_sha1 usage HandshakeSignature
|
||||
ecdsa_sha1 usage HandshakeSignature
|
||||
dsa_sha1 usage HandshakeSignature
|
||||
jdk.jar.disabledAlgorithms =
|
||||
MD2
|
||||
MD5
|
||||
RSA keySize < 1024
|
||||
DSA keySize < 1024
|
||||
SHA1 denyAfter 2019-01-01
|
||||
[ok] TLSv1.2 default suites -> TLSv1.2 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
[FAIL] TLSv1.1 only -> javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
|
||||
[FAIL] TLS_RSA_WITH_AES_128_GCM_SHA256 -> javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
|
||||
################ JDK 25
|
||||
java.version = 25.0.5.1
|
||||
keystore.type = pkcs12
|
||||
protocols = [TLSv1.3, TLSv1.2]
|
||||
cipher suites = 31 enabled, 0 of them TLS_RSA_*
|
||||
jdk.tls.disabledAlgorithms =
|
||||
SSLv3
|
||||
TLSv1
|
||||
TLSv1.1
|
||||
DTLSv1.0
|
||||
RC4
|
||||
DES
|
||||
MD5withRSA
|
||||
DH keySize < 1024
|
||||
EC keySize < 224
|
||||
3DES_EDE_CBC
|
||||
anon
|
||||
NULL
|
||||
ECDH
|
||||
TLS_RSA_*
|
||||
rsa_pkcs1_sha1 usage HandshakeSignature
|
||||
ecdsa_sha1 usage HandshakeSignature
|
||||
dsa_sha1 usage HandshakeSignature
|
||||
jdk.jar.disabledAlgorithms =
|
||||
MD2
|
||||
MD5
|
||||
RSA keySize < 1024
|
||||
DSA keySize < 1024
|
||||
SHA1 denyAfter 2019-01-01
|
||||
[ok] TLSv1.2 default suites -> TLSv1.2 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
[FAIL] TLSv1.1 only -> javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
|
||||
[FAIL] TLS_RSA_WITH_AES_128_GCM_SHA256 -> javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
|
||||
@@ -0,0 +1,10 @@
|
||||
################ JDK 8: jarsigner -verify signed.jar
|
||||
|
||||
The jar will be treated as unsigned, because it is signed with a weak algorithm that is now disabled.
|
||||
|
||||
Re-run jarsigner with the -verbose option for more details.
|
||||
################ JDK 25: jarsigner -verify signed.jar
|
||||
|
||||
The jar will be treated as unsigned, because it is signed with a weak algorithm that is now disabled.
|
||||
|
||||
Re-run jarsigner with the -verbose option for more details.
|
||||
@@ -0,0 +1,25 @@
|
||||
$ java --add-opens java.base/java.util=ALL-UNNAMED -Dfile.encoding=COMPAT -Djava.locale.providers=COMPAT \
|
||||
-cp classes-built-by-jdk8:bridge-jars com.ankurm.legacy.App # JDK 25
|
||||
running on java.version 25.0.5.1
|
||||
[ok] jaxb: <order><id>A-1</id><quantity>12</quantity></order>
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.sun.xml.ws.model.InjectorHelper (file:./bridge/target/dependency/jaxws-rt-2.3.7.jar)
|
||||
WARNING: Please consider reporting this to the maintainers of class com.sun.xml.ws.model.InjectorHelper
|
||||
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
|
||||
Dec 03, 2026 11:43:45 PM sun.util.locale.provider.LocaleProviderAdapter <clinit>
|
||||
INFO: Invalid locale provider adapter "COMPAT" ignored.
|
||||
Dec 03, 2026 11:43:45 PM sun.util.locale.provider.LocaleProviderAdapter <clinit>
|
||||
WARNING: COMPAT locale provider has been removed
|
||||
[ok] jaxws: WSDL served
|
||||
[FAIL] base64: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
|
||||
[ok] nashorn: BULK
|
||||
[ok] version: major=0
|
||||
[FAIL] classloader: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
|
||||
[ok] reflection: ArrayList capacity=32
|
||||
[FAIL] securitymanager: java.lang.UnsupportedOperationException: Setting a Security Manager is not supported
|
||||
[FAIL] thread.stop: java.lang.UnsupportedOperationException
|
||||
date(en_US) = Mar 5, 2026, 2:30\u202FPM
|
||||
date(de_DE) = Donnerstag, 5. M\u00E4rz 2026
|
||||
money(en_IN) = \u20B91,234,567.50
|
||||
defaultCharset = US-ASCII
|
||||
rupee as bytes = 1 byte(s)
|
||||
@@ -0,0 +1,22 @@
|
||||
$ java -cp target/classes:target/dependency/* com.ankurm.fixed.App # JDK 25
|
||||
running on java.version 25.0.5.1
|
||||
[ok] jaxb: <order><id>A-1</id><quantity>12</quantity></order>
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.sun.xml.ws.model.InjectorHelper (file:./fixed/target/dependency/jaxws-rt-4.0.5.jar)
|
||||
WARNING: Please consider reporting this to the maintainers of class com.sun.xml.ws.model.InjectorHelper
|
||||
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
|
||||
<timestamp> com.sun.xml.ws.server.MonitorBase createMOM
|
||||
INFO: Monitoring is not available, starting up without monitoring.
|
||||
[ok] jaxws: WSDL served
|
||||
[ok] base64: YW5rdXI=
|
||||
[ok] nashorn: BULK
|
||||
[ok] version: major=25
|
||||
[ok] classloader: classpath found=1
|
||||
[ok] reflection: list size=0 (capacity no longer read)
|
||||
[ok] securitymanager: child exit code 3, host still running
|
||||
[ok] thread.stop: stopped
|
||||
date(en_US) = Mar 5, 2026 2:30 PM
|
||||
date(de_DE) = Donnerstag, 5. M\u00E4rz 2026
|
||||
money(en_IN) = Rs.1,234,567.50
|
||||
charset used = UTF-8
|
||||
rupee as bytes = 3 byte(s)
|
||||
@@ -0,0 +1,131 @@
|
||||
pom.xml | 33 +++++++++++++++++++++++++--
|
||||
src/main/java/com/ankurm/legacy/App.java | 8 +++----
|
||||
src/main/java/com/ankurm/legacy/Report.java | 2 +-
|
||||
src/main/java/com/ankurm/legacy/Tokens.java | 4 ++--
|
||||
src/main/java/com/ankurm/legacy/Watchdog.java | 7 +++++-
|
||||
5 files changed, 44 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index d0fca21..3fae6a0 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -8,8 +8,37 @@
|
||||
<version>1.0</version>
|
||||
|
||||
<properties>
|
||||
- <maven.compiler.source>1.8</maven.compiler.source>
|
||||
- <maven.compiler.target>1.8</maven.compiler.target>
|
||||
+ <maven.compiler.source>25</maven.compiler.source>
|
||||
+ <maven.compiler.target>25</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
+ <dependencies>
|
||||
+ <dependency>
|
||||
+ <groupId>jakarta.jws</groupId>
|
||||
+ <artifactId>jakarta.jws-api</artifactId>
|
||||
+ <version>2.1.0</version>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>jakarta.xml.bind</groupId>
|
||||
+ <artifactId>jakarta.xml.bind-api</artifactId>
|
||||
+ <version>2.3.3</version>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>jakarta.xml.ws</groupId>
|
||||
+ <artifactId>jakarta.xml.ws-api</artifactId>
|
||||
+ <version>2.3.3</version>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>com.sun.xml.ws</groupId>
|
||||
+ <artifactId>jaxws-rt</artifactId>
|
||||
+ <version>2.3.7</version>
|
||||
+ <scope>provided</scope>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>org.glassfish.jaxb</groupId>
|
||||
+ <artifactId>jaxb-runtime</artifactId>
|
||||
+ <version>2.3.9</version>
|
||||
+ <scope>runtime</scope>
|
||||
+ </dependency>
|
||||
+ </dependencies>
|
||||
</project>
|
||||
diff --git a/src/main/java/com/ankurm/legacy/App.java b/src/main/java/com/ankurm/legacy/App.java
|
||||
index a3469e8..308457a 100644
|
||||
--- a/src/main/java/com/ankurm/legacy/App.java
|
||||
+++ b/src/main/java/com/ankurm/legacy/App.java
|
||||
@@ -6,7 +6,7 @@ import java.util.concurrent.Callable;
|
||||
/** Runs every feature of the legacy app and keeps going after a failure. */
|
||||
public final class App {
|
||||
public static void main(String[] args) {
|
||||
- System.out.println("running on java.version " + System.getProperty("java.version"));
|
||||
+ IO.println("running on java.version " + System.getProperty("java.version"));
|
||||
step("jaxb", () -> OrderXml.toXml(new Order("A-1", 12)));
|
||||
step("jaxws", SoapCheck::publishAndReadWsdl);
|
||||
step("base64", () -> Tokens.encode("ankur".getBytes("UTF-8")));
|
||||
@@ -16,15 +16,15 @@ public final class App {
|
||||
step("reflection", () -> "ArrayList capacity=" + Peek.capacity(new ArrayList<>(32)));
|
||||
step("securitymanager", Guard::install);
|
||||
step("thread.stop", Watchdog::kill);
|
||||
- System.out.println(Report.lines());
|
||||
+ IO.println(Report.lines());
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static void step(String name, Callable<Object> work) {
|
||||
try {
|
||||
- System.out.println("[ok] " + name + ": " + work.call());
|
||||
+ IO.println("[ok] " + name + ": " + work.call());
|
||||
} catch (Throwable t) {
|
||||
- System.out.println("[FAIL] " + name + ": " + t);
|
||||
+ IO.println("[FAIL] " + name + ": " + t);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/com/ankurm/legacy/Report.java b/src/main/java/com/ankurm/legacy/Report.java
|
||||
index 822000c..59a8485 100644
|
||||
--- a/src/main/java/com/ankurm/legacy/Report.java
|
||||
+++ b/src/main/java/com/ankurm/legacy/Report.java
|
||||
@@ -17,7 +17,7 @@ public final class Report {
|
||||
us.setTimeZone(c.getTimeZone());
|
||||
DateFormat de = DateFormat.getDateInstance(DateFormat.FULL, Locale.GERMANY);
|
||||
de.setTimeZone(c.getTimeZone());
|
||||
- NumberFormat inr = NumberFormat.getCurrencyInstance(new Locale("en", "IN"));
|
||||
+ NumberFormat inr = NumberFormat.getCurrencyInstance(Locale.of("en", "IN"));
|
||||
return "date(en_US) = " + escape(us.format(c.getTime())) + "\n"
|
||||
+ "date(de_DE) = " + escape(de.format(c.getTime())) + "\n"
|
||||
+ "money(en_IN) = " + escape(inr.format(1234567.5)) + "\n"
|
||||
diff --git a/src/main/java/com/ankurm/legacy/Tokens.java b/src/main/java/com/ankurm/legacy/Tokens.java
|
||||
index aff0b93..a78409d 100644
|
||||
--- a/src/main/java/com/ankurm/legacy/Tokens.java
|
||||
+++ b/src/main/java/com/ankurm/legacy/Tokens.java
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.ankurm.legacy;
|
||||
|
||||
-import sun.misc.BASE64Encoder;
|
||||
+import java.util.Base64;
|
||||
|
||||
public final class Tokens {
|
||||
/** sun.misc.BASE64Encoder was never a public API; it left the JDK in Java 9. */
|
||||
public static String encode(byte[] raw) {
|
||||
- return new BASE64Encoder().encode(raw);
|
||||
+ return Base64.getEncoder().encodeToString(raw);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/com/ankurm/legacy/Watchdog.java b/src/main/java/com/ankurm/legacy/Watchdog.java
|
||||
index d2875aa..df39ab8 100644
|
||||
--- a/src/main/java/com/ankurm/legacy/Watchdog.java
|
||||
+++ b/src/main/java/com/ankurm/legacy/Watchdog.java
|
||||
@@ -12,7 +12,12 @@ public final class Watchdog {
|
||||
worker.setDaemon(true);
|
||||
worker.start();
|
||||
Thread.sleep(100);
|
||||
- worker.stop();
|
||||
+ /*
|
||||
+ * `Thread.stop()` always throws a `new UnsupportedOperationException()` in Java 21+.
|
||||
+ * For detailed migration instructions see the migration guide available at
|
||||
+ * https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html
|
||||
+ */
|
||||
+ throw new UnsupportedOperationException();
|
||||
worker.join(1000);
|
||||
return worker.isAlive() ? "still alive" : "stopped";
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
$ mvn clean compile # JDK 25, straight after the recipe
|
||||
[ERROR] src/main/java/com/ankurm/legacy/Watchdog.java:[21,9] unreachable statement
|
||||
[INFO] BUILD FAILURE
|
||||
[ERROR] src/main/java/com/ankurm/legacy/Watchdog.java:[21,9] unreachable statement
|
||||
@@ -0,0 +1,16 @@
|
||||
$ java ... # JDK 25, recipe output plus the one hand edit, runtime classpath
|
||||
running on java.version 25.0.5.1
|
||||
[ok] jaxb: <order><id>A-1</id><quantity>12</quantity></order>
|
||||
[FAIL] jaxws: javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found
|
||||
[ok] base64: YW5rdXI=
|
||||
[FAIL] nashorn: java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "js" is null
|
||||
[ok] version: major=0
|
||||
[FAIL] classloader: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
|
||||
[FAIL] reflection: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.lang.Object[] java.util.ArrayList.elementData accessible: module java.base does not "opens java.util" to unnamed module @1517365b
|
||||
[FAIL] securitymanager: java.lang.UnsupportedOperationException: Setting a Security Manager is not supported
|
||||
[ok] thread.stop: still alive
|
||||
date(en_US) = Mar 5, 2026, 2:30\u202FPM
|
||||
date(de_DE) = Donnerstag, 5. M\u00E4rz 2026
|
||||
money(en_IN) = \u20B91,234,567.50
|
||||
defaultCharset = UTF-8
|
||||
rupee as bytes = 3 byte(s)
|
||||
@@ -0,0 +1,20 @@
|
||||
################ lombok 1.18.20 with -processorpath
|
||||
An annotation processor threw an uncaught exception.
|
||||
Caused by: java.lang.NoSuchFieldException: com.sun.tools.javac.code.TypeTag :: UNKNOWN
|
||||
################ lombok 1.18.36 with -processorpath
|
||||
An annotation processor threw an uncaught exception.
|
||||
Caused by: java.lang.NoSuchFieldException: com.sun.tools.javac.code.TypeTag :: UNKNOWN
|
||||
################ lombok 1.18.38 with -processorpath
|
||||
getter says ankur
|
||||
################ lombok 1.18.40 with -processorpath
|
||||
getter says ankur
|
||||
################ lombok 1.18.48 with -processorpath
|
||||
getter says ankur
|
||||
################ lombok 1.18.48 on the class path only (what a pom with just the dependency does)
|
||||
./probes/libs/LombokBean.java:7: error: constructor LombokBean in class LombokBean cannot be applied to given types;
|
||||
System.out.println("getter says " + new LombokBean("ankur").getName());
|
||||
^
|
||||
required: no arguments
|
||||
found: String
|
||||
reason: actual and formal argument lists differ in length
|
||||
1 error
|
||||
@@ -0,0 +1,9 @@
|
||||
################ mockito-core 2.28.2 (byte-buddy 1.9.10)
|
||||
mocked price 42
|
||||
################ mockito-core 4.11.0 (byte-buddy 1.12.19)
|
||||
mocked price 42
|
||||
################ mockito-core 5.14.2 (byte-buddy 1.15.11)
|
||||
Mockito cannot mock this class: class MockDemo$PriceService.
|
||||
Caused by: java.lang.IllegalArgumentException: Java 25 (69) is not supported by the current version of Byte Buddy which officially supports Java 24 (68) - update Byte Buddy or set net.bytebuddy.experimental as a VM property
|
||||
################ mockito-core 5.25.0 (byte-buddy 1.18.17)
|
||||
mocked price 42
|
||||
@@ -0,0 +1,8 @@
|
||||
################ asm 9.2
|
||||
Exception in thread "main" java.lang.IllegalArgumentException: Unsupported class file major version 69
|
||||
################ asm 9.7.1
|
||||
Exception in thread "main" java.lang.IllegalArgumentException: Unsupported class file major version 69
|
||||
################ asm 9.8
|
||||
parsed AsmRead
|
||||
################ asm 9.11.1
|
||||
parsed AsmRead
|
||||
@@ -0,0 +1,9 @@
|
||||
################ jacoco agent 0.8.11
|
||||
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 69
|
||||
hello from a Java 25 class
|
||||
################ jacoco agent 0.8.13
|
||||
hello from a Java 25 class
|
||||
################ jacoco agent 0.8.14
|
||||
hello from a Java 25 class
|
||||
################ jacoco agent 0.8.16
|
||||
hello from a Java 25 class
|
||||
@@ -0,0 +1,6 @@
|
||||
################ Spring Boot 2.7.18 on JDK 25, application compiled with --release 8
|
||||
context started
|
||||
################ Spring Boot 2.7.18 on JDK 25, application compiled with --release 25
|
||||
2026-12-03 23:44:39.780 WARN 22340 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to rea
|
||||
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [./build/libs/bt/app/DemoApp.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - pro
|
||||
Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [./build/libs/bt/app/DemoApp.class]; nested exception is java.lang.IllegalArgumentE
|
||||
@@ -0,0 +1,11 @@
|
||||
################ maven.compiler.source/target=1.7, JDK 25
|
||||
[ERROR] Source option 7 is no longer supported. Use 8 or later.
|
||||
[ERROR] Target option 7 is no longer supported. Use 8 or later.
|
||||
[INFO] BUILD FAILURE
|
||||
[ERROR] Source option 7 is no longer supported. Use 8 or later.
|
||||
[ERROR] Target option 7 is no longer supported. Use 8 or later.
|
||||
################ maven.compiler.source/target=1.8, JDK 25
|
||||
[WARNING] source value 8 is obsolete and will be removed in a future release
|
||||
[WARNING] target value 8 is obsolete and will be removed in a future release
|
||||
[WARNING] To suppress warnings about obsolete options, use -Xlint:-options.
|
||||
[INFO] BUILD SUCCESS
|
||||
@@ -0,0 +1,12 @@
|
||||
$ gradle compileJava # Gradle 8.14.3, JAVA_HOME = JDK 25
|
||||
exit status: 1
|
||||
FAILURE: Build failed with an exception.
|
||||
* What went wrong:
|
||||
BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 69
|
||||
> Unsupported class file major version 69
|
||||
* Try:
|
||||
> Run with --stacktrace option to get the stack trace.
|
||||
> Run with --info or --debug option to get more log output.
|
||||
> Run with --scan to get full insights.
|
||||
> Get more help at https://help.gradle.org.
|
||||
BUILD FAILED in 4s
|
||||
@@ -0,0 +1,21 @@
|
||||
$ java JavaxMap.java # JDK 25
|
||||
exported javax.* packages in this JDK: 99
|
||||
javax.sql in the JDK, keep javax
|
||||
javax.crypto in the JDK, keep javax
|
||||
javax.net.ssl in the JDK, keep javax
|
||||
javax.naming in the JDK, keep javax
|
||||
javax.management in the JDK, keep javax
|
||||
javax.script in the JDK, keep javax
|
||||
javax.swing in the JDK, keep javax
|
||||
javax.xml.parsers in the JDK, keep javax
|
||||
javax.transaction.xa in the JDK, keep javax
|
||||
javax.annotation.processing in the JDK, keep javax
|
||||
javax.xml.bind not in the JDK
|
||||
javax.xml.ws not in the JDK
|
||||
javax.jws not in the JDK
|
||||
javax.activation not in the JDK
|
||||
javax.annotation not in the JDK
|
||||
javax.transaction not in the JDK
|
||||
javax.servlet not in the JDK
|
||||
javax.persistence not in the JDK
|
||||
javax.validation not in the JDK
|
||||
@@ -0,0 +1,6 @@
|
||||
$ java Mixed # javax annotations on the bean, jakarta JAXB runtime
|
||||
Exception in thread "main" jakarta.xml.bind.MarshalException
|
||||
- with linked exception:
|
||||
[com.sun.istack.SAXException2: unable to marshal type "Mixed$Order" as an element because it is missing an @XmlRootElement annotation]
|
||||
Caused by: com.sun.istack.SAXException2: unable to marshal type "Mixed$Order" as an element because it is missing an @XmlRootElement annotation
|
||||
... 3 more
|
||||
@@ -0,0 +1,16 @@
|
||||
$ java -cp classes-built-by-jdk8:bridge-jars-without-nashorn com.ankurm.legacy.App # JDK 8
|
||||
running on java.version 1.8.0_514
|
||||
[ok] jaxb: <order><id>A-1</id><quantity>12</quantity></order>
|
||||
[ok] jaxws: WSDL served
|
||||
[ok] base64: YW5rdXI=
|
||||
[ok] nashorn: BULK
|
||||
[ok] version: major=8
|
||||
[ok] classloader: classpath found=1
|
||||
[ok] reflection: ArrayList capacity=32
|
||||
[ok] securitymanager: blocked: plugins may not exit the JVM
|
||||
[ok] thread.stop: stopped
|
||||
date(en_US) = Mar 5, 2026 2:30 PM
|
||||
date(de_DE) = Donnerstag, 5. M\u00E4rz 2026
|
||||
money(en_IN) = Rs.1,234,567.50
|
||||
defaultCharset = US-ASCII
|
||||
rupee as bytes = 1 byte(s)
|
||||
@@ -0,0 +1,20 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** Which javax.* packages does this JDK still contain, and which Java EE ones are gone? */
|
||||
public class JavaxMap {
|
||||
public static void main(String[] args) {
|
||||
List<String> inJdk = new ArrayList<>();
|
||||
ModuleLayer.boot().modules().forEach(m -> m.getPackages().stream()
|
||||
.filter(p -> p.startsWith("javax.") && m.getDescriptor().exports().stream()
|
||||
.anyMatch(e -> e.source().equals(p) && !e.isQualified()))
|
||||
.forEach(inJdk::add));
|
||||
System.out.println("exported javax.* packages in this JDK: " + inJdk.size());
|
||||
for (String p : new String[] {"javax.sql", "javax.crypto", "javax.net.ssl", "javax.naming",
|
||||
"javax.management", "javax.script", "javax.swing", "javax.xml.parsers", "javax.transaction.xa",
|
||||
"javax.annotation.processing", "javax.xml.bind", "javax.xml.ws", "javax.jws", "javax.activation",
|
||||
"javax.annotation", "javax.transaction", "javax.servlet", "javax.persistence", "javax.validation"}) {
|
||||
System.out.printf(" %-28s %s%n", p, inJdk.contains(p) ? "in the JDK, keep javax" : "not in the JDK");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import org.objectweb.asm.ClassReader;
|
||||
|
||||
/** Reads its own class file, which javac 25 writes as major version 69. */
|
||||
public class AsmRead {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ClassReader r = new ClassReader(AsmRead.class.getResourceAsStream("AsmRead.class"));
|
||||
System.out.println("parsed " + r.getClassName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class Hello {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("hello from a Java 25 class");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@lombok.Getter
|
||||
@lombok.AllArgsConstructor
|
||||
public class LombokBean {
|
||||
private final String name;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("getter says " + new LombokBean("ankur").getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class MockDemo {
|
||||
public static class PriceService {
|
||||
public int price() { return 100; }
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
PriceService s = mock(PriceService.class);
|
||||
when(s.price()).thenReturn(42);
|
||||
System.out.println("mocked price " + s.price());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/** A minimal Spring Boot 2.7 (javax era) app: component scanning reads class files with ASM. */
|
||||
@SpringBootApplication
|
||||
public class DemoApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApp.class, args).close();
|
||||
System.out.println("context started");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package app;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class Greeter { }
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ankurm</groupId>
|
||||
<artifactId>boot27-classpath</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>2.7.18</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ankurm</groupId>
|
||||
<artifactId>mixed-namespaces</artifactId>
|
||||
<version>1.0</version>
|
||||
<properties>
|
||||
<maven.compiler.release>25</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- A half-finished migration: old annotations still on the beans ... -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
<!-- ... but the new jakarta runtime doing the work. -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>4.0.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.io.StringWriter;
|
||||
import jakarta.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
public class Mixed {
|
||||
@XmlRootElement(name = "order")
|
||||
public static class Order {
|
||||
public String id = "A-1";
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
StringWriter out = new StringWriter();
|
||||
JAXBContext.newInstance(Order.class).createMarshaller().marshal(new Order(), out);
|
||||
System.out.println(out);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.security.KeyStore;
|
||||
import java.security.Security;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLParameters;
|
||||
import javax.net.ssl.SSLServerSocket;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
/** Prints the TLS and keystore defaults of the running JDK and tries three handshakes.
|
||||
* Usage: java CryptoDefaults keystore.p12 (store password "changeit"). Compiles on JDK 8. */
|
||||
public class CryptoDefaults {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("java.version = " + System.getProperty("java.version"));
|
||||
System.out.println("keystore.type = " + KeyStore.getDefaultType());
|
||||
SSLParameters p = SSLContext.getDefault().getDefaultSSLParameters();
|
||||
System.out.println("protocols = " + Arrays.toString(p.getProtocols()));
|
||||
List<String> rsaKx = new ArrayList<String>();
|
||||
for (String s : p.getCipherSuites()) if (s.startsWith("TLS_RSA_")) rsaKx.add(s);
|
||||
System.out.println("cipher suites = " + p.getCipherSuites().length + " enabled, "
|
||||
+ rsaKx.size() + " of them TLS_RSA_*");
|
||||
for (String key : new String[] {"jdk.tls.disabledAlgorithms", "jdk.jar.disabledAlgorithms"}) {
|
||||
System.out.println(key + " =");
|
||||
for (String item : Security.getProperty(key).split(",")) System.out.println(" " + item.trim());
|
||||
}
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("PKCS12");
|
||||
try (FileInputStream in = new FileInputStream(args[0])) { ks.load(in, "changeit".toCharArray()); }
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||
kmf.init(ks, "changeit".toCharArray());
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||
tmf.init(ks);
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
|
||||
|
||||
handshake(ctx, "TLSv1.2 default suites", "TLSv1.2", null);
|
||||
handshake(ctx, "TLSv1.1 only", "TLSv1.1", null);
|
||||
handshake(ctx, "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLSv1.2", "TLS_RSA_WITH_AES_128_GCM_SHA256");
|
||||
}
|
||||
|
||||
static void handshake(SSLContext ctx, String label, String protocol, String suite) throws Exception {
|
||||
final SSLServerSocket server = (SSLServerSocket) ctx.getServerSocketFactory().createServerSocket(0);
|
||||
server.setEnabledProtocols(new String[] {"TLSv1.2", "TLSv1.1"});
|
||||
server.setEnabledCipherSuites(server.getSupportedCipherSuites());
|
||||
Thread t = new Thread(() -> {
|
||||
try (SSLSocket s = (SSLSocket) server.accept()) { s.startHandshake(); s.getOutputStream().write(1); }
|
||||
catch (Exception ignored) { }
|
||||
});
|
||||
t.start();
|
||||
try (SSLSocket c = (SSLSocket) ctx.getSocketFactory().createSocket("localhost", server.getLocalPort())) {
|
||||
c.setEnabledProtocols(new String[] {protocol});
|
||||
if (suite != null) c.setEnabledCipherSuites(new String[] {suite});
|
||||
c.startHandshake();
|
||||
c.getInputStream().read();
|
||||
System.out.println("[ok] " + label + " -> " + c.getSession().getProtocol() + " " + c.getSession().getCipherSuite());
|
||||
} catch (Exception e) {
|
||||
System.out.println("[FAIL] " + label + " -> " + e.getClass().getName() + ": " + e.getMessage());
|
||||
} finally {
|
||||
t.join(3000);
|
||||
server.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# The legacy app: build and run on 8, run the SAME classes on 25, then try to compile on 25.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
cd "$ROOT/legacy"
|
||||
SRC=$(find src -name '*.java' | sort)
|
||||
rm -rf "$WORK/c8" "$WORK/c25" "$WORK/r8"; mkdir -p "$WORK/c8" "$WORK/c25" "$WORK/r8"
|
||||
|
||||
{ echo '$ javac -version # JDK 8, no -encoding flag, LANG=C'
|
||||
"$JDK8/bin/javac" -d "$WORK/c8" $SRC 2>&1 | clean; } > "$OUT/01-jdk8-compile-no-encoding.txt"
|
||||
"$JDK8/bin/javac" -encoding UTF-8 -nowarn -d "$WORK/c8" $SRC 2>&1 | clean
|
||||
|
||||
{ echo '$ java -version'; "$JDK8/bin/java" -version 2>&1 | clean
|
||||
echo; echo '$ java -cp classes-built-by-jdk8 com.ankurm.legacy.App'
|
||||
"$JDK8/bin/java" -cp "$WORK/c8" com.ankurm.legacy.App 2>&1 | clean; } > "$OUT/02-run-on-jdk8.txt"
|
||||
|
||||
{ echo '$ java -version'; "$JDK25/bin/java" -version 2>&1 | clean
|
||||
echo; echo '$ java -cp classes-built-by-jdk8 com.ankurm.legacy.App'
|
||||
"$JDK25/bin/java" -cp "$WORK/c8" com.ankurm.legacy.App 2>&1 | clean; } > "$OUT/03-jdk8-classes-on-jdk25.txt"
|
||||
|
||||
{ echo '$ javac -encoding UTF-8 ... # JDK 25'
|
||||
"$JDK25/bin/javac" -encoding UTF-8 -d "$WORK/c25" $SRC 2>&1 | clean; } > "$OUT/04-jdk25-compile.txt"
|
||||
|
||||
{ echo '$ javac --release 8 ... # JDK 25, all sources except Tokens.java and App.java'
|
||||
"$JDK25/bin/javac" --release 8 -encoding UTF-8 -d "$WORK/r8" $(find src -name '*.java' | grep -v -e Tokens -e App.java | sort) 2>&1 | clean
|
||||
echo "exit status: ${PIPESTATUS[0]}"
|
||||
echo; echo '$ ls r8/com/ankurm/legacy'; ls "$WORK/r8/com/ankurm/legacy"
|
||||
echo; echo '$ javac --release 8 Tokens.java'
|
||||
"$JDK25/bin/javac" -Xlint:-options --release 8 -d "$WORK/r8" src/main/java/com/ankurm/legacy/Tokens.java 2>&1 | clean
|
||||
} > "$OUT/05-jdk25-release8.txt"
|
||||
|
||||
if [ -n "${JDK17:-}" ]; then
|
||||
{ echo '$ java -cp classes-built-by-jdk8 com.ankurm.legacy.App # JDK 17, the middle of the staged path'
|
||||
"$JDK17/bin/java" -cp "$WORK/c8" com.ankurm.legacy.App 2>&1 | clean; } > "$OUT/03b-jdk8-classes-on-jdk17.txt"
|
||||
fi
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# What jdeps and jdeprscan can and cannot see in the JDK 8 jar. Run 01-legacy.sh first.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
"$JDK25/bin/jar" --create --file "$WORK/legacy.jar" -C "$WORK/c8" . 2>&1 | clean
|
||||
cd "$WORK"
|
||||
{ echo '$ jdeps --jdk-internals legacy.jar'; "$JDK25/bin/jdeps" --jdk-internals legacy.jar 2>&1 | clean; } > "$OUT/06-jdeps-jdk-internals.txt"
|
||||
{ echo '$ jdeps -verbose:package legacy.jar'; "$JDK25/bin/jdeps" -verbose:package legacy.jar 2>&1 | clean; } > "$OUT/07-jdeps-packages.txt"
|
||||
{ echo '$ jdeprscan --release 25 legacy.jar'; "$JDK25/bin/jdeprscan" --release 25 legacy.jar 2>&1 | clean; } > "$OUT/08-jdeprscan.txt"
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# One JDK 8 era option at a time: java <flag> -version on 8, 17 and 25.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
JDK17=${JDK17:?set JDK17 to a JDK 17 home}
|
||||
mkdir -p "$WORK/flags"; cd "$WORK/flags"
|
||||
{
|
||||
while read -r flag; do
|
||||
[ -z "$flag" ] && continue
|
||||
echo "################ $flag"
|
||||
for pair in "8:$JDK8" "17:$JDK17" "25:$JDK25"; do
|
||||
v=${pair%%:*}; home=${pair#*:}
|
||||
o=$("$home/bin/java" -XX:-UsePerfData $flag -version 2>&1); rc=$?
|
||||
echo "JDK $v exit=$rc"
|
||||
echo "$o" | clean | sed "s#$JDK17#\$JDK17#g" | grep -v -e 'openjdk version' -e 'Runtime Environment' -e 'Server VM (' -e "$JDK17" | head -4 | sed -e 's/^/ /' -e 's/\[0\.[0-9]*s\]/[0.0NNs]/'
|
||||
done
|
||||
done < "$ROOT/flags/jdk8-flags.txt"
|
||||
} > "$OUT/09-jvm-flags.txt"
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# GC and heap defaults, TLS/keystore defaults, and a SHA-1 signed jar. Needs JDK17 too.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
JDK17=${JDK17:?set JDK17 to a JDK 17 home}
|
||||
rm -rf "$WORK/tls"; mkdir -p "$WORK/tls"; cd "$WORK/tls"
|
||||
|
||||
{ for pair in "8:$JDK8" "17:$JDK17" "25:$JDK25"; do
|
||||
v=${pair%%:*}; home=${pair#*:}
|
||||
for cpus in 2 1; do
|
||||
echo "################ JDK $v, -XX:ActiveProcessorCount=$cpus"
|
||||
if [ "$v" = 8 ] && ! "$home/bin/java" -XX:ActiveProcessorCount=$cpus -version >/dev/null 2>&1; then echo "flag not supported"; continue; fi
|
||||
"$home/bin/java" -XX:ActiveProcessorCount=$cpus -XX:+PrintFlagsFinal -version 2>/dev/null |
|
||||
awk '$2 ~ /^(UseSerialGC|UseParallelGC|UseG1GC|UseCompressedOops|UseCompactObjectHeaders|MaxHeapSize|UseContainerSupport|UseStringDeduplication)$/ {printf " %-24s %s\n", $2, $4}' | sort
|
||||
done
|
||||
done
|
||||
echo "################ JDK 8 with 1 CPU: no UseXxxGC flag is set, so ask for the heap layout"
|
||||
"$JDK8/bin/java" -XX:ActiveProcessorCount=1 -XX:+PrintGCDetails -version 2>&1 | clean | grep -e generation -e PSYoungGen | sed 's/ *total.*//'; } > "$OUT/10-gc-defaults.txt"
|
||||
|
||||
"$JDK25/bin/keytool" -genkeypair -keystore ks.p12 -storepass changeit -alias k -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -dname CN=localhost -ext san=dns:localhost -validity 3650 2>&1 | clean >/dev/null
|
||||
"$JDK8/bin/javac" -d . "$ROOT/probes/tls/CryptoDefaults.java" 2>&1 | clean
|
||||
{ for pair in "8:$JDK8" "17:$JDK17" "25:$JDK25"; do
|
||||
v=${pair%%:*}; home=${pair#*:}
|
||||
echo "################ JDK $v"
|
||||
"$home/bin/java" -cp . CryptoDefaults ks.p12 2>&1 | clean
|
||||
done; } > "$OUT/11-tls-crypto-defaults.txt"
|
||||
|
||||
# A jar signed the old way (SHA-1 digest, SHA1withRSA) on JDK 8, then verified on 8 and 25.
|
||||
echo hello > hello.txt
|
||||
"$JDK8/bin/jar" cf signed.jar hello.txt 2>&1 | clean
|
||||
"$JDK8/bin/keytool" -genkeypair -keystore sign.jks -storepass changeit -keypass changeit -alias s -keyalg RSA -keysize 2048 -sigalg SHA1withRSA -dname CN=build -validity 3650 2>&1 | clean >/dev/null
|
||||
"$JDK8/bin/jarsigner" -keystore sign.jks -storepass changeit -digestalg SHA-1 -sigalg SHA1withRSA signed.jar s 2>&1 | clean >/dev/null
|
||||
{ for pair in "8:$JDK8" "25:$JDK25"; do
|
||||
v=${pair%%:*}; home=${pair#*:}
|
||||
echo "################ JDK $v: jarsigner -verify signed.jar"
|
||||
"$home/bin/jarsigner" -verify signed.jar 2>&1 | clean | head -14
|
||||
done; } > "$OUT/12-sha1-signed-jar.txt"
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Needs Maven. Stage 1 (old bytecode on 25 with stopgaps), the fixed app, and OpenRewrite.
|
||||
# Set MVN_SETTINGS to use a mirror. Run 01-legacy.sh first.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
MVN="mvn -B ${MVN_SETTINGS:+-s $MVN_SETTINGS}"
|
||||
|
||||
(cd "$ROOT/bridge" && JAVA_HOME=$JDK25 $MVN -q dependency:copy-dependencies 2>&1 | grep ERROR)
|
||||
CP="$WORK/c8:$(ls "$ROOT"/bridge/target/dependency/*.jar | tr '\n' ':')"
|
||||
{ echo '$ java --add-opens java.base/java.util=ALL-UNNAMED -Dfile.encoding=COMPAT -Djava.locale.providers=COMPAT \'
|
||||
echo ' -cp classes-built-by-jdk8:bridge-jars com.ankurm.legacy.App # JDK 25'
|
||||
"$JDK25/bin/java" --add-opens java.base/java.util=ALL-UNNAMED -Dfile.encoding=COMPAT -Djava.locale.providers=COMPAT -cp "$CP" com.ankurm.legacy.App 2>&1 | clean; } > "$OUT/13-bridge-on-jdk25.txt"
|
||||
|
||||
(cd "$ROOT/fixed" && JAVA_HOME=$JDK25 $MVN -q clean compile dependency:copy-dependencies 2>&1 | grep -v -e '^Picked' -e '^WARNING' )
|
||||
{ echo '$ java -cp target/classes:target/dependency/* com.ankurm.fixed.App # JDK 25'
|
||||
cd "$ROOT/fixed" && "$JDK25/bin/java" -cp "target/classes:target/dependency/*" com.ankurm.fixed.App 2>&1 | clean | sed -e 's/^[A-Z][a-z][a-z] [0-9][0-9], [0-9]* [0-9:]* [AP]M /<timestamp> /'; } > "$OUT/14-fixed-on-jdk25.txt"
|
||||
|
||||
# OpenRewrite on a throwaway copy, run on JDK 8 (the code still builds there).
|
||||
rm -rf "$WORK/rw"; cp -r "$ROOT/legacy" "$WORK/rw"; rm -rf "$WORK/rw/target"
|
||||
cd "$WORK/rw"; git init -q; git add -A; git -c user.name=demo -c user.email=[email protected] commit -qm base
|
||||
JAVA_HOME=$JDK8 $MVN -q -U org.openrewrite.maven:rewrite-maven-plugin:6.46.1:run \
|
||||
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:3.42.1 \
|
||||
-Drewrite.activeRecipes=org.openrewrite.java.migrate.UpgradeToJava25 -Drewrite.exportDatatables=false > ../rewrite.log 2>&1 || { tail -20 ../rewrite.log; exit 1; }
|
||||
git diff --stat > "$OUT/15-openrewrite-diff.txt"; echo >> "$OUT/15-openrewrite-diff.txt"; git diff >> "$OUT/15-openrewrite-diff.txt"
|
||||
|
||||
{ echo '$ mvn clean compile # JDK 25, straight after the recipe'
|
||||
JAVA_HOME=$JDK25 $MVN clean compile 2>&1 | clean | grep -e 'ERROR.*java' -e 'BUILD' | head -4 | sed 's#\./build/rw/##'; } > "$OUT/16-openrewrite-build.txt"
|
||||
|
||||
# One hand edit (replace the injected throw) so the rest can be run.
|
||||
python3 -I - <<'PY'
|
||||
p = 'src/main/java/com/ankurm/legacy/Watchdog.java'
|
||||
s = open(p).read()
|
||||
a = s.index(' /*\n * `Thread'); b = s.index('worker.join')
|
||||
open(p, 'w').write(s[:a] + ' worker.interrupt(); // hand edit\n ' + s[b:])
|
||||
PY
|
||||
JAVA_HOME=$JDK25 $MVN -q clean compile dependency:copy-dependencies -DincludeScope=runtime 2>&1 | grep '^\[ERROR'
|
||||
{ echo '$ java ... # JDK 25, recipe output plus the one hand edit, runtime classpath'
|
||||
"$JDK25/bin/java" -cp "target/classes:target/dependency/*" com.ankurm.legacy.App 2>&1 | clean; } > "$OUT/17-openrewrite-run.txt"
|
||||
|
||||
# The JAXB/JAX-WS 2.3 jars can already be added while production is still on 8 (nashorn-core needs a newer JDK).
|
||||
CP8="$WORK/c8:$(ls "$ROOT"/bridge/target/dependency/*.jar | grep -v nashorn | tr '\n' ':')"
|
||||
{ echo '$ java -cp classes-built-by-jdk8:bridge-jars-without-nashorn com.ankurm.legacy.App # JDK 8'
|
||||
"$JDK8/bin/java" -cp "$CP8" com.ankurm.legacy.App 2>&1 | clean; } > "$OUT/27-bridge-jars-on-jdk8.txt"
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Which versions of common build-time libraries work on JDK 25. Downloads jars with curl; needs Maven for Boot.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
REPO=${REPO:-https://repo1.maven.org/maven2}
|
||||
MVN="mvn -B ${MVN_SETTINGS:+-s $MVN_SETTINGS}"
|
||||
J="$JDK25/bin/java"; JC="$JDK25/bin/javac"
|
||||
W="$WORK/libs"; rm -rf "$W"; mkdir -p "$W/jars"; cd "$W"
|
||||
get() { # groupPath artifact version
|
||||
[ -f "jars/$2-$3.jar" ] || curl -sSf -o "jars/$2-$3.jar" "$REPO/$1/$2/$3/$2-$3.jar"; }
|
||||
head3() { clean | grep -v -e '^WARNING' -e '^\s*at ' | head -${1:-4}; }
|
||||
|
||||
{ for v in 1.18.20 1.18.36 1.18.38 1.18.40 1.18.48; do
|
||||
get org/projectlombok lombok $v; rm -rf lb; mkdir lb
|
||||
echo "################ lombok $v with -processorpath"
|
||||
if "$JC" -d lb -cp jars/lombok-$v.jar -processorpath jars/lombok-$v.jar "$ROOT/probes/libs/LombokBean.java" > lb.log 2>&1; then
|
||||
"$J" -cp lb LombokBean 2>&1 | clean; else clean < lb.log | grep -m3 -e "uncaught exception" -e "Error:" -e "Exception:" -e "^error" | cut -c1-230; fi
|
||||
done
|
||||
rm -rf lb; mkdir lb
|
||||
echo "################ lombok 1.18.48 on the class path only (what a pom with just the dependency does)"
|
||||
if "$JC" -d lb -cp jars/lombok-1.18.48.jar "$ROOT/probes/libs/LombokBean.java" > lb.log 2>&1; then
|
||||
"$J" -cp lb LombokBean 2>&1 | clean; else head3 12 < lb.log; fi
|
||||
} > "$OUT/18-lombok.txt"
|
||||
|
||||
{ for pair in "2.28.2 1.9.10 2.6" "4.11.0 1.12.19 3.3" "5.14.2 1.15.11 3.3" "5.25.0 1.18.17 3.3"; do
|
||||
set -- $pair; get org/mockito mockito-core $1; get net/bytebuddy byte-buddy $2; get net/bytebuddy byte-buddy-agent $2; get org/objenesis objenesis $3
|
||||
CP="jars/mockito-core-$1.jar:jars/byte-buddy-$2.jar:jars/byte-buddy-agent-$2.jar:jars/objenesis-$3.jar"
|
||||
rm -rf mk; mkdir mk; "$JC" -d mk -cp "$CP" "$ROOT/probes/libs/MockDemo.java" 2>&1 | clean
|
||||
echo "################ mockito-core $1 (byte-buddy $2)"
|
||||
"$J" -cp "mk:$CP" MockDemo > mk.log 2>&1
|
||||
clean < mk.log | grep -e 'mocked price' -e 'Mockito cannot mock' -e 'Java 25 (69)' -e 'Could not initialize' | head -3 | cut -c1-230
|
||||
done; } > "$OUT/19-mockito.txt"
|
||||
|
||||
{ for v in 9.2 9.7.1 9.8 9.11.1; do
|
||||
get org/ow2/asm asm $v; rm -rf as; mkdir as; "$JC" -d as -cp jars/asm-$v.jar "$ROOT/probes/libs/AsmRead.java" 2>&1 | clean
|
||||
echo "################ asm $v"
|
||||
"$J" -cp as:jars/asm-$v.jar AsmRead 2>&1 | head3 1
|
||||
done; } > "$OUT/20-asm.txt"
|
||||
|
||||
{ rm -rf jc; mkdir jc; "$JC" -d jc "$ROOT/probes/libs/Hello.java" 2>&1 | clean
|
||||
for v in 0.8.11 0.8.13 0.8.14 0.8.16; do
|
||||
curl -sSf -o jars/jacoco-agent-$v.jar "$REPO/org/jacoco/org.jacoco.agent/$v/org.jacoco.agent-$v-runtime.jar" 2>/dev/null ||
|
||||
curl -sSf -o jars/jacoco-agent-$v.jar "$REPO/org/jacoco/org.jacoco.agent/$v/org.jacoco.agent-$v-runtime.jar"
|
||||
echo "################ jacoco agent $v"
|
||||
"$J" -javaagent:jars/jacoco-agent-$v.jar=destfile=jc/x.exec -cp jc Hello > jc.log 2>&1
|
||||
clean < jc.log | grep -e '^hello' -e 'Unsupported class file' | head -2 | cut -c1-200
|
||||
done; } > "$OUT/21-jacoco.txt"
|
||||
|
||||
(cd "$ROOT/probes/libs/boot27" && JAVA_HOME=$JDK25 $MVN -q dependency:copy-dependencies -DoutputDirectory="$W/boot" 2>&1 | grep ERROR)
|
||||
{ for rel in 8 25; do
|
||||
rm -rf bt; mkdir bt
|
||||
"$JC" -Xlint:-options --release $rel -d bt -cp "boot/*" "$ROOT"/probes/libs/boot27/app/*.java 2>&1 | clean
|
||||
echo "################ Spring Boot 2.7.18 on JDK 25, application compiled with --release $rel"
|
||||
"$J" -cp "bt:boot/*" app.DemoApp --spring.main.banner-mode=off > bt.log 2>&1
|
||||
clean < bt.log | grep -e 'context started' -e 'Unsupported class file' -e 'ASM ClassReader' | head -3 | cut -c1-260
|
||||
done; } > "$OUT/22-boot27.txt"
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Old compiler levels in Maven, and an installed Gradle (set GRADLE) running on JDK 25.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
MVN="mvn -B ${MVN_SETTINGS:+-s $MVN_SETTINGS}"
|
||||
rm -rf "$WORK/build-probe"; cp -r "$ROOT/probes/build" "$WORK/build-probe"
|
||||
{ cd "$WORK/build-probe/old-source"
|
||||
for level in 1.7 1.8; do
|
||||
echo "################ maven.compiler.source/target=$level, JDK 25"
|
||||
JAVA_HOME=$JDK25 $MVN clean compile -Dlevel=$level 2>&1 | clean | grep -e '^\[ERROR\].*option' -e 'obsolete' -e 'BUILD' | head -5
|
||||
done; } > "$OUT/23-maven-old-levels.txt"
|
||||
if [ -n "${GRADLE:-}" ]; then
|
||||
{ cd "$WORK/build-probe/gradle"
|
||||
echo "\$ gradle compileJava # $("$GRADLE" --version 2>/dev/null | grep '^Gradle'), JAVA_HOME = JDK 25"
|
||||
JAVA_HOME=$JDK25 "$GRADLE" --no-daemon -q compileJava > g.log 2>&1; echo "exit status: $?"
|
||||
clean < g.log | grep -v '^\s*$' | head -12 | cut -c1-220; } > "$OUT/24-gradle-on-25.txt"
|
||||
fi
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# javax versus jakarta: what is in the JDK, and what a half-migrated classpath does. Needs Maven.
|
||||
source "$(dirname "$0")/env.sh"
|
||||
MVN="mvn -B ${MVN_SETTINGS:+-s $MVN_SETTINGS}"
|
||||
{ echo '$ java JavaxMap.java # JDK 25'; "$JDK25/bin/java" "$ROOT/probes/javax/JavaxMap.java" 2>&1 | clean; } > "$OUT/25-javax-packages.txt"
|
||||
cd "$ROOT/probes/mixed"
|
||||
JAVA_HOME=$JDK25 $MVN -q clean compile dependency:copy-dependencies 2>&1 | grep '^\[ERROR'
|
||||
{ echo '$ java Mixed # javax annotations on the bean, jakarta JAXB runtime'
|
||||
"$JDK25/bin/java" -cp "target/classes:target/dependency/*" Mixed 2>&1 | clean | grep -v '^\s*at ' | head -14; } > "$OUT/26-mixed-namespaces.txt"
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
# Shared settings. Override with: export JDK8=/path/to/jdk8 JDK25=/path/to/jdk-25
|
||||
set -u
|
||||
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
JDK8=${JDK8:?set JDK8 to a JDK 8 home}
|
||||
JDK25=${JDK25:?set JDK25 to a JDK 25 home}
|
||||
OUT=$ROOT/output
|
||||
WORK=$ROOT/build
|
||||
mkdir -p "$OUT" "$WORK"
|
||||
unset _JAVA_OPTIONS
|
||||
export LANG=C LC_ALL=C
|
||||
# Strip launcher banners about environment options, and machine paths, from transcripts.
|
||||
clean() { grep -v -e '^Picked up ' | sed -e "s#$ROOT#.#g" -e "s#$JDK8#\$JDK8#g" -e "s#$JDK25#\$JDK25#g"; }
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file in output/. Needs JDK8, JDK17, JDK25 and Maven; GRADLE is optional.
|
||||
cd "$(dirname "$0")"
|
||||
for s in 01-legacy 02-analyse 03-flags 04-gc-crypto 05-bridge-fixed-rewrite 06-libraries 07-build-tools 08-namespaces; do
|
||||
echo "== $s"; ./$s.sh
|
||||
done
|
||||
Reference in New Issue
Block a user