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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,7 @@ K0677=Module '{0}' no access to: package '{1}' which is not exported by module '
K0678=Class '{0}' no access to: '{1}'
K0679=Module '{0}' no access to: package '{1}' because module '{0}' can't read module '{2}'
K0680=Class '{0}' no access to: class '{1}'
K0681=Failed to build collector

#java.lang.StackWalker
K0639="Stack walker not configured with RETAIN_CLASS_REFERENCE"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*[INCLUDE-IF Sidecar17]*/
/*******************************************************************************
* Copyright (c) 2009, 2018 IBM Corp. and others
* Copyright (c) 2009, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -140,6 +140,11 @@ public Object invokeWithArguments(Object... args) throws Throwable, WrongMethodT

private CollectHandle previousCollector = null;

private WrongMethodTypeException throwNewWMTE(IllegalArgumentException iae) {
/*[MSG "K0681", "Failed to build collector"]*/
throw new WrongMethodTypeException(com.ibm.oti.util.Msg.getString("K0681"), iae); //$NON-NLS-1$
}

@Override
public MethodHandle asType(MethodType newType) throws ClassCastException {
if (type == newType) {
Expand Down Expand Up @@ -170,7 +175,11 @@ public MethodHandle asType(MethodType newType) throws ClassCastException {
}
CollectHandle collector = previousCollector;
if ((collector == null) || (collector.collectArraySize != collectCount)) {
collector = (CollectHandle) next.asCollector(arrayType, collectCount);
try {
collector = (CollectHandle) next.asCollector(arrayType, collectCount);
} catch (IllegalArgumentException iae) {
throw throwNewWMTE(iae);
}
// update cached collector handle
previousCollector = collector;
}
Expand Down