26 * type. The derived value type (DVT) is referred to as
27 * ValueCapableClass2$Value.
28 */
29 package compiler.valhalla.valuetypes;
30
31 import java.lang.invoke.MethodHandle;
32 import java.lang.invoke.MethodHandles;
33
34 import jdk.incubator.mvt.ValueType;
35
36 @jdk.incubator.mvt.ValueCapableClass
37 public final class ValueCapableClass2 {
38 public final long u;
39
40 public static final MethodHandle FACTORY;
41 static {
42 MethodHandles.Lookup lookup = MethodHandles.lookup();
43 ValueType<?> VT = ValueType.forClass(ValueCapableClass2.class);
44 try {
45 FACTORY = VT.unreflectWithers(lookup, true, VT.valueFields());
46 } catch(NoSuchFieldException|IllegalAccessException e) {
47 throw new RuntimeException("method handle lookup fails");
48 }
49 }
50
51 private ValueCapableClass2(long u) {
52 this.u = u;
53 }
54
55 public static ValueCapableClass2 create(long u) {
56 return new ValueCapableClass2(u);
57 }
58 }
|
26 * type. The derived value type (DVT) is referred to as
27 * ValueCapableClass2$Value.
28 */
29 package compiler.valhalla.valuetypes;
30
31 import java.lang.invoke.MethodHandle;
32 import java.lang.invoke.MethodHandles;
33
34 import jdk.incubator.mvt.ValueType;
35
36 @jdk.incubator.mvt.ValueCapableClass
37 public final class ValueCapableClass2 {
38 public final long u;
39
40 public static final MethodHandle FACTORY;
41 static {
42 MethodHandles.Lookup lookup = MethodHandles.lookup();
43 ValueType<?> VT = ValueType.forClass(ValueCapableClass2.class);
44 try {
45 FACTORY = VT.unreflectWithers(lookup, true, VT.valueFields());
46 } catch (NoSuchFieldException|IllegalAccessException e) {
47 throw new RuntimeException("method handle lookup fails");
48 }
49 }
50
51 private ValueCapableClass2(long u) {
52 this.u = u;
53 }
54
55 public static ValueCapableClass2 create(long u) {
56 return new ValueCapableClass2(u);
57 }
58 }
|