Re: Question: Is it possible to introduce ASCII coder for compact strings to optimize performance for ASCII compatible encoding?

2022-05-19 Thread Glavo
coding.html > > (All the improvements discussed in the blog entires should be available > since 17.0.2.) > > On 2022-05-18 14:07, Glavo wrote: > > After the introduction of compact strings in Java 9, the current String > may > > store byte arrays encoded as Latin1 or

Question: Is it possible to introduce ASCII coder for compact strings to optimize performance for ASCII compatible encoding?

2022-05-18 Thread Glavo
After the introduction of compact strings in Java 9, the current String may store byte arrays encoded as Latin1 or UTF-16. Here's a troublesome thing: Latin1 is not compatible with UTF-8. Not all Latin1 byte strings are legal UTF-8 byte strings: They are only compatible within the ASCII range, when

Re: OpenJDK or SE Java Floating Point Options?

2022-04-14 Thread Glavo
Your code snippet C++ shows different results than Java, simply because cout doesn't output full precision numbers. To see accurate results in C++, add this line of code at the beginning of the main function (need to import header file `iomanip`): std::cout << std::setprecision(20); After this,

Integrated: 8284702: Add @since for java.time.LocalDate.EPOCH

2022-04-12 Thread Glavo
On Tue, 12 Apr 2022 03:21:00 GMT, Glavo wrote: > `java.time.LocalDate.EPOCH` was introduced in Java 9, but there is no > corresponding `@since` in the javadoc. The absence of `@since` makes it > impossible for IDEs to check for misuse of it, it may be misused by users > targetin

Re: RFR: 8284702: Add @since for java.time.LocalDate.EPOCH

2022-04-11 Thread Glavo
On Tue, 12 Apr 2022 04:41:06 GMT, liach wrote: > Hmm, isn't this misuse detected by `--release 8` in javac flags? Ah, yes, when compiling with `--release 8`, it will prompt `the symbol cannot be found`. But here's the thing: I'm making some Java 11+ projects compatible with Java 8. Since `mod

RFR: 8284702: Add @since for java.time.LocalDate.EPOCH

2022-04-11 Thread Glavo
`java.time.LocalDate.EPOCH` was introduced in Java 9, but there is no corresponding `@since` in the javadoc. The absence of `@since` makes it impossible for IDEs to check for misuse of it, it may be misused by users targeting Java 8 and crash at runtime. - Commit messages: - 82847

Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v5]

2022-03-13 Thread Glavo
On Fri, 11 Mar 2022 16:53:12 GMT, Jim Laskey wrote: > That might be more in the realm of Valhalla. This is more for capturing > arguments from vararg bootstrap methods. But, I can see your use case. Speaking of Valhalla, this also seems likely to be the basis for specialized generics……All in a

Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v5]

2022-03-11 Thread Glavo
On Fri, 11 Mar 2022 15:17:30 GMT, Jim Laskey wrote: >> We propose to provide a runtime anonymous carrier class object generator; >> java.lang.runtime.Carrier. This generator class is designed to share >> anonymous classes when shapes are similar. For example, if several clients >> require obje

Re: Wrong behavior of standard IO library when interacting with Samba (very serious)

2022-03-07 Thread Glavo
ovide a reproduction environment to help you test, thank you. On Mon, Mar 7, 2022 at 4:28 PM Alan Bateman wrote: > On 07/03/2022 05:33, Glavo wrote: > > I am a Java application developer. I noticed that when my program runs on > > Windows in a samba shared folder (mounted as a driv

Wrong behavior of standard IO library when interacting with Samba (very serious)

2022-03-06 Thread Glavo
served that one of the possibilities for the bug is to use `Files.copy` to copy a file into this folder and fail because the file already exists. After this failed copy, the bug appeared on the parent folder of the target file. According to this, I provide a reproducer: https://github.com/Glavo/nio-samba-bu

Re: Should System.exit be controlled by a Scope Local?

2022-02-27 Thread Glavo
I think there is a problem with this: `System.exit` contains semantics to interrupt the flow of control and exit, and if you implement it that way, you might have some program abnormally execute parts of it that should never be executed. Of course, using exceptions like this should solve part of t

Re: [External] : Sequenced Collections

2022-02-14 Thread Glavo
On the one hand, I am very opposed to using the name ` SequencedCollection `. In the JVM ecosystem, several widely used libraries are using the term Seq, Typical examples are Scala and kotlin's standard libraries, Scala uses `Seq` as a similar correspondence to a `List`, while Kotlin's `Sequence` r

Re: [External] : Sequenced Collections

2022-02-14 Thread Glavo
How about `OrderedCollection`? The meaning of "order" has been defined in the Stream API, so I think the 'ordered' may be a better choice. Stuart Marks 于2022年2月15日周二 14:45写道: > > > On 2/11/22 7:24 PM, Tagir Valeev wrote: > > Of course, I strongly support this initiative and am happy that my > pr

Re: RFR: 8261847: performace of java.lang.Record::toString should be improved

2021-11-16 Thread Glavo
On Tue, 16 Nov 2021 09:45:56 GMT, Сергей Цыпанов wrote: >> Please review this PR which aims to optimize the implementation of the >> `toString` method we provide for records. A benchmark comparing the >> implementation we are providing for records with lombok found out that >> lombok is much f

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Glavo
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is al

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Glavo
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is al

Re: RFR: 8274412: Add a method to Stream API to consume and close the stream without using try-with-resources

2021-10-16 Thread Glavo
Oh, sorry, I found that I misunderstood the closing time. I tried it in the wrong way, so I came to the wrong conclusion. Thank you for your reminder.

Re: RFR: 8274412: Add a method to Stream API to consume and close the stream without using try-with-resources

2021-10-15 Thread Glavo
I don't think it is a perfect solution to combine the close operation with the terminator operation, because there are similar issues in the intermediate operation. Consider this use case (for example only): try (var stream = Files.list(path) .flatMap(dir -> { try {