Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8271603: Unnecessary Vector usage in java.desktop #4680


Copy link

@turbanoff turbanoff commented Jul 4, 2021

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.


  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed


  • JDK-8271603: Unnecessary Vector usage in java.desktop



Using git

Checkout this PR locally:
$ git fetch pull/4680/head:pull/4680
$ git checkout pull/4680

Update a local copy of the PR:
$ git checkout pull/4680
$ git pull pull/4680/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4680

View PR using the GUI difftool:
$ git pr show -t 4680

Using diff file

Download this PR as a diff file:

Copy link

@bridgekeeper bridgekeeper bot commented Jul 4, 2021

👋 Welcome back turbanoff! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

Copy link

@openjdk openjdk bot commented Jul 4, 2021

@turbanoff The following labels will be automatically applied to this pull request:

  • 2d
  • awt
  • i18n
  • sound

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

Copy link

@stsypanov stsypanov commented Aug 2, 2021

@turbanoff turbanoff changed the title [PATCH] Unnecessary Vector usage in java.desktop 8271603: Unnecessary Vector usage in java.desktop Aug 9, 2021
@openjdk openjdk bot added the rfr label Aug 9, 2021
Copy link

@mlbridge mlbridge bot commented Aug 9, 2021

src/java.desktop/share/classes/java/awt/ Outdated Show resolved Hide resolved
revert back to Enumeration
bring back default values
prrace approved these changes Aug 25, 2021
Copy link

@openjdk openjdk bot commented Aug 25, 2021

@turbanoff This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8271603: Unnecessary Vector usage in java.desktop

Reviewed-by: prr, serb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 47 new commits pushed to the master branch:

  • 041ae20: 8268558: [TESTBUG] Case 2 in TestP11KeyFactoryGetRSAKeySpec is skipped
  • 377b186: 8269119: C2: Avoid redundant memory barriers in Unsafe.copyMemory0 intrinsic
  • 70157c7: 8272135: jshell: Method cannot use its overloaded version
  • 5caa77b: 8263364: sun/net/www/http/KeepAliveStream/ wedged in getInputStream
  • a522d6b: 8273376: Zero: Disable vtable/itableStub gtests
  • 3cd95a2: 8231356: Fix broken ResourceObj::operator new[] in debug builds
  • 81c719b: 8273333: Zero should warn about unimplemented -XX:+LogTouchedMethods
  • 649c22c: 8270832: Aarch64: Update algorithm annotations for MacroAssembler::fill_words
  • eb22181: 8273386: Remove duplicated code in G1DCQS::abandon_completed_buffers
  • fc546d6: 8273378: Shenandoah: Remove the remaining uses of os::is_MP
  • ... and 37 more:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@prrace, @mrserb) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready label Aug 25, 2021
turbanoff added 2 commits Aug 25, 2021
revert back to use cycle to copy into array
migrate more usages. Not sure how I missed them
Copy link
Member Author

@turbanoff turbanoff commented Aug 25, 2021

I found many new places in java.desktop which can be migrated easily. Not sure how I did miss them in the first place.
Sorry for inconvenience. Please re-review PR.

use toArray with zero sized array in places where Vector.copyInto was used
Copy link

@openjdk openjdk bot commented Sep 1, 2021

@turbanoff this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout avoid-unnecessary-vector-usage-in-java.desktop
git fetch master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict and removed ready labels Sep 1, 2021

# Conflicts:
#	src/java.desktop/share/classes/sun/awt/shell/
@openjdk openjdk bot added ready and removed merge-conflict labels Sep 1, 2021
one more place to call toArray with zero-sized array
mrserb approved these changes Sep 4, 2021
Copy link
Member Author

@turbanoff turbanoff commented Sep 7, 2021


@openjdk openjdk bot added the sponsor label Sep 7, 2021
Copy link

@openjdk openjdk bot commented Sep 7, 2021

Your change (at version f0ab7f1) is now ready to be sponsored by a Committer.

Copy link

@mrserb mrserb commented Sep 8, 2021


Copy link

@openjdk openjdk bot commented Sep 8, 2021

Going to push as commit 1513dc7.
Since your change was applied there have been 56 commits pushed to the master branch:

  • ea4907a: 8273047: test jfr/api/consumer/ timing out
  • 4eacdb3: 8273104: Refactoring option parser for UL
  • 8884d2f: 8273462: ProblemList vmTestbase/vm/mlvm/anonloader/stress/oome/heap/ in -Xcomp mode
  • d6d6c06: 8273246: Amend the test java/nio/channels/DatagramChannel/ to execute in othervm mode
  • 708407e: 8273168: Remove superfluous use of boxing in java.desktop
  • 270a9d9: 8273043: [TEST_BUG] Automate
  • df05b4d: 8271923: [macos] the text color on the selected disabled tabbed pane button remains white making text unreadable
  • 2abf3b3: 8271340: Crash PhaseIdealLoop::clone_outer_loop
  • 99fb12c: 8271341: Opcode() != Op_If && Opcode() != Op_RangeCheck) || outcnt() == 2 assert failure with
  • 041ae20: 8268558: [TESTBUG] Case 2 in TestP11KeyFactoryGetRSAKeySpec is skipped
  • ... and 46 more:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 8, 2021
Copy link

@openjdk openjdk bot commented Sep 8, 2021

@mrserb @turbanoff Pushed as commit 1513dc7.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@turbanoff turbanoff deleted the avoid-unnecessary-vector-usage-in-java.desktop branch Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants