< prev index next >
test/valhalla/mvt/MVTTest.java
Print this page
@@ -2,13 +2,11 @@
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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
- * by Oracle in the LICENSE file that accompanied this code.
+ * published by the Free Software Foundation.
*
* 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
@@ -97,13 +95,19 @@
assertEquals((int) getter.invoke(), 0);
}
}
public void testWither() throws Throwable {
+ testWither(Point.lookup());
+ testWither(MethodHandles.privateLookupIn(VT.boxClass(), LOOKUP));
+ testWither(MethodHandles.privateLookupIn(VT.valueClass(), LOOKUP));
+ }
+
+ void testWither(MethodHandles.Lookup l ) throws Throwable {
for (int i = 0; i < FIELD_NAMES.length; i++) {
MethodHandle wither = MethodHandles.collectArguments(
- VT.findWither(LOOKUP, FIELD_NAMES[i], FIELD_TYPES[i]), 0, VT.defaultValueConstant());
+ VT.findWither(l, FIELD_NAMES[i], FIELD_TYPES[i]), 0, VT.defaultValueConstant());
String expected = TEMPLATE.replace("#" + FIELD_NAMES[i], String.valueOf(FIELD_VALUES[i]))
.replaceAll("#[xyz]", "0");
assertEquals(printReturn(wither).invoke(FIELD_VALUES[i]), expected);
}
< prev index next >