< prev index next >
test/jdk/valhalla/valuetypes/QTypeDescriptorTest.java
Print this page
rev 52850 : imported patch method-var-handles
@@ -21,15 +21,15 @@
* questions.
*/
/*
* @test
- * @summary Verify ValueTypes attribute generated by core reflection,
- * dynamic proxy and lambda proxy classes
- * @compile -XDallowFlattenabilityModifiers -XDallowWithFieldOperator Point.java Line.java MutablePath.java
- * @compile -XDallowFlattenabilityModifiers -XDallowWithFieldOperator NonFlattenValue.java
- * @run testng/othervm -XX:+EnableValhalla -Dsun.reflect.inflationThreshold=0 ValueTypesAttributeTest
+ * @summary Test core reflection, dynamic proxy and lambdas that generates
+ * classes dynamically that reference Q-type and L-type
+ * @compile -XDallowWithFieldOperator Point.java Line.java MutablePath.java
+ * @compile -XDallowWithFieldOperator NonFlattenValue.java
+ * @run testng/othervm -XX:+EnableValhalla -Dsun.reflect.inflationThreshold=0 QTypeDescriptorTest
*/
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@@ -38,11 +38,11 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
-public class ValueTypesAttributeTest {
+public class QTypeDescriptorTest {
static final Point P0 = Point.makePoint(10, 20);
static final Point P1 = Point.makePoint(30, 40);
static final NonFlattenValue NFV = NonFlattenValue.make(30, 40);
@Test
@@ -58,23 +58,25 @@
f.apply(new Point[] { P0, P1});
}
@Test
public static void testMethodInvoke() throws Exception {
- Method m = ValueTypesAttributeTest.class
- .getDeclaredMethod("toLine", Point.class, NonFlattenValue.class);
+ Class<?> pointQType = Point.class.asValueType();
+ Class<?> nonFlattenValueQType = NonFlattenValue.class.asValueType();
+ Method m = QTypeDescriptorTest.class
+ .getDeclaredMethod("toLine", pointQType, nonFlattenValueQType);
makeLine(m, P0, NFV);
- m = ValueTypesAttributeTest.class
+ m = QTypeDescriptorTest.class
.getDeclaredMethod("toLine", Point[].class);
makeLine(m, (Object) new Point[] { P0, P1});
}
private static void makeLine(Method m, Object... args) throws Exception {
Line l = (Line) m.invoke(null, args);
assertEquals(l.p1, P0);
- assertEquals(l.p2, NFV.point());
+ assertEquals(l.p2, NFV.pointValue());
}
@Test
public static void testStaticMethod() throws Throwable {
// static method in a value type with no parameter and void return type
@@ -111,22 +113,22 @@
throw new UnsupportedOperationException(method.toString());
}
};
Class<?>[] intfs = new Class<?>[] { I.class };
- I intf = (I) Proxy.newProxyInstance(ValueTypesAttributeTest.class.getClassLoader(), intfs, handler);
+ I intf = (I) Proxy.newProxyInstance(QTypeDescriptorTest.class.getClassLoader(), intfs, handler);
Line l = intf.toLine(P0, NFV);
assertEquals(l.p1, P0);
- assertEquals(l.p2, NFV.point());
+ assertEquals(l.p2, NFV.pointValue());
}
private static <T> T[] newArray(IntFunction<T[]> arrayCreator, int size) {
return arrayCreator.apply(size);
}
private static Line toLine(Point p, NonFlattenValue nfv) {
- return Line.makeLine(p, nfv.point());
+ return Line.makeLine(p, nfv.pointValue());
}
private static Line toLine(Point[] points) {
assertTrue(points.length == 2);
return Line.makeLine(points[0], points[1]);
< prev index next >