Skip to content

Commit

Permalink
Merge pull request #4977 from JasonFengJ9/mhwmte
Browse files Browse the repository at this point in the history
VarargsCollectorHandle.asType throws WrongMethodTypeException
  • Loading branch information
DanHeidinga authored Mar 6, 2019
2 parents a49df25 + 4898527 commit d6d2c44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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

0 comments on commit d6d2c44

Please sign in to comment.