Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/org/javademos/init/Java15.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.jep381.SolarisSparcRemovalDemo;
import org.javademos.java15.jep383.ForeignMemoryAccessDemo;
Expand All @@ -20,6 +21,8 @@ public static ArrayList<IDemo> getDemos() {

// JEP 360
java15DemoPool.add(new SealedClassesDemo());
// JEP 372
java15DemoPool.add(new NashornRemovalDemo());
// JEP 375
java15DemoPool.add(new InstanceofPatternMatchingSecondPreview());
// JEP 381
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/org/javademos/java15/jep372/NashornRemovalDemo.java
Original file line number Diff line number Diff line change
@@ -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+
}
}
7 changes: 7 additions & 0 deletions src/main/resources/JDK15Info.json
Original file line number Diff line number Diff line change
@@ -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)",
Expand Down