jshell on ios without process exec?
Robert Field
robert.field at oracle.com
Fri Mar 11 20:46:53 UTC 2016
On 03/11/16 12:00, Grigory Ptashko wrote:
> Hello Robert!
>
> These are good news! My hope is not lost!
>
> Please, give me the pointers I will definitely try to re-implement this.
Basically you would need to implement a new version of ExecutionControl
-- so the non-private methods could define an interface with two
implementations: a JDI version (current code) and a new in-process version.
For some of the functionality look in MemoryFileManager you will find a
some methods/classes labelled: // For restoring process-local execution
support.
Without some special magic, you will not be able to implement some
methods, notably commandRedefine(), just return false.
I thought this might be interesting to others, but most further
communications should probably be off-list.
Enjoy,
Robert
>
> Thank you.
>
>> On 11 марта 2016 г., at 22:19, Robert Field <robert.field at oracle.com> wrote:
>>
>> Hi Grigory,
>>
>> It is theoretically possible to implement a (reduced functionality) in-process version of JShell, in fact the original prototypes were in-process.
>>
>> At this point however, JDI (which is out of process) is well ensconced in the design.
>>
>> I have intentionally left some support framework for in-process in the code to facilitate a possible future in-process option. The code is open-source, so if you are inclined I'd be happy to give you pointers to re-implement in-process.
>>
>> -Robert
>>
>> On 03/11/16 08:45, Grigory Ptashko wrote:
>>> Hello.
>>>
>>> Long story short. I’ve just tried to use jshell on ios (both arm64 and simulator).
>>>
>>> I try this:
>>>
>>> JShell jshell = JShell.create();
>>> List<SnippetEvent> events = jshell.eval("2+2");
>>> System.out.println(events.get(0).value());
>>>
>>> And get the exception:
>>>
>>> Exception in thread "Thread-0" java.lang.Error: iOS is not a supported OS platform.
>>> at java.lang.ProcessImpl$Platform.get(ProcessImpl.java:171)
>>> at java.lang.ProcessImpl.<clinit>(ProcessImpl.java:175)
>>> at java.lang.ProcessBuilder.start(ProcessBuilder.java:1111)
>>> at java.lang.ProcessBuilder.start(ProcessBuilder.java:1075)
>>> at java.lang.Runtime.exec(Runtime.java:624)
>>> at java.lang.Runtime.exec(Runtime.java:483)
>>> at com.sun.tools.jdi.AbstractLauncher$Helper.launchAndAccept(AbstractLauncher.java:180)
>>> at com.sun.tools.jdi.AbstractLauncher.launch(AbstractLauncher.java:132)
>>> at com.sun.tools.jdi.SunCommandLineLauncher.launch(SunCommandLineLauncher.java:223)
>>> at jdk.jshell.JDIConnection.launchTarget(JDIConnection.java:303)
>>> at jdk.jshell.JDIConnection.open(JDIConnection.java:121)
>>> at jdk.jshell.JDIEnv.init(JDIEnv.java:49)
>>> at jdk.jshell.ExecutionControl.jdiGo(ExecutionControl.java:269)
>>> at jdk.jshell.ExecutionControl.launch(ExecutionControl.java:71)
>>> at jdk.jshell.JShell.executionControl(JShell.java:613)
>>> at jdk.jshell.ClassTracker$ClassInfo.getReferenceTypeOrNull(ClassTracker.java:81)
>>> at jdk.jshell.Unit.lambda$classesToLoad$3(Unit.java:266)
>>> at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1422)
>>> at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:591)
>>> at jdk.jshell.Unit.classesToLoad(Unit.java:264)
>>> at jdk.jshell.Eval.lambda$compileAndLoad$13(Eval.java:559)
>>> at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
>>> at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1422)
>>> at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
>>> at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
>>> at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
>>> at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>>> at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:511)
>>> at jdk.jshell.Eval.compileAndLoad(Eval.java:560)
>>> at jdk.jshell.Eval.declare(Eval.java:462)
>>> at jdk.jshell.Eval.declare(Eval.java:448)
>>> at jdk.jshell.Eval.processExpression(Eval.java:291)
>>> at jdk.jshell.Eval.eval(Eval.java:118)
>>> at jdk.jshell.JShell.eval(JShell.java:350)
>>> at EvalJava.main(EvalJava.java:14)
>>>
>>> Is it possible to use jshell without exec’ing a process? Within the same process?
>>>
>>> Thank you.
>>>
>>> --
>>> Best regards,
>>> Grigory Ptashko
>>> Software developer at Biblio-Globus Touroperator
>>> g.ptashko at bgoperator.com
>>> Phone: +7 495 5042500 ext 1557
>>> Mobile: +7 916 1489766
>>>
>
> --
> Best regards,
> Grigory Ptashko
>
> +7 (916) 1489766
> grigory.ptashko at gmail.com
> facebook.com/GrigoryPtashko
>
More information about the kulla-dev
mailing list