RFR: JDK-8080679: Include jline in JDK for Java and JavaScript REPLs

Jan Lahoda jan.lahoda at oracle.com
Thu Jul 2 15:33:41 UTC 2015

On 1.7.2015 17:58, Jan Lahoda wrote:
> On 1.7.2015 16:43, Alan Bateman wrote:
>> On 30/06/2015 16:05, Jan Lahoda wrote:
>>> We need to override these "settings" for jshell (we use subclasses of
>>> WindowsTerminal/UnixTerminal to get e.g. Ctrl-C detection - not sure
>>> if we will want to generalize these additional features for jjs as
>>> well). Is there a way to override them (just) for jshell using
>>> ServiceLoader?
>> Is extending these classes the normal way to customize? That makes it
>> really awkward to cleanly separate the multiple implementations.
> Subclassing is used in JLine (there's for example
> NoInterruptUnixTerminal which is a subclass of UnixTerminal). We could
> use delegation for some of our purposes, but so far it seems we need to
> be able to use customized Terminals instead of the original ones, as
> e.g. WindowsTerminal is synthesizing an InputStream (which is then used
> instead of System.in) which we are intercepting and continuously reading
> from it awaiting Ctrl-C (when the user's code is running, Ctrl-C will
> interrupt it).
>> BTW: I think what you in the current webrev is okay for now.
> Thanks!

One more iteration, now when the WindowsTerminal loads the library in 
the static initializer, it can only be used on Windows, and so the 
KeyConversionTest can (in the current form) only run on Windows, so 
using @requires to achieve that (sorry I did not realize this sooner).

Also, I did the change Remi suggested with Map.getOrDefault.

The webrev:

Delta against previous:

Is this OK?


> Jan
>> -Alan

More information about the core-libs-dev mailing list