Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-27 Thread Tatsunori Uchino
On Sun, 27 Apr 2025 14:21:32 GMT, Tatsunori Uchino wrote: >> I believe that after: >> https://github.com/openjdk/jdk/pull/24738 >> the `stdin.encoding` property is set when the process is connected to a >> console, which is probably the main case where the encoding can be detected >> automatica

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-27 Thread Tatsunori Uchino
On Sun, 27 Apr 2025 10:51:33 GMT, Jan Lahoda wrote: >> src/java.base/share/classes/java/lang/IO.java line 192: >> >>> 190: String enc = System.getProperty("stdin.encoding", ""); >>> 191: Charset cs = Charset.forName(enc, StandardCharsets.UTF_8); >>> 192: br =

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-27 Thread Jan Lahoda
On Sun, 27 Apr 2025 09:12:47 GMT, Tatsunori Uchino wrote: >> Jan Lahoda has updated the pull request incrementally with seven additional >> commits since the last revision: >> >> - Merge remote-tracking branch 'origin/finalize-concise-source-files' into >> finalize-concise-source-files >> -

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-27 Thread Tatsunori Uchino
On Tue, 22 Apr 2025 12:39:05 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >>

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-24 Thread Stuart Marks
On Tue, 22 Apr 2025 18:56:40 GMT, Stuart Marks wrote: >> src/java.base/share/classes/java/lang/IO.java line 41: >> >>> 39: * The {@link #readln()} and {@link #readln(String)} methods decode >>> bytes read from >>> 40: * {@code System.in} into characters. The charset used for decoding is >>>

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-23 Thread Jan Lahoda
On Tue, 22 Apr 2025 10:14:44 GMT, Jan Lahoda wrote: >> src/java.base/share/classes/jdk/internal/misc/MethodFinder.java line 89: >> >>> 87: if (mainMethod == null) { >>> 88: //if not public method, try to lookup a non-public one >>> 89: mainMethod = JLA.findMethod(

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-22 Thread Stuart Marks
On Tue, 22 Apr 2025 08:14:23 GMT, Alan Bateman wrote: >> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add clause about handling of malformed/unmappable bytes. > > src/java.base/share/classes/java/lang/IO.java line 41: > >>

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-22 Thread Naoto Sato
On Tue, 22 Apr 2025 12:39:05 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >>

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-22 Thread Jan Lahoda
On Mon, 7 Apr 2025 17:58:45 GMT, Naoto Sato wrote: >> Jan Lahoda has updated the pull request incrementally with seven additional >> commits since the last revision: >> >> - Merge remote-tracking branch 'origin/finalize-concise-source-files' into >> finalize-concise-source-files >> - Reverti

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-22 Thread Jan Lahoda
On Tue, 22 Apr 2025 08:35:20 GMT, Alan Bateman wrote: >> Jan Lahoda has updated the pull request incrementally with seven additional >> commits since the last revision: >> >> - Merge remote-tracking branch 'origin/finalize-concise-source-files' into >> finalize-concise-source-files >> - Reve

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v5]

2025-04-22 Thread Jan Lahoda
> This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `java. ... .IO` is no longer automatically imported in an

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-22 Thread Jan Lahoda
On Tue, 22 Apr 2025 08:34:36 GMT, Alan Bateman wrote: >> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add clause about handling of malformed/unmappable bytes. > > src/java.base/share/classes/jdk/internal/misc/MethodFinder.j

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-22 Thread Alan Bateman
On Thu, 10 Apr 2025 01:03:01 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >>

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-22 Thread Alan Bateman
On Thu, 10 Apr 2025 01:03:01 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >>

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-21 Thread Vicente Romero
On Thu, 10 Apr 2025 01:03:01 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >>

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-10 Thread Stuart Marks
On Mon, 7 Apr 2025 18:49:33 GMT, Chen Liang wrote: >> I used "internal objects" because I wanted to avoid naming concrete classes, >> which might or might not be used. Previous drafts mentioned BufferedReader, >> InputStreamReader, and CharsetDecoder. >> >> I could replace "internal objects" w

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-10 Thread Stuart Marks
On Sat, 5 Apr 2025 02:31:21 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/IO.java line 122: >> >>> 120: public static void print(Object obj) { >>> 121: System.out.print(obj); >>> 122: System.out.flush(); >> >> Is it worth using a local variable to avoid cal

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-10 Thread Jan Lahoda
> This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `java. ... .IO` is no longer automatically imported in an

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-10 Thread Stuart Marks
On Mon, 7 Apr 2025 09:12:27 GMT, Alan Bateman wrote: >> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use local variable for System.out in print(). > > src/java.base/share/classes/java/lang/IO.java line 45: > >> 43: * UTF-

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-10 Thread Chen Liang
On Mon, 7 Apr 2025 18:08:29 GMT, Stuart Marks wrote: >> src/java.base/share/classes/java/lang/IO.java line 45: >> >>> 43: * UTF-8 is used instead. These internal objects are created upon the >>> first call to >>> 44: * either of the {@code readln} methods and are stored for subsequent >>> re

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v4]

2025-04-09 Thread Stuart Marks
On Wed, 9 Apr 2025 17:02:52 GMT, Stuart Marks wrote: >> The readln methods handle malformed-input and unmappable-character errors by >> dropping, and using a replacement value. So erroneous input doesn't throw >> IOError with a CharacterCodingException as the cause. >> >> System.in.close() wou

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v3]

2025-04-09 Thread Stuart Marks
On Wed, 9 Apr 2025 10:36:53 GMT, Alan Bateman wrote: >> The IOError was carried over from Console.readLine(), which throws IOError >> on error. Of course we're decoupled from Console now, but that was the >> original reason. >> >> My guess is that Console methods throw IOError because (a) they

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v3]

2025-04-09 Thread Stuart Marks
On Wed, 9 Apr 2025 10:46:40 GMT, Alan Bateman wrote: >> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Rewrite bits about charset decoding, removing mention of "internal >> objects." > > src/java.base/share/classes/java/lang

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v3]

2025-04-09 Thread Alan Bateman
On Mon, 7 Apr 2025 21:07:36 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >> -

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v3]

2025-04-09 Thread Alan Bateman
On Mon, 7 Apr 2025 18:28:21 GMT, Stuart Marks wrote: >> Someone is bound to ask why the readln method throw but the println methods >> don't. > > The IOError was carried over from Console.readLine(), which throws IOError on > error. Of course we're decoupled from Console now, but that was the o

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v3]

2025-04-09 Thread Alan Bateman
On Mon, 7 Apr 2025 21:07:36 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >> -

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-08 Thread Stuart Marks
On Mon, 7 Apr 2025 07:01:56 GMT, Jan Lahoda wrote: >> src/java.base/share/classes/java/lang/IO.java line 183: >> >>> 181: * @return the internal BufferedReader instance >>> 182: */ >>> 183: static synchronized BufferedReader reader() { >> >> Is the lock only inteneded for initiali

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v3]

2025-04-07 Thread Stuart Marks
On Mon, 7 Apr 2025 19:44:40 GMT, Stuart Marks wrote: >> Can we rephrase the 1st sentence to read: >> "The `readln()` and `readln(String)` methods in this class decode bytes read >> from `System.in` into characters." >> >> And remove the last "these internal objects" sentence. >> >> And for the

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v3]

2025-04-07 Thread Jan Lahoda
> This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `java. ... .IO` is no longer automatically imported in an

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-07 Thread Vicente Romero
On Mon, 7 Apr 2025 18:13:29 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >> -

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-07 Thread Stuart Marks
On Mon, 7 Apr 2025 09:18:37 GMT, Alan Bateman wrote: >> This implementation is not to be emulated by beginners. If an Exception.is >> thrown here, a user might be tempted to add handlers in their code, while >> this is an issue with the setup. > > Someone is bound to ask why the readln method t

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-07 Thread Naoto Sato
On Mon, 7 Apr 2025 18:10:20 GMT, Jan Lahoda wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >> -

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-07 Thread Jan Lahoda
> This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `java. ... .IO` is no longer automatically imported in an

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods [v2]

2025-04-07 Thread Stuart Marks
On Sat, 5 Apr 2025 00:55:55 GMT, Luca Kellermann wrote: >> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use local variable for System.out in print(). > > src/java.base/share/classes/java/lang/IO.java line 122: > >> 120:

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Alan Bateman
On Sat, 5 Apr 2025 02:30:33 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/IO.java line 147: >> >>> 145: } catch (IOException ioe) { >>> 146: throw new IOError(ioe); >>> 147: } >> >> Was `UncheckedIOException` considered? It might be better for begin

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Alan Bateman
On Fri, 4 Apr 2025 07:20:23 GMT, Jan Lahoda wrote: > This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `jav

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Christian Stein
On Fri, 4 Apr 2025 07:20:23 GMT, Jan Lahoda wrote: > This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `jav

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Chen Liang
On Sat, 5 Apr 2025 00:55:55 GMT, Luca Kellermann wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks)

RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Jan Lahoda
This is a PR that implements JEP: Compact Source Files and Instance Main Methods. Changes include: - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` to implement the methods (thanks to @stuart-marks) - `java. ... .IO` is no longer automatically imported in any compilat

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Jan Lahoda
On Sat, 5 Apr 2025 00:20:29 GMT, Chen Liang wrote: >> This is a PR that implements JEP: Compact Source Files and Instance Main >> Methods. Changes include: >> - `java.io.IO` moved to `java.lang.IO`, and no longer uses >> `System.console()` to implement the methods (thanks to @stuart-marks) >> -

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Luca Kellermann
On Fri, 4 Apr 2025 07:20:23 GMT, Jan Lahoda wrote: > This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `jav

Re: RFR: 8344706: Compiler Implementation of Compact Source Files and Instance Main Methods

2025-04-07 Thread Chen Liang
On Fri, 4 Apr 2025 07:20:23 GMT, Jan Lahoda wrote: > This is a PR that implements JEP: Compact Source Files and Instance Main > Methods. Changes include: > - `java.io.IO` moved to `java.lang.IO`, and no longer uses `System.console()` > to implement the methods (thanks to @stuart-marks) > - `jav