Redundant condition in java.math.MutableBigInteger#divideMagnitude

2022-11-25 Thread Andrey Turbanov
ntLen == nlen' wasn't met."); } And all tests from "jdk/java/math" passed. Can we clean up the code to remove this condition? Code is already complex enough and each condition makes its reading harder. It was added as part of performance improvements in https://bugs.openjdk.org/browse/

Re: RFR: 8297530: java.lang.IllegalArgumentException: Negative length on strings concatenation [v2]

2022-11-24 Thread Andrey Turbanov
On Thu, 24 Nov 2022 15:01:12 GMT, Claes Redestad wrote: >> When concatenating Strings, OutOfMemoryError should be thrown on all >> overflow conditions. This fixes a case that erroneously thro IAE on >> concatenations of long (`length > Integer.MAX_VALUE/2`) UTF16 strings due >> failing to

Integrated: 8296140: Drop unused field java.util.Calendar.DATE_MASK

2022-11-09 Thread Andrey Turbanov
On Thu, 27 Oct 2022 19:07:36 GMT, Andrey Turbanov wrote: > There is no usages for this field. As it has the same value as > `DAY_OF_MONTH_MASK` we can drop it. This pull request has now been integrated. Changeset: 82cbfb5f Author:Andrey Turbanov URL: https://git.openjdk.o

RFR: 8296140: Drop unused field java.util.Calendar.DATE_MASK

2022-10-31 Thread Andrey Turbanov
There is no usages for this field. As it has the same value as `DAY_OF_MONTH_MASK` we can drop it. - Commit messages: - [PATCH] Drop unused field java.util.Calendar.DATE_MASK Changes: https://git.openjdk.org/jdk/pull/10888/files Webrev:

Re: RFR: 8156593: DataOutput.write(byte[],int,int) and its implementations do not specify index out bounds [v2]

2022-10-28 Thread Andrey Turbanov
On Fri, 28 Oct 2022 15:18:06 GMT, Brian Burkhalter wrote: >> Add `@throws IndexOutOfBoundsException {@inheritDoc}` to some >> `write(byte[],int,int)` and `read(byte[],int,int)` methods of some classes >> in the `java.io` package to make things a bit clearer. > > Brian Burkhalter has updated

Re: RFR: 8156593: DataOutput.write(byte[],int,int) and its implementations do not specify index out bounds

2022-10-28 Thread Andrey Turbanov
On Thu, 27 Oct 2022 20:35:26 GMT, Brian Burkhalter wrote: > Add `@throws IndexOutOfBoundsException {@inheritDoc}` to some > `write(byte[],int,int)` and `read(byte[],int,int)` methods of some classes in > the `java.io` package to make things a bit clearer.

Re: RFR: 8294241: Deprecate URL public constructors

2022-10-27 Thread Andrey Turbanov
On Wed, 26 Oct 2022 16:00:56 GMT, Daniel Fuchs wrote: > Deprecate URL constructors. Developers are encouraged to use `java.net.URI` > to parse or construct any URL. > > The `java.net.URL` class does not itself encode or decode any URL components > according to the escaping mechanism defined

Unused class java.net.InetAddressContainer

2022-10-27 Thread Andrey Turbanov
Hello. As I can see, the class 'java.net.InetAddressContainer' is unused in JDK java code. Is it somehow used by VM, or is it just leftovers from some refactorings? I wonder if we can drop it. Andrey Turbanov

Integrated: 8295823: Use enhanced-for cycle instead of Enumeration in java.naming

2022-10-26 Thread Andrey Turbanov
On Thu, 20 Oct 2022 20:28:37 GMT, Andrey Turbanov wrote: > `java.util.Enumeration` is a legacy interface from java 1.0. > There are couple of cycles which use it to iterate over collections. We can > replace this manual cycle with enchanced-for, which is shorter and easier t

RFR: 8295823: Use enhanced-for cycle instead of Enumeration in java.naming

2022-10-24 Thread Andrey Turbanov
`java.util.Enumeration` is a legacy interface from java 1.0. There are couple of cycles which use it to iterate over collections. We can replace this manual cycle with enchanced-for, which is shorter and easier to read. - Commit messages: - [PATCH] Use enhanced-for cycle instead

Re: RFR: 8295302: Do not use ArrayList when LambdaForm has a single ClassData [v3]

2022-10-18 Thread Andrey Turbanov
On Mon, 17 Oct 2022 21:48:42 GMT, Ioi Lam wrote: >> Please review this small optimization. As shown in the JBS issue, most of >> the generated LambdaForm classes have a single ClassData, so we can get a >> small footprint/speed improvement. > > Ioi Lam has updated the pull request with a new

Re: RFR: 8292177: InitialSecurityProperty JFR event [v4]

2022-10-11 Thread Andrey Turbanov
On Mon, 10 Oct 2022 19:23:51 GMT, Sean Coffey wrote: >> New JFR event to record state of initial security properties. >> >> Debug output is also now added for these properties via >> -Djava.security.debug=properties > > Sean Coffey has updated the pull request incrementally with one

Re: RFR: JDK-8289509 : Improve test coverage for XPath Axes: descendant, descendant-or-self, following, following-sibling [v2]

2022-10-11 Thread Andrey Turbanov
On Fri, 7 Oct 2022 15:36:16 GMT, Mahendra Chhipa wrote: >> Added test cases for xpath Axis: >> 1. descendant >> 2. descendant-or-self >> 3. following >> 4. following-sibling > > Mahendra Chhipa has updated the pull request incrementally with one > additional commit since the last revision: > >

Re: RFR: 8286212: Cgroup v1 initialization causes NPE on some systems [v3]

2022-10-10 Thread Andrey Turbanov
On Wed, 18 May 2022 18:14:52 GMT, Severin Gehwolf wrote: >> Please review this change to the cgroup v1 subsystem which makes it more >> resilient on some of the stranger systems. Unfortunately, I wasn't able to >> re-create a similar system as the reporter. The idea of using the longest >>

Re: RFR: 8292177: InitialSecurityProperty JFR event [v3]

2022-10-10 Thread Andrey Turbanov
On Mon, 3 Oct 2022 10:30:54 GMT, Sean Coffey wrote: >> New JFR event to record state of initial security properties. >> >> Debug output is also now added for these properties via >> -Djava.security.debug=properties > > Sean Coffey has updated the pull request incrementally with one additional

Integrated: 8294695: Remove redundant deprecation suppression in ThreadGroup

2022-10-03 Thread Andrey Turbanov
On Sat, 1 Oct 2022 16:17:58 GMT, Andrey Turbanov wrote: > This suppression were added with Loom integration, but method > `Thread.getThreadGroup()` is not deprecated. > Let's cleanup code a bit. > https://mail.openjdk.org/pipermail/core-libs-dev/2022-September/094907.html This pull

RFR: 8294695: Remove redundant deprecation suppression in ThreadGroup

2022-10-01 Thread Andrey Turbanov
This suppression were added with Loom integration, but method `Thread.getThreadGroup()` is not deprecated. Let's cleanup code a bit. https://mail.openjdk.org/pipermail/core-libs-dev/2022-September/094907.html - Commit messages: - [PATCH] Remove redundant deprecation suppression in

Integrated: 8294608: Remove redundant unchecked suppression in FileDescriptor

2022-09-30 Thread Andrey Turbanov
On Wed, 28 Sep 2022 20:39:03 GMT, Andrey Turbanov wrote: > Found this redundant suppressions by IntelliJ IDEA inspection. > It seems [JDK-8189330](https://bugs.openjdk.org/browse/JDK-8189330) made them > redundant. This pull request has now been integrated. Changeset: 375f02

Re: RFR: 8283660: Convert com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java finalizer to Cleaner [v16]

2022-09-29 Thread Andrey Turbanov
On Fri, 22 Jul 2022 20:51:59 GMT, Brent Christian wrote: >> Please review this change to replace the finalizer in >> `AbstractLdapNamingEnumeration` with a Cleaner. >> >> The pieces of state required for cleanup (`LdapCtx homeCtx`, `LdapResult >> res`, and `LdapClient enumClnt`) are moved to

Re: RFR: 8289711: Add container configuration data to mbeans [v10]

2022-09-29 Thread Andrey Turbanov
On Wed, 10 Aug 2022 02:10:25 GMT, xpbob wrote: >> Container configuration information is useful for troubleshooting >> problems,Exposing information in MBeans is ideal for monitoring, jConsole, >> and other scenarios. >> Results the following >>

Re: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster

2022-09-29 Thread Andrey Turbanov
On Fri, 5 Aug 2022 16:12:08 GMT, Jan Lahoda wrote: > The pattern matching switches are using a bootstrap method > `SwitchBootstrap.typeSwitch` to implement the jumps in the switch. Basically, > for a switch like: > > switch (obj) { > case String s when s.isEmpty() -> {} > case String

RFR: 8294608: Remove redundant unchecked suppression in FileDescriptor

2022-09-29 Thread Andrey Turbanov
Found this redundant suppressions by IntelliJ IDEA inspection. It seems [JDK-8189330](https://bugs.openjdk.org/browse/JDK-8189330) made them redundant. - Commit messages: - [PATCH] Remove redundant unchecked suppression in FileDescriptor Changes:

Integrated: 8294472: Remove redundant rawtypes suppression in AbstractChronology

2022-09-28 Thread Andrey Turbanov
On Mon, 26 Sep 2022 19:12:16 GMT, Andrey Turbanov wrote: > Found this redundant suppressions by IntelliJ IDEA inspection. > Seems initially `Chronology` was generic class? This pull request has now been integrated. Changeset: 9309786d Author:Andrey Turbanov URL:

Redundant @SuppressWarnings("deprecation") for Thread.getThreadGroup()

2022-09-28 Thread Andrey Turbanov
planned to deprecate this method? Or can I remove redundant suppressions? Andrey Turbanov

RFR: 8294472: Remove redundant rawtypes suppression in AbstractChronology

2022-09-27 Thread Andrey Turbanov
Found this redundant suppressions by IntelliJ IDEA inspection. Seems initially `Chronology` was generic class? - Commit messages: - [PATCH] Remove redundant rawtypes suppression in AbstractChronology Changes: https://git.openjdk.org/jdk/pull/10433/files Webrev:

Integrated: 8294361: Cleanup usages of StringBuffer in SQLOutputImpl

2022-09-27 Thread Andrey Turbanov
On Sat, 17 Sep 2022 21:43:04 GMT, Andrey Turbanov wrote: > There a few unnecessary usages of StringBuffer in SQLOutputImpl class. > All of them create StringBuffer from single character and then concatenate > with String. Instead of this, we can concatenate character directly.

Re: RFR: 8294361: Cleanup usages of StringBuffer in SQLOutputImpl

2022-09-26 Thread Andrey Turbanov
On Mon, 26 Sep 2022 14:53:24 GMT, Roger Riggs wrote: >> There a few unnecessary usages of StringBuffer in SQLOutputImpl class. >> All of them create StringBuffer from single character and then concatenate >> with String. Instead of this, we can concatenate character directly. > >

RFR: 8294361: Cleanup usages of StringBuffer in SQLOutputImpl

2022-09-26 Thread Andrey Turbanov
There a few unnecessary usages of StringBuffer in SQLOutputImpl class. All of them create StringBuffer from single character and then concatenate with String. Instead of this, we can concatenate character directly. - Commit messages: - [PATCH] Cleanup usages of StringBuffer in

Integrated: 8293197: Avoid double racy reads from non-volatile fields in SharedSecrets

2022-09-07 Thread Andrey Turbanov
On Tue, 30 Aug 2022 07:10:36 GMT, Andrey Turbanov wrote: > After integration of > [JDK-8259021](https://bugs.openjdk.org/browse/JDK-8259021) a few more fields > were added to `SharedSecrets` class. It make sense to update their reading > code to use the same idiom. This pull req

RFR: 8293197: Avoid double racy reads from non-volatile fields in SharedSecrets

2022-09-01 Thread Andrey Turbanov
After integration of [JDK-8259021](https://bugs.openjdk.org/browse/JDK-8259021) a few more fields were added to `SharedSecrets` class. It make sense to update their reading code to use the same idiom. - Commit messages: - [PATCH] SharedSecrets should avoid double racy reads from

Re: RFR: 8293008: Replace uses of StringBuffer with StringBuilder in MergeCollation [v2]

2022-08-31 Thread Andrey Turbanov
On Tue, 30 Aug 2022 08:58:30 GMT, Jaikiran Pai wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8293008: Replace uses of StringBuffer with StringBuilder in MergeCollation >> >

Re: RFR: 8293008: Replace uses of StringBuffer with StringBuilder in MergeCollation [v2]

2022-08-31 Thread Andrey Turbanov
> Couple of package-private classes in `java.text` package still use > `StringBuffer`: `MergeCollation` and `PatternEntry`. > StringBuffer is a legacy synchronized class. StringBuilder is a direct > replacement to StringBuffer which generally have better performance. Andrey Turbanov

Integrated: 8293009: Remove unused field 'millisPerHour' in DateFormatSymbols

2022-08-30 Thread Andrey Turbanov
On Wed, 24 Aug 2022 19:22:51 GMT, Andrey Turbanov wrote: > Field `java.text.DateFormatSymbols#millisPerHour` is unused. It was unused in > initial OpenJDK sources. This pull request has now been integrated. Changeset: d3d2e669 Author:Andrey Turbanov URL: https://git.openj

RFR: 8293009: Remove unused field 'millisPerHour' in DateFormatSymbols

2022-08-28 Thread Andrey Turbanov
Field `java.text.DateFormatSymbols#millisPerHour` is unused. It was unused in initial OpenJDK sources. - Commit messages: - [PATCH] Unused field DateFormatSymbols.millisPerHour Changes: https://git.openjdk.org/jdk/pull/10005/files Webrev:

RFR: 8293008: Replace uses of StringBuffer with StringBuilder in MergeCollation

2022-08-28 Thread Andrey Turbanov
Couple of package-private classes in `java.text` package still use `StringBuffer`: `MergeCollation` and `PatternEntry`. StringBuffer is a legacy synchronized class. StringBuilder is a direct replacement to StringBuffer which generally have better performance. - Commit messages: -

Integrated: 8292350: Use static methods for hashCode/toString primitives

2022-08-20 Thread Andrey Turbanov
On Wed, 10 Aug 2022 08:01:41 GMT, Andrey Turbanov wrote: > It's a bit shorter and clearer. This pull request has now been integrated. Changeset: 37c0a136 Author: Andrey Turbanov URL: https://git.openjdk.org/jdk/commit/37c0a13647e74fd02823a3f621e986f96904b933 Stats: 8 lines i

RFR: 8292350: Use static methods for hashCode/toString primitives

2022-08-15 Thread Andrey Turbanov
It's a bit shorter and clearer. - Commit messages: - [PATCH] Use static methods for hashCode/toString primitives Changes: https://git.openjdk.org/jdk/pull/9816/files Webrev: https://webrevs.openjdk.org/?repo=jdk=9816=00 Issue: https://bugs.openjdk.org/browse/JDK-8292350 Stats:

Integrated: 8291954: Use Optional.isEmpty instead of !Optional.isPresent in java.base

2022-08-06 Thread Andrey Turbanov
On Mon, 1 Aug 2022 06:51:44 GMT, Andrey Turbanov wrote: > I propose to replace usages of !Optional.isPresent() with Optional.isEmpty > method. > It's makes code a bit easier to read. > Noticing negation before long chain of method calls is hard. This pull request has now bee

RFR: 8291954: Use Optional.isEmpty instead of !Optional.isPresent in java.base

2022-08-05 Thread Andrey Turbanov
I propose to replace usages of !Optional.isPresent() with Optional.isEmpty method. It's makes code a bit easier to read. Noticing negation before long chain of method calls is hard. - Commit messages: - [PATCH] Use Optional.isEmpty instead of !Optional.isPresent in java.base

TimeZone implementations questions

2022-07-23 Thread Andrey Turbanov
there is no NPE thrown. Can we remove the catch (NullPointerException) then? Andrey Turbanov

Unused static field AbstractWatchKey#OVERFLOW_EVENT

2022-07-22 Thread Andrey Turbanov
://bugs.openjdk.org/browse/JDK-4313887 Does VM use this field somehow? Or used to use? Andrey Turbanov

Integrated: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

2022-07-21 Thread Andrey Turbanov
On Sat, 18 Jun 2022 10:43:08 GMT, Andrey Turbanov wrote: > Instead of separate ConcurrentHashMap.get call, we can use result of previous > putIfAbsent call. This pull request has now been integrated. Changeset: 52cc6cd0 Author:Andrey Turbanov URL: https://git.openjdk.o

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v4]

2022-07-21 Thread Andrey Turbanov
On Wed, 20 Jul 2022 11:19:07 GMT, Andrey Turbanov wrote: >> Instead of separate ConcurrentHashMap.get call, we can use result of >> previous putIfAbsent call. > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since the last rev

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-20 Thread Andrey Turbanov
On Wed, 6 Jul 2022 14:11:39 GMT, Roger Riggs wrote: >> @RogerRiggs in my view, it's not about performance per se… I'll sometimes >> help along these kinds of small fix PRs (that are more likely than not >> driven by IntelliJ code refactoring suggestions) if I think they lead to >> more

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v4]

2022-07-20 Thread Andrey Turbanov
> Instead of separate ConcurrentHashMap.get call, we can use result of previous > putIfAbsent call. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

Re: RFR: 8289908: Skip bounds check for cases when String is constructed from entirely used byte[] [v5]

2022-07-14 Thread Andrey Turbanov
On Wed, 13 Jul 2022 17:42:18 GMT, Сергей Цыпанов wrote: >> We can skip bounds check and null check for Charset in case we use the array >> entirely and the Charset is either default one or proven to be non-null. >> >> Benchmark results: >> >> before >> >> Benchmark

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-05 Thread Andrey Turbanov
On Tue, 5 Jul 2022 15:26:06 GMT, Roger Riggs wrote: >> Well, if you _really_ want to noodle this for performance, you can also >> store a `this`-bound lambda in a `private final` instance field, so then >> it's only created once too. I wouldn't put it past `javac` to do this, but >> I'd have

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-05 Thread Andrey Turbanov
On Sun, 3 Jul 2022 19:47:16 GMT, Attila Szegedi wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8288723: Avoid redundant ConcurrentHashMap.get call in java.time >> use comp

Integrated: 8289484: Cleanup unnecessary null comparison before instanceof check in java.rmi

2022-07-05 Thread Andrey Turbanov
On Wed, 29 Jun 2022 21:11:09 GMT, Andrey Turbanov wrote: > Update code checks both non-null and instance of a class in jdk.hotspot.agent > module classes. > The checks and explicit casts could also be replaced with pattern matching > for the instanceof operator. > > For exam

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-04 Thread Andrey Turbanov
On Sun, 3 Jul 2022 19:44:55 GMT, Attila Szegedi wrote: >> But it will generate garbage: non-static lambda. > > It already generates some garbage as it does string concatenation for the > key. Here's an idea: declare a record class for the key, `record > CacheKey(DayOfWeek firstDayOfWeek, int

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v3]

2022-07-04 Thread Andrey Turbanov
On Tue, 21 Jun 2022 17:08:17 GMT, liach wrote: >> @liach advance apologies for nitpicking: `ConcurrentHashMap` doesn't in >> general block while the mapping function runs. It can block _some_ >> concurrent updates, namely those that [hash to the same >>

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v3]

2022-07-04 Thread Andrey Turbanov
> Instead of separate ConcurrentHashMap.get call, we can use result of previous > putIfAbsent call. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8288723: Avoid redundant ConcurrentHashMap.get call in jav

Integrated: 8289431: (zipfs) Avoid redundant HashMap.get in ZipFileSystemProvider.removeFileSystem

2022-07-04 Thread Andrey Turbanov
On Tue, 28 Jun 2022 21:07:41 GMT, Andrey Turbanov wrote: > There is overload method HashMap.remove(key,value) which also checks value > equality. > It's shorter and faster than pair get+remove. This pull request has now been integrated. Changeset: 8e7a3cb5 Author: Andrey Turb

Re: RFR: 8289431: (zipfs) Avoid redundant HashMap.get in ZipFileSystemProvider.removeFileSystem [v2]

2022-07-04 Thread Andrey Turbanov
On Wed, 29 Jun 2022 08:20:31 GMT, Andrey Turbanov wrote: >> There is overload method HashMap.remove(key,value) which also checks value >> equality. >> It's shorter and faster than pair get+remove. > > Andrey Turbanov has updated the pull request incrementally with one &

RFR: 8289484: Cleanup unnecessary null comparison before instanceof check in java.rmi

2022-06-29 Thread Andrey Turbanov
Update code checks both non-null and instance of a class in jdk.hotspot.agent module classes. The checks and explicit casts could also be replaced with pattern matching for the instanceof operator. For example, the following code: if ((obj != null) && (obj instanceof TCPEndpoint)) {

Re: RFR: 8289431: (zipfs) Avoid redundant HashMap.get in ZipFileSystemProvider.removeFileSystem [v2]

2022-06-29 Thread Andrey Turbanov
> There is overload method HashMap.remove(key,value) which also checks value > equality. > It's shorter and faster than pair get+remove. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8289431: (zipfs) Avoid redundant Ha

RFR: 8289431: Avoid redundant HashMap.get in ZipFileSystemProvider.removeFileSystem

2022-06-29 Thread Andrey Turbanov
There is overload method HashMap.remove(key,value) which also checks value equality. It's shorter and faster than pair get+remove. - Commit messages: - [PATCH] Remove redundant HashMap.get call before HashMap.remove Changes: https://git.openjdk.org/jdk/pull/9314/files Webrev:

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-06-28 Thread Andrey Turbanov
On Fri, 24 Jun 2022 07:22:05 GMT, Jaikiran Pai wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8288723: Avoid redundant ConcurrentHashMap.get call in java.time >> use comp

Integrated: 8289078: Make STARTTIME_ANY and STARTTIME_PROCESS_UNKNOWN fields static in ProcessHandleImpl

2022-06-27 Thread Andrey Turbanov
On Fri, 17 Jun 2022 08:43:00 GMT, Andrey Turbanov wrote: > Fields `STARTTIME_ANY` and `STARTTIME_PROCESS_UNKNOWN` are actually unused, > but they are useful as documentation on the interface to native. > Make them `static` to reduce memory usage. This pull request has now been i

RFR: 8289078: Make STARTTIME_ANY and STARTTIME_PROCESS_UNKNOWN fields static in ProcessHandleImpl

2022-06-23 Thread Andrey Turbanov
Fields `STARTTIME_ANY` and `STARTTIME_PROCESS_UNKNOWN` are actually unused, but they are useful as documentation on the interface to native. Make them `static` to reduce memory usage. - Commit messages: - [PATCH] Make STARTTIME_ANY and STARTTIME_PROCESS_UNKNOWN fields static in

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-06-22 Thread Andrey Turbanov
> Instead of separate ConcurrentHashMap.get call, we can use result of previous > putIfAbsent call. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

Re: RFR: 8288589: Files.readString ignores encoding errors for UTF-16 [v3]

2022-06-21 Thread Andrey Turbanov
On Tue, 21 Jun 2022 18:12:23 GMT, Naoto Sato wrote: >> This is a regression caused by the fix to >> [JDK-8286287](https://bugs.openjdk.org/browse/JDK-8286287), which assumed >> the method `String.decodeWithDecoder()` was only invoked with cs.REPLACE >> mode based on the comment "should not

Integrated: 8288628: Unnecessary Hashtable usage in ConditionalSpecialCasing

2022-06-21 Thread Andrey Turbanov
On Wed, 15 Jun 2022 19:49:52 GMT, Andrey Turbanov wrote: > If a thread-safe implementation is not needed, it is recommended to use > HashMap in place of Hashtable. > `ConditionalSpecialCasing.entryTable` is read-only Map which is modified only > in `static` block. It means w

RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

2022-06-20 Thread Andrey Turbanov
Instead of separate ConcurrentHashMap.get call, we can use result of previous putIfAbsent call. - Commit messages: - [PATCH] Avoid redundant ConcurrentHashMap.get call in java.time Changes: https://git.openjdk.org/jdk/pull/9208/files Webrev:

RFR: 8288628: Unnecessary Hashtable usage in ConditionalSpecialCasing

2022-06-16 Thread Andrey Turbanov
If a thread-safe implementation is not needed, it is recommended to use HashMap in place of Hashtable. `ConditionalSpecialCasing.entryTable` is read-only Map which is modified only in `static` block. It means we can safely replace it with HashMap. - Commit messages: - [PATCH]

Integrated: 8285519: Change usages of TimeUnit.convert to TimeUnit.toXXX

2022-06-16 Thread Andrey Turbanov
On Sat, 23 Apr 2022 21:02:50 GMT, Andrey Turbanov wrote: > TimeUnit.toMillis/toNanos/toMicros/toSeconds is shorter and a bit faster. > Compared via JMH benchmark: 150ns -> 125ns/op > > Benchamark adapted from > http://cr.openjdk.java.net/~shade/8152083/TimeUnitBench.ja

ProcessHandleImpl.STARTTIME_PROCESS_UNKNOWN and STARTTIME_PROCESS_UNKNOWN

2022-06-15 Thread Andrey Turbanov
the OS can not supply it. * The process is known to exist but not the exact start time. */ private final long STARTTIME_ANY = 0L; /* The start time of a Process that does not exist. */ private final long STARTTIME_PROCESS_UNKNOWN = -1; Andrey Turbanov

<    1   2   3