@@ -208,11 +208,15 @@ public JBangKernel build() {
208208
209209 String name = buildName ();
210210 Charset jupyterEncoding = buildJupyterIOEncoding ();
211+ //TODO: have flag for this?
212+ compilerOpts .addAll (Arrays .asList ("--enable-preview" , "--source" ,"" +Runtime .version ().feature ()));
213+
211214 JJavaExecutionControlProvider jShellExecutionControlProvider = buildJShellExecControlProvider (name );
212215 JShell jShell = buildJShell (jShellExecutionControlProvider );
213216 LanguageInfo langInfo = buildLanguageInfo ();
214217 MagicTranspiler magicTranspiler = buildMagicTranspiler ();
215218
219+
216220 return new JBangKernel (
217221 name ,
218222 buildVersion (),
@@ -241,6 +245,24 @@ protected List<HelpLink> buildHelpLinks() {
241245 new HelpLink ("JJava homepage" , "https://github.com/dflib/jjava" ));
242246 }
243247
248+
249+ protected JShell buildJShell (JJavaExecutionControlProvider jShellExecControlProvider ) {
250+ Map <String , String > execControlParams = new HashMap ();
251+ execControlParams .put ("registration-id" , this .jShellExecControlID );
252+ if (this .timeout != null ) {
253+ execControlParams .put ("timeout" , this .timeout );
254+ }
255+
256+ return JShell .builder ()
257+ .out (System .out )
258+ .err (System .err )
259+ .in (System .in )
260+ .executionEngine (jShellExecControlProvider , execControlParams )
261+ .compilerOptions ((String [])this .compilerOpts .toArray (new String [0 ]))
262+ .remoteVMOptions ("--enable-preview" )
263+ .build ();
264+ }
265+
244266 }
245267
246268 public void addToClasspath (JBangInfo jbangInfo ) {
0 commit comments