Skip to content

8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order#11870

Closed
mlchung wants to merge 4 commits intoopenjdk:masterfrom
mlchung:JDK-8299183
Closed

8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order#11870
mlchung wants to merge 4 commits intoopenjdk:masterfrom
mlchung:JDK-8299183

Conversation

@mlchung
Copy link
Member

@mlchung mlchung commented Jan 5, 2023

Trivial fix. Fix Invokers.checkExactType to call newWrongMethodTypeException(actual, expected) with parameters in right order.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11870/head:pull/11870
$ git checkout pull/11870

Update a local copy of the PR:
$ git checkout pull/11870
$ git pull https://git.openjdk.org/jdk pull/11870/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11870

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11870.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 5, 2023

👋 Welcome back mchung! 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 openjdk bot added the rfr Pull request is ready for review label Jan 5, 2023
@openjdk
Copy link

openjdk bot commented Jan 5, 2023

@mlchung The following label will be automatically applied to this pull request:

  • core-libs

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

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jan 5, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 5, 2023

Webrevs

Copy link
Member

@irisclark irisclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter order for method invocation now matches method declaration on line 521.

@openjdk
Copy link

openjdk bot commented Jan 5, 2023

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

8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order

Reviewed-by: iris, jpai

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

  • b7eb4e2: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator
  • a638663: 8255119: Monitor::wait takes signed integer as timeout
  • 4395578: Merge
  • d49851a: 8299689: Make use of JLine for Console as "opt-in"
  • f79b3d4: 6381945: (cal) Japanese calendar unit test system should avoid multiple static imports
  • f36f135: 8299501: Usage of constructors of primitive wrapper classes should be avoided in java.util API docs
  • b8852f6: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs
  • 679e485: 8043251: Bogus javac error: required: no arguments, found: no arguments
  • cd10c72: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs
  • bfd5971: 8299757: Update JCov version to 3.0.14
  • ... and 45 more: https://git.openjdk.org/jdk/compare/3e2314d08218dc8a4f4fc61bd4e1d5e58a0129c7...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.

➡️ 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 Pull request is ready to be integrated label Jan 5, 2023
@jaikiran
Copy link
Member

jaikiran commented Jan 6, 2023

Hello Mandy, this looks good to me. The copyright year on the file will need an update.

There's another call to this newWrongMethodTypeException method on line 515 and I am guessing that one is already passing the params in the correct order. If I go by that same logic, then there appears to be a direct construction of WrongMethodTypeException on line 497 and I suspect the String passed to it is perhaps using the wrong order? It currently says:

if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) {
     throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found "
                    + ad.symbolicMethodTypeExact);
}

Should it instead say:

if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) {
    throw new WrongMethodTypeException("expected " + ad.symbolicMethodTypeExact + " but found "
                    + handle.accessModeType(ad.type));
}

@mlchung
Copy link
Member Author

mlchung commented Jan 6, 2023

@jaikiran good observation.

"expected" and "actual" parameters are confusing. "expected" is ambiguous and it could refer to handle's method type or symbolic type descriptor. I decide to rename the parameters and the exception message for clarity.

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes Mandy. Overall the error message looks more clear now.

There's a failing test in GitHub actions job which appears to be an existing test case which was expecting the older error message in the exception. That would need an update:

test VarHandleTestExact.testExactArraySet(class [Ljava.lang.Object;, "abcd", VarHandleTestExact$$Lambda$87/0x000000010015b1c0@2a9fbca4): failure
java.lang.AssertionError: 'handle's method type (Object[],int,Object)void but found (Object[],int,String)void' did not match the pattern '.*\\Qexpected (Object[],int,Object)void \\E.*'.
	at VarHandleTestExact.assertMatches(VarHandleTestExact.java:214)
	at VarHandleTestExact.doTest(VarHandleTestExact.java:199)
	at VarHandleTestExact.testExactArraySet(VarHandleTestExact.java:153)

* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand, the copyright notice on test files don't use the "Classpath" exception and instead use a different copyright notice.

Copy link
Member Author

@mlchung mlchung Jan 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. Thanks for catching it. This reveals that the copyright header of several test/jdk/java/lang/invoke tests will need clean up (as this new test was copied from an existing test). I will create a JBS issue for that.

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Mandy for the changes. Looks good to me.

@mlchung
Copy link
Member Author

mlchung commented Jan 10, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jan 10, 2023

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

  • 8b0133f: 8299259: C2: Div/Mod nodes without zero check could be split through iv phi of loop resulting in SIGFPE
  • d68de02: 8299845: Remove obsolete comments in DirtyCardToOopClosure::get_actual_top
  • debe587: 8298381: Improve handling of session tickets for multiple SSLContexts
  • eab1e62: 8297487: G1 Remark: no need to keep alive oop constants of nmethods on stack
  • c8a8388: 8299789: Compilation of gtest causes build to fail if runtime libraries are in different dirs
  • 5f37cbe: 8297572: Remove unused PrecisionStyle::Precise
  • f95346e: 8299261: Clean up AWT D3D exports
  • 195f313: 8287925: AArch64: intrinsics for compareUnsigned method in Integer and Long
  • 3a66737: 8299525: RISC-V: Add backend support for half float conversion intrinsics
  • b7eb4e2: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator
  • ... and 54 more: https://git.openjdk.org/jdk/compare/3e2314d08218dc8a4f4fc61bd4e1d5e58a0129c7...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 10, 2023
@openjdk openjdk bot closed this Jan 10, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 10, 2023
@openjdk
Copy link

openjdk bot commented Jan 10, 2023

@mlchung Pushed as commit a86b6f6.

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

@mlchung mlchung deleted the JDK-8299183 branch January 24, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants