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

VarargsCollectorHandle.asType throws WrongMethodTypeException #4977

Merged
merged 1 commit into from
Mar 6, 2019

Conversation

JasonFengJ9
Copy link
Member

VarargsCollectorHandle.asType() throws WrongMethodTypeException

Convert IllegalArgumentException to WrongMethodTypeException within VarargsCollectorHandle.asType().

This PR passes the test within #4937.

Note: Java doc states that java.lang.invoke.MethodHandle can throws NullPointerException if newType is a null reference or WrongMethodTypeException if the conversion cannot be made. There is no IllegalArgumentException thrown.
It appears there are other cases that IllegalArgumentException might be thrown. I would like to leave it as is for now since no test complains or another PR if required.

closes: #4937

Reviewer: @pshipton

Signed-off-by: Jason Feng fengj@ca.ibm.com

@pshipton
Copy link
Member

pshipton commented Mar 4, 2019

@DanHeidinga

@pshipton
Copy link
Member

pshipton commented Mar 4, 2019

jenkins test sanity zlinux jdk8,jdk11

@pshipton
Copy link
Member

pshipton commented Mar 4, 2019

jenkins test extended plinux jdk8,jdk11

@pshipton pshipton added this to the Release 0.13.0 (Java 12) milestone Mar 4, 2019
collector = (CollectHandle) next.asCollector(arrayType, collectCount);
} catch (IllegalArgumentException iae) {
/*[MSG "K0681", "Failed to build collector"]*/
throw new WrongMethodTypeException(com.ibm.oti.util.Msg.getString("K0681"), iae); //$NON-NLS-1$
Copy link
Member

Choose a reason for hiding this comment

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

Can the exception be moved to a helper method?

private WrongMethodTypeException throwNewWMTE(IlegalArgumentException iae) {
  throw new WrongMethodTypeException(com.ibm.oti.util.Msg.getString("K0681"), iae); //$NON-NLS-1$
}

and the call becomes the code below to make it clear to the reader (and the JIT!) that there is no path past this code:

throw throwNewWMTE(iae);

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, PR has been updated accordingly and verified manually that the test passes with this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Can you push the change again?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, sorry, it should be updated now.

Convert IllegalArgumentException to WrongMethodTypeException within
VarargsCollectorHandle.asType().


Signed-off-by: Jason Feng <fengj@ca.ibm.com>
Copy link
Member

@DanHeidinga DanHeidinga left a comment

Choose a reason for hiding this comment

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

lgtm

@DanHeidinga DanHeidinga self-assigned this Mar 5, 2019
@DanHeidinga
Copy link
Member

Previous change passed all the tests. This is a refactoring of the same change so will run a simple compile on it.

@DanHeidinga
Copy link
Member

Jenkins compile xlinux jdk8

@pshipton
Copy link
Member

pshipton commented Mar 5, 2019

@JasonFengJ9 please create the PR against the 0.13 branch.

@JasonFengJ9
Copy link
Member Author

Travis build failed

Unable to establish SSL connection.
The command "bash ./buildenv/travis/build-on-travis.sh" exited with 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JTReg Test Failure : java/lang/invoke/MethodHandlesArityLimitsTest.java
3 participants