jshell --enable-preview --execution=local bug?
Michel Trudeau
michel.trudeau at oracle.com
Wed May 17 18:24:33 UTC 2023
Max,
FYI – https://bugs.openjdk.org/browse/JDK-8308305
-Michel
From: kulla-dev <kulla-dev-retn at openjdk.org> on behalf of Max Rydahl Andersen <manderse at redhat.com>
Date: Tuesday, May 16, 2023 at 3:53 PM
To: kulla-dev at openjdk.org <kulla-dev at openjdk.org>
Subject: jshell --enable-preview --execution=local bug?
Hi,
As part of adding --enable-preview support to JBang 0.107<https://github.com/jbangdev/jbang/releases/tag/v0.107.0> I spotted this discrepancy in jshell behaviour. Is this to be expected or a bug?
First what is expected right behaviour:
$ jshell --enable-preview
| Welcome to JShell -- Version 21-ea
| For an introduction type: /help intro
jshell> var name="test"; STR."\{name} test";
name ==> "test"
$2 ==> "test test"
jshell> $2.length();
$3 ==> 9
but now when running with --execution=local:
jshell --enable-preview --execution=local
| Welcome to JShell -- Version 21-ea
| For an introduction type: /help intro
jshell> var name="test"; STR."\{name} test";
name ==> "test"
$2 ==>
jshell> $2.length();
| Exception java.lang.UnsupportedClassVersionError: Preview features are not enabled for REPL/$JShell$12 (class file version 65.65535). Try running with '--enable-preview'
| at ClassLoader.defineClass1 (Native Method)
| at ClassLoader.defineClass (ClassLoader.java:1018)
| at SecureClassLoader.defineClass (SecureClassLoader.java:150)
| at DefaultLoaderDelegate$RemoteClassLoader.findClass (DefaultLoaderDelegate.java:156)
| at ClassLoader.loadClass (ClassLoader.java:593)
| at ClassLoader.loadClass (ClassLoader.java:526)
| at (#3:1)
I found that by duplicating --enable-preview in runtime options fixes things:
$ jshell --enable-preview --execution=local -J--enable-preview
| Welcome to JShell -- Version 21-ea
| For an introduction type: /help intro
jshell> var name="test"; STR."\{name} test";
name ==> "test"
$2 ==> "test test"
jshell> $2.length();
$3 ==> 9
Seems like a bug to me, wdyt? and where to open/report this best or is it enough here?
/max
https://xam.dk/about
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/kulla-dev/attachments/20230517/53040314/attachment-0001.htm>
More information about the kulla-dev
mailing list