< prev index next >

jdk/test/valhalla/mvt/WithFieldTest.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import jdk.experimental.value.MethodHandleBuilder;
  25 import jdk.experimental.value.ValueType;
  26 import org.testng.annotations.Test;
  27 
  28 import java.lang.invoke.MethodHandle;
  29 import java.lang.invoke.MethodHandles;
  30 import java.lang.invoke.MethodType;
  31 
  32 import static org.testng.Assert.*;
  33 
  34 /*
  35  * @test


  36  * @run testng/othervm -XX:+EnableMVT -Dvalhalla.enablePoolPatches=true WithFieldTest
  37  */
  38 
  39 @Test
  40 public class WithFieldTest {
  41 
  42     static final ValueType<?> VT_Point = ValueType.forClass(Point.class);
  43 
  44     static final ValueType<?> VT_PrivatePoint = ValueType.forClass(PrivatePoint.class);
  45 
  46     static final MethodHandle MH_Point_get_x;
  47 
  48     static final MethodHandle MH_PrivatePoint_get_x;
  49 
  50     static {
  51         try {
  52             MH_Point_get_x = MethodHandles.lookup().findGetter(
  53                     Point.class, "x", int.class);
  54             MH_PrivatePoint_get_x = MethodHandles.lookup().findVirtual(
  55                     PrivatePoint.class, "getX", MethodType.methodType(int.class));




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import jdk.experimental.value.MethodHandleBuilder;
  25 import jdk.incubator.mvt.ValueType;
  26 import org.testng.annotations.Test;
  27 
  28 import java.lang.invoke.MethodHandle;
  29 import java.lang.invoke.MethodHandles;
  30 import java.lang.invoke.MethodType;
  31 
  32 import static org.testng.Assert.*;
  33 
  34 /*
  35  * @test
  36  * @modules java.base/jdk.experimental.value
  37  *          jdk.incubator.mvt
  38  * @run testng/othervm -XX:+EnableMVT -Dvalhalla.enablePoolPatches=true WithFieldTest
  39  */
  40 
  41 @Test
  42 public class WithFieldTest {
  43 
  44     static final ValueType<?> VT_Point = ValueType.forClass(Point.class);
  45 
  46     static final ValueType<?> VT_PrivatePoint = ValueType.forClass(PrivatePoint.class);
  47 
  48     static final MethodHandle MH_Point_get_x;
  49 
  50     static final MethodHandle MH_PrivatePoint_get_x;
  51 
  52     static {
  53         try {
  54             MH_Point_get_x = MethodHandles.lookup().findGetter(
  55                     Point.class, "x", int.class);
  56             MH_PrivatePoint_get_x = MethodHandles.lookup().findVirtual(
  57                     PrivatePoint.class, "getX", MethodType.methodType(int.class));


< prev index next >