/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @summary unit tests for java.lang.invoke.MethodHandle.invoke
* @compile InvokeGenericTest.java
*/
/**
*
* @author jrose
*/
public class InvokeGenericTest {
// How much output?
static {
}
// public static void main(String... av) throws Throwable {
// new InvokeGenericTest().testFirst();
// }
@Test
verbosity += 9; try {
// left blank for debugging
}
public InvokeGenericTest() {
}
public void printCounts() {
allPosTests += posTests;
allNegTests += negTests;
}
}
else ++negTests;
}
if (verbosity >= 1)
}
}
}
}
}
return entry;
}
}
if (verbosity >= 3)
}
}
return (int)(value);
return (long)(value);
return (char)(value);
return (short)(value);
return (float)(value);
return (double)(value);
return (byte)(value);
return null;
}
static long nextArgVal;
long val = nextArgVal++;
val >>= 1;
if (moreBits)
// Guarantee some bits in the high word.
// In any case keep the decimal representation simple-looking,
// with lots of zeroes, so as not to make the printed decimal
// strings unnecessarily noisy.
}
static int nextArg() {
// Produce a 32-bit result something like ONE_MILLION+(smallint).
// Example: 1_000_042.
return (int) nextArg(false);
}
// produce a 64-bit result something like
// ((TEN_BILLION+1) * (ONE_MILLION+(smallint)))
// Example: 10_000_420_001_000_042.
return nextArg(true);
return (long) nextArg();
}
return wrap;
}
// import sun.invoke.util.Wrapper;
// Wrapper wrap = Wrapper.forBasicType(dst);
// if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst))
// wrap = Wrapper.forWrapperType(dst);
// if (wrap != Wrapper.OBJECT)
// return wrap.wrap(nextArg++);
if (param.isInterface()) {
{ param = c; break; }
}
}
return "#"+nextArg();
else
try {
return param.newInstance();
}
return null; // random class not Object, String, Integer, etc.
}
return args;
}
return args;
}
if (x != null) return x;
return null;
}
return args;
}
}
}
static <T> T[] cat(T[] a, T... b) {
if (blen == 0) return a;
return c;
}
}
return res;
}
if (x == null) return x;
if (x instanceof String) return x; // keep the name
if (x instanceof List) {
// recursively report classes of the list elements
}
return x.getClass().getSimpleName();
}
}
}
// This lookup is good for all members in and under InvokeGenericTest.
}
return mh;
}
}
}
static {
try {
"collector",
} catch (ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
@Test
startTest("testSimple");
countTest();
//System.out.println(res);
}
@Test
startTest("testSimplePrims");
countTest();
//System.out.println(res);
}
@Test
startTest("testAlternateName");
countTest();
//System.out.println(res);
}
@Test
startTest("testWrongArgumentCount");
for (int i = 0; i <= 10; i++) {
if (i <= 4) {
}
}
}
for (int i = 0; i < max; i++) {
for (int k = 0; k <= 2; k++) {
}
}
}
public void testWrongArgumentCount(List<Class<?>> expect, List<Class<?>> observe) throws Throwable {
countTest(false);
assert(false);
try {
case 0:
case 1:
case 2:
case 3:
case 4:
default:
}
} catch (WrongMethodTypeException ex) {
return;
}
}
/** Make a list of all combinations of the given types, with the given arities.
* A void return type is possible iff the first type is void.class.
*/
// build arity-zero types first
}
if (types[0] == void.class)
// void is not an argument type
break;
}
}
}
}
}
}
@Test
startTest("testReferenceConversions");
}
}
countTest();
if (nargs == 2) {
} else {
assert(false); // write this code
}
//System.out.println(res);
}
@Test
startTest("testBoxConversions");
countTest();
//System.out.println(res);
}
}