Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Pavel Rappo
On Wed, 8 May 2024 19:40:44 GMT, Stuart Marks wrote: >>> Most of these are defined in terms of `String.valueOf(Object)` which if >>> passed a null reference will return the String object containing `null`. So >>> no, I don't think NPE should be thrown. It might be worth mentioning this >>> exp

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Stuart Marks
On Wed, 8 May 2024 18:25:50 GMT, Pavel Rappo wrote: >> Most of these are defined in terms of `String.valueOf(Object)` which if >> passed a null reference will return the String object containing `null`. So >> no, I don't think NPE should be thrown. It might be worth mentioning this >> explicit

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Pavel Rappo
On Wed, 8 May 2024 16:06:29 GMT, Stuart Marks wrote: > Most of these are defined in terms of `String.valueOf(Object)` which if > passed a null reference will return the String object containing `null`. So > no, I don't think NPE should be thrown. It might be worth mentioning this > explicitly

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Pavel Rappo
I don't remember it being considered, but I think it falls outside the scope of JEP 477 (emphasis mine): > We achieve this effect by declaring a new top-level class in the java.io > package named, simply, IO. It declares the above three static methods for > **textual** I/O with the console, and

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Stuart Marks
On Wed, 8 May 2024 09:39:13 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/java/io/Console.java line 151: >> >>> 149: /** >>> 150: * Writes a string representation of the specified object to this >>> console's >>> 151: * output stream, terminates the line and then flushes

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Stuart Marks
On Wed, 8 May 2024 13:13:33 GMT, Pavel Rappo wrote: >> I haven't given it a try, but a brief look at the code suggests that if the >> console implementation backed by JLine gets used, then a `null` prompt may >> not generate a `NullPointerException` (since JLine appears to allow `null`) >> whe

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Olexandr Rotan
Has it been considered to add a readKey() method to IO class? In my experience, it is pretty commonly used by beginners when they write things like console games (snake, catcher game etc.). I am aware there is System.in.read() method, but since we decided to promote some methods to separate methods

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Pavel Rappo
On Wed, 8 May 2024 10:31:59 GMT, Jaikiran Pai wrote: >> If we specify that, it would be very much unlike all other `Console` methods >> that are covered by this: >> >> * Unless otherwise specified, passing a {@code null} argument to any >> method >> * in this class will cause a {@link

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Jaikiran Pai
On Wed, 8 May 2024 08:59:18 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/java/io/Console.java line 192: >> >>> 190: * >>> 191: * @param prompt >>> 192: * A prompt string. >> >> Hello Pavel, should this specify whether `prompt` can be null? > > If we specify th

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Pavel Rappo
On Wed, 8 May 2024 05:53:25 GMT, Jaikiran Pai wrote: >> Pavel Rappo has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Strengthen tests after 8330998 >> >> https://github.com/openjdk/jdk/pull/18996 now allows us to test >> Console IO

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Pavel Rappo
On Wed, 8 May 2024 05:59:14 GMT, Jaikiran Pai wrote: >> Pavel Rappo has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Strengthen tests after 8330998 >> >> https://github.com/openjdk/jdk/pull/18996 now allows us to test >> Console IO

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-08 Thread Pavel Rappo
On Wed, 8 May 2024 05:41:52 GMT, Jaikiran Pai wrote: >> Pavel Rappo has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Strengthen tests after 8330998 >> >> https://github.com/openjdk/jdk/pull/18996 now allows us to test >> Console IO

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Jaikiran Pai
On Tue, 7 May 2024 19:46:18 GMT, Pavel Rappo wrote: >> Please review this PR which introduces the `java.io.IO` top-level class and >> three methods to `java.io.Console` for [Implicitly Declared Classes and >> Instance Main Methods (Third Preview)]. >> >> This PR has been obtained as `git merge

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Jaikiran Pai
On Tue, 7 May 2024 19:46:18 GMT, Pavel Rappo wrote: >> Please review this PR which introduces the `java.io.IO` top-level class and >> three methods to `java.io.Console` for [Implicitly Declared Classes and >> Instance Main Methods (Third Preview)]. >> >> This PR has been obtained as `git merge

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Jaikiran Pai
On Wed, 8 May 2024 05:45:55 GMT, Jaikiran Pai wrote: >> Pavel Rappo has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Strengthen tests after 8330998 >> >> https://github.com/openjdk/jdk/pull/18996 now allows us to test >> Console IO

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Jaikiran Pai
On Tue, 7 May 2024 19:46:18 GMT, Pavel Rappo wrote: >> Please review this PR which introduces the `java.io.IO` top-level class and >> three methods to `java.io.Console` for [Implicitly Declared Classes and >> Instance Main Methods (Third Preview)]. >> >> This PR has been obtained as `git merge

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Jaikiran Pai
On Tue, 7 May 2024 19:46:18 GMT, Pavel Rappo wrote: >> Please review this PR which introduces the `java.io.IO` top-level class and >> three methods to `java.io.Console` for [Implicitly Declared Classes and >> Instance Main Methods (Third Preview)]. >> >> This PR has been obtained as `git merge

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Stuart Marks
On Tue, 7 May 2024 22:12:55 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/java/io/IO.java line 37: >> >>> 35: * is {@code null}; otherwise, the effect is as if a similarly-named >>> method >>> 36: * had been called on that console. >>> 37: * >> >> Add a note here on encoding (chara

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Pavel Rappo
On Tue, 7 May 2024 21:19:59 GMT, Stuart Marks wrote: >> Pavel Rappo has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Strengthen tests after 8330998 >> >> https://github.com/openjdk/jdk/pull/18996 now allows us to test >> Console IO

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Stuart Marks
On Tue, 7 May 2024 19:46:18 GMT, Pavel Rappo wrote: >> Please review this PR which introduces the `java.io.IO` top-level class and >> three methods to `java.io.Console` for [Implicitly Declared Classes and >> Instance Main Methods (Third Preview)]. >> >> This PR has been obtained as `git merge

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Pavel Rappo
On Tue, 7 May 2024 02:54:39 GMT, Joe Darcy wrote: >> src/java.base/share/classes/java/io/IO.java line 41: >> >>> 39: */ >>> 40: @PreviewFeature(feature = PreviewFeature.Feature.IMPLICIT_CLASSES) >>> 41: public class IO { >> >> Should this be final? > >> Should this be final? > > With only the

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Rémi Forax
On Tue, 7 May 2024 16:09:08 GMT, Pavel Rappo wrote: >> I do not think the step to "standardise" a preview feature exists ? When a >> preview feature becomes a released feature, the code is very lightly edited, >> at least it this is my experience. >> >> You can change both readln and readLine

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Joe Darcy
On Tue, 7 May 2024 17:37:57 GMT, Pavel Rappo wrote: > Yes, we do. There's a common misconception that `{@inheritDoc}` inherits the > complete doc comment. In reality, `{@inheritDoc}` inherits only the main > description, which does not include any `@throws` tags. > > A `@throws` tag is either

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Pavel Rappo
> Please review this PR which introduces the `java.io.IO` top-level class and > three methods to `java.io.Console` for [Implicitly Declared Classes and > Instance Main Methods (Third Preview)]. > > This PR has been obtained as `git merge --squash` of a now obsolete [draft > PR]. > > [Implicitl