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

8255531: MethodHandles::permuteArguments throws NPE when duplicating dropped arguments #2054

wants to merge 1 commit into from


Copy link

@JornVernee JornVernee commented Jan 12, 2021


This small patch fixes the NPE in the following case:

MethodHandle mh = MethodHandles.empty(MethodType.methodType(void.class, int.class, int.class));
MethodHandles.permuteArguments(mh, MethodType.methodType(void.class, int.class), 0, 0);

If a parameter name was changed by a lambda form edit, LambdaForm::endEdit will try to sort the names that fall into the old range of parameter names (starting from firstChanged and up to arity in the code) to make sure that non-parameter names (exprs) properly appear after parameter names. But, if a parameter was dropped, and there are no non-paramter names, a null will fall into the range that is being sorted, and the call to name.isParam() in the sorting algorithm will result in an NPE.

We can just add a name != null check there, since null is definitely not a parameter. However, we still need to do the loop in order to get an accurate exprp value, which is later used to adjust the arity after sorting (there are other ways to get there that don't involve copying the extra null, but they are more convoluted, so I elected to go for this solution).


Testing: tier1-tier2


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


  • JDK-8255531: MethodHandles::permuteArguments throws NPE when duplicating dropped arguments



$ git fetch pull/2054/head:pull/2054
$ git checkout pull/2054

Copy link

@bridgekeeper bridgekeeper bot commented Jan 12, 2021

👋 Welcome back jvernee! 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 Jan 12, 2021

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

  • core-libs
  • hotspot-compiler

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

@JornVernee JornVernee commented Jan 12, 2021

/label remove hotspot-compiler

Copy link

@openjdk openjdk bot commented Jan 12, 2021

The hotspot-compiler label was successfully removed.

…from LambdaForms that don't have any other names (e.g. empty)
@JornVernee JornVernee force-pushed the JornVernee:PermArgsNPE branch from 9259e92 to c3611ce Jan 12, 2021
@JornVernee JornVernee marked this pull request as ready for review Jan 12, 2021
@openjdk openjdk bot added the rfr label Jan 12, 2021
Copy link

@mlbridge mlbridge bot commented Jan 12, 2021


cl4es approved these changes Jan 20, 2021
Copy link

@cl4es cl4es left a comment


Copy link

@openjdk openjdk bot commented Jan 20, 2021

@JornVernee 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:

8255531: MethodHandles::permuteArguments throws NPE when duplicating dropped arguments

Reviewed-by: redestad

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 132 new commits pushed to the master branch:

  • 8b95d95: 8256895: Add support for RFC 8954: Online Certificate Status Protocol (OCSP) Nonce Extension
  • 4f11ff3: 8259488: Shenandoah: Missing timing tracking for STW CLD root processing
  • 0785147: 8259949: x86 32-bit build fails when -fcf-protection is passed in the compiler flags
  • 5891509: 8259947: (fs) Optimize UnixPath.encode implementation
  • 69f90b5: 8259843: initialize dli_fname array before calling dll_address_to_library_name
  • 52ed2aa: 8259786: initialize last parameter of getpwuid_r
  • 70b5b31: 8257664: HTMLEditorKit: Wrong CSS relative font sizes
  • 0b01d69: 8260005: Shenandoah: Remove unused AlwaysTrueClosure in ShenandoahConcurrentRootScanner::roots_do()
  • 0529480: 8259867: Move encoding checks into ZipCoder
  • 7c32ffe: 8258383: vmTestbase/gc/g1/unloading/tests/unloading_compilation_level[1,2,3] time out without TieredCompilation
  • ... and 122 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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Jan 20, 2021
Copy link
Member Author

@JornVernee JornVernee commented Jan 28, 2021


@openjdk openjdk bot closed this Jan 28, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jan 28, 2021
Copy link

@openjdk openjdk bot commented Jan 28, 2021

@JornVernee Since your change was applied there have been 256 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit d07af2b.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants