< prev index next >
test/jdk/valhalla/valuetypes/ValueBootstrapMethods.java
Print this page
rev 55127 : 8223351: [lworld] Primary mirror and nullable mirror for inline type
Reviewed-by: tbd
*** 32,56 ****
import java.io.IOException;
import java.lang.invoke.CallSite;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
! import java.lang.reflect.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
- import java.util.HashSet;
import java.util.List;
import java.util.Objects;
- import java.util.Set;
- import jdk.internal.org.objectweb.asm.Attribute;
- import jdk.internal.org.objectweb.asm.ByteVector;
- import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Handle;
- import jdk.internal.org.objectweb.asm.Label;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Type;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
public class ValueBootstrapMethods {
--- 32,50 ----
import java.io.IOException;
import java.lang.invoke.CallSite;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
! import java.lang.reflect.Method;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Objects;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Handle;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Type;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
public class ValueBootstrapMethods {
*** 58,68 ****
public static void main(String... args) throws Throwable {
Class<?> test = valueTestClass();
Value value = Value.make(10, 5.03, "foo", "bar", "goo");
! Class<?> valueClass = Value.class.asValueType();
Method hashCode = test.getMethod("hashCode", valueClass);
int hash = (int)hashCode.invoke(null, value);
assertEquals(hash, value.hashCode());
Method toString = test.getMethod("toString", valueClass);
--- 52,62 ----
public static void main(String... args) throws Throwable {
Class<?> test = valueTestClass();
Value value = Value.make(10, 5.03, "foo", "bar", "goo");
! Class<?> valueClass = Value.class.asPrimaryType();
Method hashCode = test.getMethod("hashCode", valueClass);
int hash = (int)hashCode.invoke(null, value);
assertEquals(hash, value.hashCode());
Method toString = test.getMethod("toString", valueClass);
*** 95,105 ****
v = __WithField(v.l, List.of(items));
return v;
}
List<Object> values() {
! return List.of(Value.class.asValueType(), i, d, s, l);
}
public int hashCode() {
return values().hashCode();
}
--- 89,99 ----
v = __WithField(v.l, List.of(items));
return v;
}
List<Object> values() {
! return List.of(Value.class, i, d, s, l);
}
public int hashCode() {
return values().hashCode();
}
*** 114,124 ****
/*
* Generate ValueTest class
*/
private static Class<?> valueTestClass() throws Exception {
Path path = Paths.get(TEST_CLASSES, "ValueTest.class");
! generate(Value.class.asValueType(), "ValueTest", path);
return Class.forName("ValueTest");
}
private static void assertEquals(Object o1, Object expected) {
if (!Objects.equals(o1, expected)) {
--- 108,118 ----
/*
* Generate ValueTest class
*/
private static Class<?> valueTestClass() throws Exception {
Path path = Paths.get(TEST_CLASSES, "ValueTest.class");
! generate(Value.class, "ValueTest", path);
return Class.forName("ValueTest");
}
private static void assertEquals(Object o1, Object expected) {
if (!Objects.equals(o1, expected)) {
< prev index next >