From ae4d43ed6e40285fab61f31004289ed48135bd85 Mon Sep 17 00:00:00 2001 From: Nikesh-koila Date: Fri, 24 Oct 2025 18:21:57 +0530 Subject: [PATCH] feat(java15): Add demo placeholder for JEP 372 Nashorn Removal --- src/main/java/org/javademos/init/Java15.java | 3 ++ .../java15/jep372/NashornRemovalDemo.java | 30 +++++++++++++++++++ src/main/resources/JDK15Info.json | 7 +++++ 3 files changed, 40 insertions(+) create mode 100644 src/main/java/org/javademos/java15/jep372/NashornRemovalDemo.java diff --git a/src/main/java/org/javademos/init/Java15.java b/src/main/java/org/javademos/init/Java15.java index da62cc66..bc2205ea 100644 --- a/src/main/java/org/javademos/init/Java15.java +++ b/src/main/java/org/javademos/init/Java15.java @@ -4,6 +4,7 @@ import org.javademos.commons.IDemo; import org.javademos.java15.jep360.SealedClassesDemo; +import org.javademos.java15.jep372.NashornRemovalDemo; import org.javademos.java15.jep375.InstanceofPatternMatchingSecondPreview; import org.javademos.java15.jep383.ForeignMemoryAccessDemo; import org.javademos.java15.jep384.RecordsSecondPreviewDemo; @@ -19,6 +20,8 @@ public static ArrayList getDemos() { // JEP 360 java15DemoPool.add(new SealedClassesDemo()); + // JEP 372 + java15DemoPool.add(new NashornRemovalDemo()); // JEP 375 java15DemoPool.add(new InstanceofPatternMatchingSecondPreview()); // JEP 383 diff --git a/src/main/java/org/javademos/java15/jep372/NashornRemovalDemo.java b/src/main/java/org/javademos/java15/jep372/NashornRemovalDemo.java new file mode 100644 index 00000000..073b616a --- /dev/null +++ b/src/main/java/org/javademos/java15/jep372/NashornRemovalDemo.java @@ -0,0 +1,30 @@ +package org.javademos.java15.jep372; + +import org.javademos.commons.IDemo; + +/// ## JEP 372: Remove the Nashorn JavaScript Engine +/// +/// ### History +/// Nashorn was introduced in Java 8 (JEP 174) as a replacement for the older +/// Rhino engine. However, with the rapid evolution of ECMAScript (JavaScript), +/// maintaining Nashorn became difficult. It was deprecated in Java 11 (JEP 335) +/// and removed entirely by this JEP. +/// +/// ### Links +/// - [Official JEP 372](https://openjdk.org/jeps/372) +/// +/// @since Java 15 +public class NashornRemovalDemo implements IDemo { + + @Override + public void demo() { + // Call info helper + info(372); + + // This JEP removed the Nashorn JavaScript engine, APIs, and the jjs tool. + // There are no specific APIs or language features to demonstrate its absence. + // Trying to import or use classes from the jdk.nashorn package would now + // result in a compilation error. For example: + // import jdk.nashorn.api.scripting.NashornScriptEngineFactory; // This import fails in JDK 15+ + } +} \ No newline at end of file diff --git a/src/main/resources/JDK15Info.json b/src/main/resources/JDK15Info.json index 30d95232..739ecec5 100644 --- a/src/main/resources/JDK15Info.json +++ b/src/main/resources/JDK15Info.json @@ -1,4 +1,11 @@ [ { + "jep": 372, + "info": { + "name": "JEP 372 - Remove the Nashorn JavaScript Engine", + "dscr": "Remove the Nashorn JavaScript script engine, APIs, and the jjs tool. No code demo applicable as the feature was removed." + } + }, +{ "jep": 375, "info": { "name": "JEP 375 - Pattern Matching for instanceof (Second Preview)",