Bug 169296 - Replace beanshell scripting with JShell
Summary: Replace beanshell scripting with JShell
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Beanshell-Editor Macro
  Show dependency treegraph
 
Reported: 2025-11-06 14:55 UTC by Hossein
Modified: 2025-11-06 15:38 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2025-11-06 14:55:49 UTC
Description:
Beanshell has been the de facto library to provide interactive Java shell for many years. But, since Java 9 in 2017, JShell is the standard Java REPL (read–eval–print loop) which is available in JDK:

JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)
https://openjdk.org/jeps/222

Suggested Enhancement:
The suggestion here is to replace the beanshell inside LibreOffice with JShell.

Rationale:
Although BeanShell is still available, it is no longer actively developed. Latest commit goes back to August 2024, which is more than a year ago:
https://github.com/beanshell/beanshell/commits/master

and the last release is from Dec 2022, which is around 3 years ago.
https://github.com/beanshell/beanshell/releases

Also, it can be read in JEP 222 (link above) that BeanShell is not entirely compatible with the latest Java features, and that is the case since Java 1.4 (2002-2003):
"Another alternative is to maintain the status quo: Use another language or use a third-party REPL such as BeanShell, though that particular REPL has been dormant for many years, is based on JDK 1.3, and makes arbitrary changes to the language."

Additional information:
More information can be found in JDK Javadoc for the jdk.jshell module:

Module jdk.jshell
https://docs.oracle.com/en/java/javase/25/docs/api/jdk.jshell/module-summary.html

Introduction to JShell
https://docs.oracle.com/en/java/javase/11/jshell/introduction-jshell.html#GUID-465BA4F5-E77D-456F-BCB7-D826AC1E18AE

10 things developers need to know about JShell
https://developers.redhat.com/blog/2019/04/05/10-things-developers-need-to-know-about-jshell

Notes:
JShell uses a separate Java VM instance.
https://stackoverflow.com/q/44929943