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

Jan Lahoda jan.lahoda at oracle.com
Thu Jun 18 15:50:37 UTC 2015

On 18.6.2015 16:40, A. Sundararajan wrote:
> *  jdk/make/lib/Lib-jdk.jline.gmk
>      has copyright year 2011, 2015 despite being a new file. Any
> specific reason?

I copied one of the existing files in the directory to just adjusted it 
for jdk.jline. So I kept the copyright years there - what is the right 
thing to do here?

> * jdk.jline depends on java.desktop. Is that needed by the code by jline
> code? I am asking because Nashorn requires only "compact 1" profile so
> far and so can be used on compact1 embedded platforms. If desktop
> dependency is needed, I guess nashorn has to use it reflectively...

JLine uses java.awt.event.ActionListener (which can be registered as 
callbacks - this could be somewhat tricky), java.awt.datatransfer (to 
implement paste), and java.awt.Toolkit (to get the Clipboard). I can 
take a look what could be done about that if needed.

Thanks for the comments!


> +1 from nashorn point of view.
> Thanks,
> -Sundar
> On Thursday 18 June 2015 07:55 PM, Jan Lahoda wrote:
>> Hello,
>> I am proposing to add JLine 2.12.1 into the jdk repository for use by
>> the Java and Nashorn REPLs. Full patch is available here:
>> http://cr.openjdk.java.net/~jlahoda/8080679/webrev.00/full/
>> To aid the review, I've split this patch into to smaller patches:
>> -a patch that only adds unmodified jline sources at appropriate places
>> in the jdk repository:
>> http://cr.openjdk.java.net/~jlahoda/8080679/webrev.00/clean-jline/
>> -a patch that shows the additional changes I've done:
>> http://cr.openjdk.java.net/~jlahoda/8080679/webrev.00/additional/
>> This split is intended solely to simplify reviewing, my plan is to
>> integrate this as a single patch.
>> The main additional changes are:
>> -plugging the new module, jdk.jline, into the JDK build. Currently,
>> the JLine packages are exported only to jdk.scripting.nashorn (the
>> plan is to also export them to the future jdk.jshell module). (The
>> patch is not adding the dependency from jdk.scripting.nashorn to
>> jdk.jline, though - I expect that to be added when needed.)
>> -the sources are re-packaged from package "jline" to "jdk.internal.jline"
>> -removing trailing whitespace, adding newlines at the end of the
>> files, encoding characters that are not ASCII
>> -avoiding the dependency on another library, jansi, by reimplementing
>> two elements that were used from the other library. These are mainly
>> the changes in WindowsTerminal and ConsoleReader.java. This also
>> includes the WindowsTerminal.cpp native library. The native part is
>> heavily inspired by:
>> http://cr.openjdk.java.net/~sherman/rl/src/java.base/windows/native/libjava/Console_md.c.html
>> As I am not experienced in native programming, comments to the native
>> part would be particularly useful.
>> -changes to resolve javac warnings in JLine.
>> -tests for some of the added functionality.
>> Any comments are welcome!
>> Thanks,
>>     Jan

More information about the nashorn-dev mailing list