RFR: 8284853: Fix varios 'expected' typo

2022-04-13 Thread Andrey Turbanov
Found various typos of expected: `exepected`, `exept`, `epectedly`, `expeced`, `Unexpeted`, etc. - Commit messages: - [PATCH] Fix 'expected' typo - [PATCH] Fix 'expected' typo - [PATCH] Fix 'expected' typo Changes: https://git.openjdk.java.net/jdk/pull/8231/files Webrev: https:/

Re: RFR: 8284853: Fix various 'expected' typo [v2]

2022-04-14 Thread Andrey Turbanov
> Found various typos of expected: `exepected`, `exept`, `epectedly`, > `expeced`, `Unexpeted`, etc. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8284853: Fix various 'expected' typo improve test log --

Integrated: 8284853: Fix various 'expected' typo

2022-04-14 Thread Andrey Turbanov
On Wed, 13 Apr 2022 20:36:48 GMT, Andrey Turbanov wrote: > Found various typos of expected: `exepected`, `exept`, `epectedly`, > `expeced`, `Unexpeted`, etc. This pull request has now been integrated. Changeset: 48c75498 Author:Andrey Turbanov URL: https://git.openjdk.java.n

Re: RFR: 8284853: Fix various 'expected' typo [v2]

2022-04-14 Thread Andrey Turbanov
On Thu, 14 Apr 2022 10:38:33 GMT, Yi Yang wrote: >I found [yet another >typo](https://github.com/kelthuzadx/jdk/commit/acb9e15bc0bf5395d1c0875f36992f692734f948), > I wonder if you can merge this into your patch so that I do not need to >submit a new PR for it? Thanks. I think it deserves a sep

Re: RFR: 8284893: Fix typos in java.base

2022-04-15 Thread Andrey Turbanov
On Thu, 14 Apr 2022 19:07:09 GMT, Magnus Ihse Bursie wrote: > I ran `codespell` on the `src/java.base` directory, and accepted those > changes where it indeed discovered real typos. > > (Due to false positives this can unfortunately not be run automatically) > > The majority of fixes are in c

RFR: 8287053: Avoid redundant HashMap.containsKey calls in ZoneInfoFile.getZoneInfo0

2022-05-19 Thread Andrey Turbanov
Instead of pair `HashMap.containsKey`/`HashMap.get` method calls, we can use single call `HashMap.getOrDefault`. It's faster and clearer. - Commit messages: - [PATCH] Avoid redundant HashMap.containsKey calls in ZoneInfoFile Changes: https://git.openjdk.java.net/jdk/pull/8487/files

Integrated: 8287053: Avoid redundant HashMap.containsKey calls in ZoneInfoFile.getZoneInfo0

2022-05-23 Thread Andrey Turbanov
On Sat, 30 Apr 2022 17:00:03 GMT, Andrey Turbanov wrote: > Instead of pair `HashMap.containsKey`/`HashMap.get` method calls, we can use > single call `HashMap.getOrDefault`. > It's faster and clearer. This pull request has now been integrated. Changeset: 01916e19 Author:A

RFR: 8287181: Avoid redundant HashMap.containsKey calls in InternalLocaleBuilder.setExtension

2022-05-23 Thread Andrey Turbanov
No need to separately perform `HashMap.containsKey` before `HashMap.remove` call. If key is present - it will be removed anyway. If it's not present, nothing will be deleted. - Commit messages: - [PATCH] Avoid redundant HashMap.containsKey calls in InternalLocaleBuilder Changes: h

Integrated: 8287181: Avoid redundant HashMap.containsKey calls in InternalLocaleBuilder.setExtension

2022-05-25 Thread Andrey Turbanov
On Sat, 30 Apr 2022 17:10:55 GMT, Andrey Turbanov wrote: > No need to separately perform `HashMap.containsKey` before `HashMap.remove` > call. If key is present - it will be removed anyway. If it's not present, > nothing will be deleted. This pull request has now been integrat

Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Andrey Turbanov
On Wed, 21 Apr 2021 11:06:16 GMT, Patrick Concannon wrote: >> Hi, >> >> Could someone please review my code for updating the code in the `java.time` >> package to make use of the `instanceof` pattern variable? >> >> Kind regards, >> Patrick > > Patrick Concannon has updated the pull request w

RFR: 8271603: Unnecessary Vector usage in java.desktop

2021-08-09 Thread Andrey Turbanov
Usage of thread-safe collection `Vector` is unnecessary. It's recommended to use `ArrayList` if a thread-safe implementation is not needed. In post-BiasedLocking times, this is gets worse, as every access is synchronized. I checked only places where `Vector` was used as local variable. -

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop

2021-08-09 Thread Andrey Turbanov
On Mon, 5 Jul 2021 14:03:18 GMT, Сергей Цыпанов wrote: >> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to >> use `ArrayList` if a thread-safe implementation is not needed. In >> post-BiasedLocking times, this is gets worse, as every access is >> synchronized. >> I

RFR: 8272616: Strange code in java.text.DecimalFormat#applyPattern

2021-08-18 Thread Andrey Turbanov
remove redundant if - Commit messages: - 8272616: Strange code in java.text.DecimalFormat#applyPattern Changes: https://git.openjdk.java.net/jdk/pull/5171/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5171&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-827

Integrated: 8272616: Strange code in java.text.DecimalFormat#applyPattern

2021-08-19 Thread Andrey Turbanov
On Wed, 18 Aug 2021 20:59:20 GMT, Andrey Turbanov wrote: > remove redundant if This pull request has now been integrated. Changeset: 51c1b9a6 Author: Andrey Turbanov Committer: Brian Burkhalter URL: https://git.openjdk.java.net/jdk/commit/51c1b9a6870bd9644e92227e47082a53e2d1c

RFR: 8272863: Replace usages of Collections.sort with List.sort call in public java modules

2021-08-23 Thread Andrey Turbanov
Collections.sort is just a wrapper, so it is better to use an instance method directly. - Commit messages: - [PATCH] Replace usages of Collections.sort with List.sort call in public java modules Changes: https://git.openjdk.java.net/jdk/pull/5229/files Webrev: https://webrevs.ope

Re: RFR: 8272863: Replace usages of Collections.sort with List.sort call in public java modules [v2]

2021-08-24 Thread Andrey Turbanov
> Collections.sort is just a wrapper, so it is better to use an instance method > directly. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8272863: Replace usages of Collections.sort with List.sort call in public java m

Re: RFR: 8272863: Replace usages of Collections.sort with List.sort call in public java modules

2021-08-24 Thread Andrey Turbanov
On Tue, 24 Aug 2021 11:48:46 GMT, Alexander Zvegintsev wrote: > Is there any reason to not touch them along with this fix? Update them too. - PR: https://git.openjdk.java.net/jdk/pull/5229

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v2]

2021-08-24 Thread Andrey Turbanov
On Mon, 9 Aug 2021 23:46:09 GMT, Phil Race wrote: >> Even non-public method can be called via reflection, so I'd be cautios about >> changing return type > > Apps should not be doing that and the desktop module along with most of the > rest of the JDK is strongly encapsulated and illegal access

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v2]

2021-08-24 Thread Andrey Turbanov
as local variable. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8271603: Unnecessary Vector usage in java.desktop revert back to Enumeration bring back default values - Changes: - all: https://git.openjdk.java.

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v2]

2021-08-24 Thread Andrey Turbanov
On Mon, 2 Aug 2021 05:19:32 GMT, Sergey Bylokhov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8271603: Unnecessary Vector usage in java.desktop >> revert back to Enumeration

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v3]

2021-08-25 Thread Andrey Turbanov
as local variable. Andrey Turbanov has updated the pull request incrementally with two additional commits since the last revision: - 8271603: Unnecessary Vector usage in java.desktop migrate more usages. Not sure how I missed them - 8271603: Unnecessary Vector usage in java.desktop revert

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v2]

2021-08-25 Thread Andrey Turbanov
On Tue, 24 Aug 2021 21:13:57 GMT, Andrey Turbanov wrote: >> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to >> use `ArrayList` if a thread-safe implementation is not needed. In >> post-BiasedLocking times, this is gets worse, as every acc

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v2]

2021-08-25 Thread Andrey Turbanov
On Tue, 24 Aug 2021 23:09:52 GMT, Sergey Bylokhov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8271603: Unnecessary Vector usage in java.desktop >> revert back to Enumeration

Re: RFR: 8272863: Replace usages of Collections.sort with List.sort call in public java modules [v2]

2021-08-25 Thread Andrey Turbanov
On Wed, 25 Aug 2021 08:29:57 GMT, Daniel Fuchs wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8272863: Replace usages of Collections.sort with List.sort call in public >

Re: RFR: 8272863: Replace usages of Collections.sort with List.sort call in public java modules [v3]

2021-08-25 Thread Andrey Turbanov
> Collections.sort is just a wrapper, so it is better to use an instance method > directly. Andrey Turbanov has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v4]

2021-08-25 Thread Andrey Turbanov
as local variable. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8271603: Unnecessary Vector usage in java.desktop migrate even more usages - Changes: - all: https://git.openjdk.java.net/jdk/pull/4680/fil

Integrated: 8272863: Replace usages of Collections.sort with List.sort call in public java modules

2021-08-26 Thread Andrey Turbanov
On Mon, 23 Aug 2021 21:01:48 GMT, Andrey Turbanov wrote: > Collections.sort is just a wrapper, so it is better to use an instance method > directly. This pull request has now been integrated. Changeset: d732c309 Author:Andrey Turbanov Committer: Sergey Bylokhov URL:

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v4]

2021-08-27 Thread Andrey Turbanov
On Fri, 27 Aug 2021 17:04:33 GMT, Sergey Bylokhov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8271603: Unnecessary Vector usage in java.desktop >> migrate even more usa

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v4]

2021-09-01 Thread Andrey Turbanov
On Fri, 27 Aug 2021 18:28:58 GMT, Sergey Bylokhov wrote: >> Can you please elaborate? >> As I can see if size of array is exactly the same as size of >> vector/arraylist, implementations are similar - they just call >> System.arraycopy >> ![изображение](https://user-images.githubusercontent.com

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v5]

2021-09-01 Thread Andrey Turbanov
as local variable. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8271603: Unnecessary Vector usage in java.desktop use toArray with zero sized array in places where Vector.copyInto was used - Change

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v6]

2021-09-01 Thread Andrey Turbanov
as local variable. Andrey Turbanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits: - Merge remote-tracking branch 'origin/master' into avoid-unnecessary-vector-usage-in-java.desktop # Conflicts:

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v6]

2021-09-03 Thread Andrey Turbanov
On Fri, 3 Sep 2021 03:17:02 GMT, Sergey Bylokhov wrote: >> Andrey Turbanov has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains eight commits: >> >> - Merge remote-tracking branch 'origin/master'

Re: RFR: 8271603: Unnecessary Vector usage in java.desktop [v7]

2021-09-03 Thread Andrey Turbanov
as local variable. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8271603: Unnecessary Vector usage in java.desktop one more place to call toArray with zero-sized array - Changes: - all: https://git.openjdk.java.

Integrated: 8271603: Unnecessary Vector usage in java.desktop

2021-09-07 Thread Andrey Turbanov
On Sun, 4 Jul 2021 20:42:41 GMT, Andrey Turbanov wrote: > Usage of thread-safe collection `Vector` is unnecessary. It's recommended to > use `ArrayList` if a thread-safe implementation is not needed. In > post-BiasedLocking times, this is gets worse, as every access is syn

Re: RFR: 8272756: Remove unnecessary explicit initialization of volatile variables in java.desktop

2021-09-20 Thread Andrey Turbanov
On Fri, 20 Aug 2021 09:41:15 GMT, Сергей Цыпанов wrote: > This is a continuation of > > - https://bugs.openjdk.java.net/browse/JDK-6736490 > - https://bugs.openjdk.java.net/browse/JDK-8035284 > - https://bugs.openjdk.java.net/browse/JDK-8145680 > - https://bugs.openjdk.java.net/browse/JDK-82515

Re: RFR: 8272756: Remove unnecessary explicit initialization of volatile variables in java.desktop [v2]

2021-09-21 Thread Andrey Turbanov
On Tue, 21 Sep 2021 11:37:42 GMT, Сергей Цыпанов wrote: >> This is a continuation of >> >> - https://bugs.openjdk.java.net/browse/JDK-6736490 >> - https://bugs.openjdk.java.net/browse/JDK-8035284 >> - https://bugs.openjdk.java.net/browse/JDK-8145680 >> - https://bugs.openjdk.java.net/browse/JDK

RFR: 8274640: Cleanup unnecessary null comparison before instanceof check in java.desktop

2021-10-01 Thread Andrey Turbanov
Updated code checks both non-null and instance of a class in java.desktop module classes. The checks and explicit casts could also be replaced with pattern matching for the instanceof operator. Similar cleanups 1. [JDK-8273484](https://bugs.openjdk.java.net/browse/JDK-8273484) java.naming 2. [JD

RFR: 8274806: Simplify equals() call on nullable variable and a constant in java.desktop

2021-10-05 Thread Andrey Turbanov
Flipping arguments of 'equals' method, allows simplifying boolean expressions: now we can remove redundant null check before. - Commit messages: - [PATCH] Simplify equals() call on nullable variable and a constant in java.desktop - [PATCH] Simplify equals() call on nullable variab

RFR: 8274835: Remove unnecessary castings in java.base

2021-10-06 Thread Andrey Turbanov
Redundant castings make code harder to read. Found them by IntelliJ IDEA. I tried to select only casts which are definitely safe to remove. Also didn't touch primitive types casts. - Commit messages: - [PATCH] Remove unnecessary castings in java.base - [PATCH] Remove unnecessary ca

RFR: 8274879: Replace uses of StringBuffer with StringBuilder within java.base classes

2021-10-07 Thread Andrey Turbanov
StringBuffer is a legacy synchronized class. There are more modern alternatives which perform better: 1. Plain String concatenation should be preferred 2. StringBuilder is a direct replacement to StringBuffer which generally have better performance In [JDK-8264029](https://bugs.openjdk.java.net/

RFR: 8274893: Update java.desktop classes to use try-with-resources

2021-10-07 Thread Andrey Turbanov
8274893: Update java.desktop classes to use try-with-resources - Commit messages: - [PATCH] Use try-with-resources to close resources in java.desktop - [PATCH] Use try-with-resources to close resources in java.desktop - [PATCH] Use try-with-resources to close InputStream in java.de

RFR: 8274949: Use String.contains() instead of String.indexOf() in java.base

2021-10-08 Thread Andrey Turbanov
String.contains was introduced in Java 5. Some code in java.base still uses old approach with `String.indexOf` to check if String contains specified substring. I propose to migrate such usages. Makes code shorter and easier to read. - Commit messages: - [PATCH] Use String.contains()

Re: RFR: 8274949: Use String.contains() instead of String.indexOf() in java.base

2021-10-08 Thread Andrey Turbanov
On Fri, 8 Oct 2021 09:35:25 GMT, Daniel Fuchs wrote: >Did you run tier1, tier2? I did run tier2. (tier1 is automatically checked by GithubActions). No new tests failed. Only _usual_ tests, which always fail on my machine, were failed. - PR: https://git.openjdk.java.net/jdk/pull/55

Integrated: 8274806: Simplify equals() call on nullable variable and a constant in java.desktop

2021-10-08 Thread Andrey Turbanov
On Sat, 2 Oct 2021 09:14:49 GMT, Andrey Turbanov wrote: > Flipping arguments of 'equals' method, allows simplifying boolean > expressions: now we can remove redundant null check before. This pull request has now been integrated. Changeset: f640c7aa Author: Andrey Tur

Re: RFR: 8274879: Replace uses of StringBuffer with StringBuilder within java.base classes

2021-10-11 Thread Andrey Turbanov
On Thu, 7 Oct 2021 16:48:06 GMT, Naoto Sato wrote: >> StringBuffer is a legacy synchronized class. There are more modern >> alternatives which perform better: >> 1. Plain String concatenation should be preferred >> 2. StringBuilder is a direct replacement to StringBuffer which generally >> have

RFR: 8275106: Cleanup Iterator usages in java.desktop

2021-10-12 Thread Andrey Turbanov
Cycles with 'Iterator' are error-prone. It's better to use more high-level code, which easier to read. We can use enhanced-for or Collection.removeIf - Commit messages: - [PATCH] Cleanup Iterator usages in java.desktop - [PATCH] Cleanup Iterator usages in java.desktop Changes: htt

Re: RFR: 8275106: Cleanup Iterator usages in java.desktop

2021-10-12 Thread Andrey Turbanov
On Tue, 12 Oct 2021 05:49:17 GMT, Sergey Bylokhov wrote: >> Cycles with 'Iterator' are error-prone. It's better to use more high-level >> code, which easier to read. >> We can use enhanced-for or Collection.removeIf > > src/java.desktop/unix/classes/sun/awt/X11/ListHelper.java line 569: > >> 56

Re: RFR: 8274879: Replace uses of StringBuffer with StringBuilder within java.base classes [v2]

2021-10-12 Thread Andrey Turbanov
n [JDK-8264029](https://bugs.openjdk.java.net/browse/JDK-8264029) I > migrated only usages which were automatically detected by IDEA. It turns out > there are more usages which can be migrated. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last re

Re: RFR: 8274879: Replace uses of StringBuffer with StringBuilder within java.base classes [v2]

2021-10-12 Thread Andrey Turbanov
On Tue, 12 Oct 2021 20:33:20 GMT, Naoto Sato wrote: >> reverted changes in this spec. > > Did you modify the PR? I am unable to locate the revert. Oops. Forgot to push - PR: https://git.openjdk.java.net/jdk/pull/5432

RFR: 8275197: Remove unused fields in ThaiBuddhistChronology

2021-10-13 Thread Andrey Turbanov
Remove 3 unused HashMap's. Reported here https://mail.openjdk.java.net/pipermail/core-libs-dev/2021-September/081866.html I did the similar PR to treetenbp and it was merged https://github.com/ThreeTen/threetenbp/pull/155 - Commit messages: - [PATCH] Remove unused fields in ThaiBud

Re: RFR: 8274893: Update java.desktop classes to use try-with-resources [v2]

2021-10-13 Thread Andrey Turbanov
> 8274893: Update java.desktop classes to use try-with-resources Andrey Turbanov has updated the pull request incrementally with two additional commits since the last revision: - 8274893: Update java.desktop classes to use try-with-resources close nested resources too - [PATCH] Use

Re: RFR: 8274893: Update java.desktop classes to use try-with-resources [v2]

2021-10-13 Thread Andrey Turbanov
On Tue, 12 Oct 2021 06:16:00 GMT, Sergey Bylokhov wrote: >> Andrey Turbanov has updated the pull request incrementally with two >> additional commits since the last revision: >> >> - 8274893: Update java.desktop classes to use try-with-resources >>close nes

Integrated: 8275106: Cleanup Iterator usages in java.desktop

2021-10-15 Thread Andrey Turbanov
On Fri, 8 Oct 2021 19:37:35 GMT, Andrey Turbanov wrote: > Cycles with 'Iterator' are error-prone. It's better to use more high-level > code, which easier to read. > We can use enhanced-for or Collection.removeIf This pull request has now been integrated. Changeset: 32

Integrated: 8274879: Replace uses of StringBuffer with StringBuilder within java.base classes

2021-10-27 Thread Andrey Turbanov
On Thu, 9 Sep 2021 06:50:21 GMT, Andrey Turbanov wrote: > StringBuffer is a legacy synchronized class. There are more modern > alternatives which perform better: > 1. Plain String concatenation should be preferred > 2. StringBuilder is a direct replacement to StringBuffer which ge

Re: RFR: 8276348: Use blessed modifier order in java.base

2021-11-02 Thread Andrey Turbanov
On Tue, 2 Nov 2021 16:30:56 GMT, Pavel Rappo wrote: > This PR follows up one of the recent PRs, where I used a non-canonical > modifier order. Since the problem was noticed [^1], why not to address it at > mass? > > As far as I remember, the first mass-canonicalization of modifiers took place

RFR: 8276794: Change nested classes in java.desktop to static nested classes

2021-11-07 Thread Andrey Turbanov
Non-static classes hold a link to their parent classes, which in many cases can be avoided. I updated only private and package-private classes. Didn't touch public/protected to not break external code. Similar cleanup in java.base - [JDK-8261880](https://bugs.openjdk.java.net/browse/JDK-8261880)

Integrated: 8275197: Remove unused fields in ThaiBuddhistChronology

2021-11-11 Thread Andrey Turbanov
On Tue, 12 Oct 2021 21:10:12 GMT, Andrey Turbanov wrote: > Remove 3 unused HashMap's. > Reported here > https://mail.openjdk.java.net/pipermail/core-libs-dev/2021-September/081866.html > I did the similar PR to treetenbp and it was merged > https://github.com/ThreeTen/three

Integrated: 8274835: Remove unnecessary castings in java.base

2021-11-12 Thread Andrey Turbanov
On Thu, 9 Sep 2021 20:12:47 GMT, Andrey Turbanov wrote: > Redundant castings make code harder to read. > Found them by IntelliJ IDEA. > I tried to select only casts which are definitely safe to remove. Also didn't > touch primitive types casts. This pull request has no

Re: RFR: 8276794: Change nested classes in java.desktop to static nested classes [v2]

2021-11-17 Thread Andrey Turbanov
openjdk.java.net/browse/JDK-8261880) Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: [PATCH] Change nested classes in java.desktop to static nested classes fix review comments - Changes: - all: https://git.openjdk

Re: RFR: 8276794: Change nested classes in java.desktop to static nested classes [v2]

2021-11-17 Thread Andrey Turbanov
On Wed, 17 Nov 2021 14:32:16 GMT, Alexey Ivanov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> [PATCH] Change nested classes in java.desktop to static nested classes >>

Re: RFR: 8276794: Change nested classes in java.desktop to static nested classes [v3]

2021-11-17 Thread Andrey Turbanov
openjdk.java.net/browse/JDK-8261880) Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: [PATCH] Change nested classes in java.desktop to static nested classes move opening brace to the same line where class is declared

Re: RFR: 8276794: Change nested classes in java.desktop to static nested classes [v2]

2021-11-17 Thread Andrey Turbanov
On Wed, 17 Nov 2021 19:25:15 GMT, Andrey Turbanov wrote: >> Non-static classes hold a link to their parent classes, which in many cases >> can be avoided. >> I updated only private and package-private classes. Didn't touch >> public/protected to not break externa

Integrated: 8276794: Change nested classes in java.desktop to static nested classes

2021-11-18 Thread Andrey Turbanov
On Thu, 14 Oct 2021 07:47:33 GMT, Andrey Turbanov wrote: > Non-static classes hold a link to their parent classes, which in many cases > can be avoided. > I updated only private and package-private classes. Didn't touch > public/protected to not break external code. >

Re: RFR: 8274893: Update java.desktop classes to use try-with-resources [v2]

2021-11-18 Thread Andrey Turbanov
On Thu, 18 Nov 2021 05:30:59 GMT, Sergey Bylokhov wrote: >> Andrey Turbanov has updated the pull request incrementally with two >> additional commits since the last revision: >> >> - 8274893: Update java.desktop classes to use try-with-resources >>close nes

Re: RFR: 8274893: Update java.desktop classes to use try-with-resources [v3]

2021-11-18 Thread Andrey Turbanov
> 8274893: Update java.desktop classes to use try-with-resources Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8274893: Update java.desktop classes to use try-with-resources fix review comments - Changes: -

Re: RFR: 8274893: Update java.desktop classes to use try-with-resources [v3]

2021-11-18 Thread Andrey Turbanov
On Thu, 18 Nov 2021 05:36:29 GMT, Sergey Bylokhov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8274893: Update java.desktop classes to use try-with-resources >> fix review

Integrated: 8274949: Use String.contains() instead of String.indexOf() in java.base

2021-11-19 Thread Andrey Turbanov
On Fri, 17 Sep 2021 08:56:47 GMT, Andrey Turbanov wrote: > String.contains was introduced in Java 5. > Some code in java.base still uses old approach with `String.indexOf` to check > if String contains specified substring. > I propose to migrate such usages. Makes code shorter a

Re: RFR: 8274893: Update java.desktop classes to use try-with-resources [v4]

2021-11-23 Thread Andrey Turbanov
> 8274893: Update java.desktop classes to use try-with-resources Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8274893: Update java.desktop classes to use try-with-resources close nested streams too to unify c

Re: RFR: 8274893: Update java.desktop classes to use try-with-resources [v4]

2021-11-23 Thread Andrey Turbanov
On Fri, 19 Nov 2021 19:24:50 GMT, Sergey Bylokhov wrote: >> updated > > What about "new InputStreamReader()" here and below? added it to `try` too - PR: https://git.openjdk.java.net/jdk/pull/5817

Re: RFR: 8274640: Cleanup unnecessary null comparison before instanceof check in java.desktop

2021-11-24 Thread Andrey Turbanov
On Sat, 11 Sep 2021 14:59:21 GMT, Andrey Turbanov wrote: > Updated code checks both non-null and instance of a class in java.desktop > module classes. > The checks and explicit casts could also be replaced with pattern matching > for the instanceof operator. > Similar cle

Re: RFR: 8274640: Cleanup unnecessary null comparison before instanceof check in java.desktop

2021-11-29 Thread Andrey Turbanov
On Sat, 27 Nov 2021 16:37:03 GMT, Alexey Ivanov wrote: >> Updated code checks both non-null and instance of a class in java.desktop >> module classes. >> The checks and explicit casts could also be replaced with pattern matching >> for the instanceof operator. >> Similar cleanups >> 1. [JDK-82

Re: RFR: 8274640: Cleanup unnecessary null comparison before instanceof check in java.desktop [v2]

2021-11-29 Thread Andrey Turbanov
On Sat, 27 Nov 2021 16:27:36 GMT, Alexey Ivanov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8274640: Cleanup unnecessary null comparison before instanceof check in >>

Re: RFR: 8274640: Cleanup unnecessary null comparison before instanceof check in java.desktop [v2]

2021-11-29 Thread Andrey Turbanov
browse/JDK-8273484) java.naming > 2. [JDK-8258422](https://bugs.openjdk.java.net/browse/JDK-8258422) java.base Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8274640: Cleanup unnecessary null comparison before instanceof check in

Integrated: 8274640: Cleanup unnecessary null comparison before instanceof check in java.desktop

2021-12-03 Thread Andrey Turbanov
On Sat, 11 Sep 2021 14:59:21 GMT, Andrey Turbanov wrote: > Updated code checks both non-null and instance of a class in java.desktop > module classes. > The checks and explicit casts could also be replaced with pattern matching > for the instanceof operator. > Similar cle

Integrated: 8274893: Update java.desktop classes to use try-with-resources

2021-12-23 Thread Andrey Turbanov
On Tue, 5 Oct 2021 08:13:53 GMT, Andrey Turbanov wrote: > 8274893: Update java.desktop classes to use try-with-resources This pull request has now been integrated. Changeset: 70c6df6b Author: Andrey Turbanov Committer: Sergey Bylokhov URL: https://git.openjdk.java.net/jdk/com

RFR: 8280470: Confusing instanceof check in HijrahChronology.range

2022-01-21 Thread Andrey Turbanov
Parameter `ChronoField field` is checked by `if (field instanceof ChronoField)`. Such check is confusing, because only one case, when this could be `false` is when `field == null`. But if condition is not satisfied we will get immediate NullPointerException anyway in `return field.range();`. --

Integrated: 8280470: Confusing instanceof check in HijrahChronology.range

2022-01-25 Thread Andrey Turbanov
On Mon, 17 Jan 2022 21:02:35 GMT, Andrey Turbanov wrote: > Parameter `ChronoField field` is checked by `if (field instanceof > ChronoField)`. Such check is confusing, because only one case, when this > could be `false` is when `field == null`. > But if condition is not satisfied