RFR: 8273375: Remove redundant 'new String' calls after concatenation in java.desktop

2021-09-06 Thread Andrey Turbanov
Result of string concatenation is a newly created `String` object. There is no need it wrap it in another `new String` call. Such calls are confusing and produce warnings in IDE. Without them code is easier to read. - Commit messages: - [PATCH] Remove redundant 'new String' calls a

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.

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 [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 [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 [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: 8273168: Remove superfluous use of boxing in java.desktop [v2]

2021-09-01 Thread Andrey Turbanov
> parseInt/parseLong/parseShort/parseByte/parseFloat should be preferred, as > they return primitives. While valueOf returns boxed object. Andrey Turbanov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated c

RFR: 8273168: Remove superfluous use of boxing in java.desktop

2021-08-31 Thread Andrey Turbanov
parseInt/parseLong/parseShort/parseByte/parseFloat should be preferred, as they return primitives. While valueOf returns boxed object. - Commit messages: - [PATCH] Cleanup redundant boxing in java.desktop module Changes: https://git.openjdk.java.net/jdk/pull/5313/files Webrev: htt

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

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-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

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: 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: 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: 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-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 [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, 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: 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: 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

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

Integrated: 8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

2021-08-10 Thread Andrey Turbanov
On Mon, 14 Jun 2021 17:00:29 GMT, Andrey Turbanov wrote: > I found few places, where code initially perform `Object[] > Colleciton.toArray()` call and then manually copy array into another array > with required type. > This PR cleanups such places to more sho

Re: RFR: 8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

2021-08-09 Thread Andrey Turbanov
On Mon, 26 Jul 2021 19:15:55 GMT, Brett Okken wrote: >> I found few places, where code initially perform `Object[] >> Colleciton.toArray()` call and then manually copy array into another array >> with required type. >> This PR cleanups such places to more shorter call `T[] >> Collection.toArr

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: 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: 8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

2021-08-09 Thread Andrey Turbanov
On Mon, 26 Jul 2021 19:55:09 GMT, Brett Okken wrote: >> I found few places, where code initially perform `Object[] >> Colleciton.toArray()` call and then manually copy array into another array >> with required type. >> This PR cleanups such places to more shorter call `T[] >> Collection.toArr

Re: RFR: 8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

2021-07-26 Thread Andrey Turbanov
On Tue, 15 Jun 2021 12:06:43 GMT, Michael Bien wrote: >> I found few places, where code initially perform `Object[] >> Colleciton.toArray()` call and then manually copy array into another array >> with required type. >> This PR cleanups such places to more shorter call `T[] >> Collection.toAr

RFR: 8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

2021-07-26 Thread Andrey Turbanov
I found few places, where code initially perform `Object[] Colleciton.toArray()` call and then manually copy array into another array with required type. This PR cleanups such places to more shorter call `T[] Collection.toArray(T[])`. - Commit messages: - Replace usages of Collecti

Integrated: 8264428: Cleanup usages of StringBuffer in java.desktop

2021-04-08 Thread Andrey Turbanov
On Mon, 29 Mar 2021 20:50:14 GMT, Andrey Turbanov wrote: > There are few possible cleanups in java.desktop related to legacy > StringBuffer usages: > 1. In few places StringBuffer can be replaced with plain String concatenation. > 2. StringBuffer can be replaced with S

Re: RFR: 8264428: Cleanup usages of StringBuffer in java.desktop [v4]

2021-04-08 Thread Andrey Turbanov
h specialized methods (like > `.append(int)` calls. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8264484: Replace uses of StringBuffer with StringBuilder in jdk.hotspot.agent place each 'append' call on its own line

Re: RFR: 8264428: Cleanup usages of StringBuffer in java.desktop [v3]

2021-04-08 Thread Andrey Turbanov
On Wed, 7 Apr 2021 15:21:40 GMT, Alexey Ivanov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> [PATCH] Replace uses of StringBuffer with StringBuilder in java.desktop >> &

Re: RFR: 8264428: Cleanup usages of StringBuffer in java.desktop [v3]

2021-04-06 Thread Andrey Turbanov
On Tue, 30 Mar 2021 15:46:56 GMT, Alexander Zvegintsev wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> [PATCH] Replace uses of StringBuffer with StringBuilder in java.desktop >&

Re: RFR: 8264428: Cleanup usages of StringBuffer in java.desktop [v3]

2021-04-06 Thread Andrey Turbanov
h specialized methods (like > `.append(int)` calls. Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: [PATCH] Replace uses of StringBuffer with StringBuilder in java.desktop fix copyright year - Changes: - all: https:/

Re: RFR: 8264428: Cleanup usages of StringBuffer in java.desktop

2021-04-01 Thread Andrey Turbanov
On Wed, 31 Mar 2021 21:12:37 GMT, Sergey Bylokhov wrote: >> Submitted: https://bugs.openjdk.java.net/browse/JDK-8264428, please rename >> PR to "8264428: Replace uses of StringBuffer with StringBuilder in >> java.desktop". > > Looks like this change goes beyond of simple replacement of StringB

Re: RFR: 8264428: Replace uses of StringBuffer with StringBuilder in java.desktop [v2]

2021-03-30 Thread Andrey Turbanov
On Tue, 30 Mar 2021 18:31:34 GMT, Andrey Turbanov wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> [PATCH] Replace uses of StringBuffer with StringBuilder in java.desktop > > src/

Re: RFR: 8264428: Replace uses of StringBuffer with StringBuilder in java.desktop [v2]

2021-03-30 Thread Andrey Turbanov
`java.desktop` > Similar cleanups in the past: > https://bugs.openjdk.java.net/browse/JDK-8041679 > https://bugs.openjdk.java.net/browse/JDK-8264029 Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: [PATCH] Replace uses o

Re: RFR: 8264428: Replace uses of StringBuffer with StringBuilder in java.desktop

2021-03-30 Thread Andrey Turbanov
On Mon, 29 Mar 2021 20:50:14 GMT, Andrey Turbanov wrote: > Found by IntelliJ IDEA inspection `Java | Java language level migration aids > | Java 5 | 'StringBuffer' may be 'StringBuilder'` > As suggested in > https://github.com/openjdk/jdk/pull/1507#iss

RFR: 8264428: Replace uses of StringBuffer with StringBuilder in java.desktop

2021-03-30 Thread Andrey Turbanov
Found by IntelliJ IDEA inspection `Java | Java language level migration aids | Java 5 | 'StringBuffer' may be 'StringBuilder'` As suggested in https://github.com/openjdk/jdk/pull/1507#issuecomment-757369003 I've created separate PR for module `java.desktop` Similar cleanups in the past: https://b

Integrated: 8262161: Refactor manual I/O stream copying in java.desktop to use new convenience APIs

2021-03-08 Thread Andrey Turbanov
On Mon, 21 Dec 2020 07:54:17 GMT, Andrey Turbanov wrote: > Cleanup code to use new handy methods in > `java.io.InputStream`/`java.nio.file.Files` instead of manual stream copy: > 1. java.io.InputStream#readAllBytes > 2. java.io.InputStream#transferTo > 3. java.nio.file.Files#

Re: RFR: 8262161 Refactor manual I/O stream copying to new convinient methods in java.desktop

2021-02-23 Thread Andrey Turbanov
On Tue, 23 Feb 2021 15:47:20 GMT, Prasanta Sadhukhan wrote: >> Cleanup code to use new handy methods in >> `java.io.InputStream`/`java.nio.file.Files` instead of manual stream copy: >> 1. java.io.InputStream#readAllBytes >> 2. java.io.InputStream#transferTo >> 3. java.nio.file.Files#copy >> >>

Re: RFR: 8262161 Refactor manual I/O stream copying to new convinient methods in java.desktop

2021-02-23 Thread Andrey Turbanov
On Sun, 3 Jan 2021 03:08:31 GMT, Sergey Bylokhov wrote: >> Cleanup code to use new handy methods in >> `java.io.InputStream`/`java.nio.file.Files` instead of manual stream copy: >> 1. java.io.InputStream#readAllBytes >> 2. java.io.InputStream#transferTo >> 3. java.nio.file.Files#copy >> >> Simi

RFR: 8262161 Refactor manual I/O stream copying to new convinient methods in java.desktop

2021-02-23 Thread Andrey Turbanov
Cleanup code to use new handy methods in `java.io.InputStream`/`java.nio.file.Files` instead of manual stream copy: 1. java.io.InputStream#readAllBytes 2. java.io.InputStream#transferTo 3. java.nio.file.Files#copy Similar issue - https://bugs.openjdk.java.net/browse/JDK-8080272 - Co

Re: RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo

2020-12-20 Thread Andrey Turbanov
On Sun, 20 Dec 2020 19:43:21 GMT, Alan Bateman wrote: > One or two of the sources changes should probably uses Files.copy, e.g. > ZipPath, sjavac/CopyFile.java. Good idea! Replaced in few places. But not in ZipPath: it's actually implementation of underlying call from Files.copy: `jdk.nio.zip

Re: RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo [v5]

2020-12-20 Thread Andrey Turbanov
> 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo use Files.copy

Re: RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo [v4]

2020-12-20 Thread Andrey Turbanov
> 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo use Files.copy in MLet

Re: RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo [v3]

2020-12-20 Thread Andrey Turbanov
> 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo revert changes in ASM

Re: RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo [v2]

2020-12-20 Thread Andrey Turbanov
> 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision: 8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo revert changes in JrtP

RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo

2020-12-20 Thread Andrey Turbanov
8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo - Commit messages: - 8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo - 8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo Changes: https://git.openjdk.java.

Integrated: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop

2020-12-19 Thread Andrey Turbanov
On Wed, 2 Dec 2020 19:23:28 GMT, Andrey Turbanov wrote: > There are few places in code where manual `while` loop is used with > `Iterator` to iterate over `Collection`. > Instead of manual `while` cycles it's preferred to use _enhanced-for_ cycle > instead: it's le

Re: RFR: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop

2020-12-16 Thread Andrey Turbanov
On Wed, 16 Dec 2020 14:59:45 GMT, Andrey Turbanov wrote: >> These tests more or less *never* fail so how are you sure it is not your >> changes ? >> And 8 beans tests failed and you made 3 changes in beans code so I'd like to >> see some evidence >> to show

Re: RFR: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop

2020-12-16 Thread Andrey Turbanov
On Tue, 15 Dec 2020 21:14:08 GMT, Phil Race wrote: >> I've run `test-tier3`. 15 tests failed. Looks like they are not related to >> my changes: >> >> JT Harness : Tests that failed >> Tests are grouped by their final status message. >> Execution failed: `main' threw exception: TestF

Re: RFR: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop

2020-12-15 Thread Andrey Turbanov
On Mon, 14 Dec 2020 20:04:05 GMT, Phil Race wrote: >> I've added few words in description. >> >> About testing: as I can see testing is done via Github Actions. tier1 builds >> are ok. > >> I've added few words in description. >> >> About testing: as I can see testing is done via Github Action

Re: RFR: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop [v2]

2020-12-15 Thread Andrey Turbanov
error-prone. > It doesn't have any performance impact: java compiler generates similar code > when compiling _enhanced-for_ cycle. > > See similar cleanup in C++ code - #1707 Andrey Turbanov has updated the pull request with a new target base due to a merge or a rebase. The p

Re: RFR: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop

2020-12-14 Thread Andrey Turbanov
On Sat, 12 Dec 2020 23:05:35 GMT, Phil Race wrote: >> The bug is filed: >> https://bugs.openjdk.java.net/browse/JDK-8258006 > > Whilst this looks "reasonable" I am not impressed by the complete lack of > description of > 1) why this is being proposed > 2) what are the benefits > 3) what testing

RFR: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop

2020-12-11 Thread Andrey Turbanov
8258006: Replaces while cycles with iterator with enhanced for in java.desktop - Commit messages: - [PATCH] Replaces while cycles with iterator with enhanced for in java.desktop Changes: https://git.openjdk.java.net/jdk/pull/1574/files Webrev: https://webrevs.openjdk.java.net/?repo

Integrated: 8257438: Avoid adding duplicate values into extendedKeyCodesSet

2020-12-03 Thread Andrey Turbanov
On Sat, 28 Nov 2020 20:12:57 GMT, Andrey Turbanov wrote: > Looks like extended key codes set was filled with _synonyms_ > https://wiki.linuxquestions.org/wiki/List_of_Keysyms_Recognised_by_Xmodmap > `0x10006cc` is a _Farsi_yeh_ and also deprecated synonym _Arabic_farsi_yeh_ > `0x10

RFR. Repeated words typos in java.desktop

2019-06-04 Thread Andrey Turbanov
Hello. I would like to contribute small patch to fix repeated words typos. Andrey Turbanov diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameManager.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameManager.java index c2ce10b0e4a..ccd65105699