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

Conversation

turbanoff
Copy link
Member

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


Progress

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

Issue

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

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4680/head:pull/4680
$ git checkout pull/4680

Update a local copy of the PR:
$ git checkout pull/4680
$ git pull https://git.openjdk.java.net/jdk 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:
https://git.openjdk.java.net/jdk/pull/4680.diff

@bridgekeeper
Copy link

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.

@openjdk
Copy link

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.

@openjdk openjdk bot added 2d client-libs-dev@openjdk.org sound client-libs-dev@openjdk.org i18n i18n-dev@openjdk.org awt client-libs-dev@openjdk.org labels Jul 4, 2021
@stsypanov
Copy link
Contributor

stsypanov commented Aug 2, 2021

@turbanoff hi, I've filed an issue for this: https://bugs.openjdk.java.net/browse/JDK-8271603

@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 Pull request is ready for review label Aug 9, 2021
@mlbridge
Copy link

mlbridge bot commented Aug 9, 2021

Webrevs

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

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 CONTRIBUTING.md 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/KeepAliveStreamCloseWithWrongContentLength.java 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: https://git.openjdk.java.net/jdk/compare/9689f615206e96f17ffc1fe7a8efeee0a90c904b...master

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 Pull request is ready to be integrated 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
@turbanoff
Copy link
Member Author

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
@openjdk
Copy link

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 https://git.openjdk.java.net/jdk 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 Pull request has merge conflict with target branch and removed ready Pull request is ready to be integrated labels Sep 1, 2021
…ector-usage-in-java.desktop

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

turbanoff commented Sep 7, 2021

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 7, 2021
@openjdk
Copy link

openjdk bot commented Sep 7, 2021

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

@mrserb
Copy link
Member

mrserb commented Sep 8, 2021

/sponsor

@openjdk
Copy link

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/TestRecordedFrame.java timing out
  • 4eacdb3: 8273104: Refactoring option parser for UL
  • 8884d2f: 8273462: ProblemList vmTestbase/vm/mlvm/anonloader/stress/oome/heap/Test.java in -Xcomp mode
  • d6d6c06: 8273246: Amend the test java/nio/channels/DatagramChannel/ManySourcesAndTargets.java to execute in othervm mode
  • 708407e: 8273168: Remove superfluous use of boxing in java.desktop
  • 270a9d9: 8273043: [TEST_BUG] Automate NimbusJTreeSelTextColor.java
  • 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 Test7179138_1.java
  • 041ae20: 8268558: [TESTBUG] Case 2 in TestP11KeyFactoryGetRSAKeySpec is skipped
  • ... and 46 more: https://git.openjdk.java.net/jdk/compare/9689f615206e96f17ffc1fe7a8efeee0a90c904b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 8, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 8, 2021
@openjdk
Copy link

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
Labels
2d client-libs-dev@openjdk.org awt client-libs-dev@openjdk.org i18n i18n-dev@openjdk.org integrated Pull request has been integrated sound client-libs-dev@openjdk.org
4 participants