[jedit:bugs] #4118 BeanShell error: module java.base does not "opens java.lang" to unnamed module

Robert Schwenn via jEdit-devel <[email protected]>
Newsgroups gmane.editors.jedit.devel
Message-ID </p/jedit/bugs/4118/bd74e8a471e1d00ef26e24b370cf740988595299.bugs@jedit.p.sourceforge.net>
I run into this issue, too. As I understood, that's a usual issue with Java 16 and later, when code isn't that usual (hacking-like). In former versions of Java such code should have raised warnings, but Java 17 raises exceptions.

I.e. the snippet "TestHashMap.size" used to work in Beanshell until Java 11, although "size" isn't a field but a method. Now with Java 17 an exception is raised (similar to the above) and the code has to be changed to "TestHashMap.size()".

Since Your example snippet seems to be accurate Java, I argue it could be a Beanshell problem and leads me to the question: 

**Is BeanShell compatible with Java 17?**


---

** [bugs:#4118] BeanShell error: module java.base does not "opens java.lang" to unnamed module**

**Status:** open
**Group:** Regressive (new to devel)
**Labels:** macro 
**Created:** Fri Apr 22, 2022 04:03 PM UTC by blurredd
**Last Updated:** Fri Apr 22, 2022 04:03 PM UTC
**Owner:** nobody


I see the following BeanShell error when running a macro that appends to a StringBuilder:

```text
Sourced file: C:\Users\User\AppData\Roaming\jEdit\macros\StringBuilderTest.bsh unknown error: Unable to make public java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder.append(java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @7c75222b : at Line: 2 :
 in file: C:\Users\User\AppData\Roaming\jEdit\macros\StringBuilderTest.bsh
 : sb .append ( "test" ) 

	at org.gjt.sp.jedit.bsh.Interpreter.eval(Interpreter.java:696)
	at org.gjt.sp.jedit.BeanShell._runScript(BeanShell.java:343)
	at org.gjt.sp.jedit.BeanShell._runScript(BeanShell.java:291)
	at org.gjt.sp.jedit.BeanShell.runScript(BeanShell.java:217)
	at org.gjt.sp.jedit.Macros$BeanShellHandler.runMacro(Macros.java:1108)
	at org.gjt.sp.jedit.Macros$Macro.invoke(Macros.java:530)
	at org.gjt.sp.jedit.gui.InputHandler.invokeAction(InputHandler.java:343)
	at org.gjt.sp.jedit.jEdit$3.invokeAction(jEdit.java:3417)
	at org.gjt.sp.jedit.jEdit$3.invokeAction(jEdit.java:3399)
	at org.gjt.sp.jedit.EditAction$Wrapper.actionPerformed(EditAction.java:225)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
...
```

StringBuilderTest.bsh:

```java
StringBuilder sb = new StringBuilder():
sb.append("test");
```

I'm using jEdit 5.6.0, java version 17.0.2 on Windows 10 Enterprise.




---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/jedit/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/jedit/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.

-- 
-----------------------------------------------
jEdit Developers' List
[email protected]
https://lists.sourceforge.net/lists/listinfo/jedit-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.