< prev index next >

jdk/test/valhalla/mvt/modules/m/p/Main.java

Print this page




  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 package p;
  25 
  26 import java.lang.invoke.*;
  27 import java.lang.reflect.Field;
  28 import java.util.Arrays;
  29 import java.util.Comparator;
  30 import java.util.List;
  31 import java.util.stream.Collectors;
  32 
  33 import jdk.experimental.value.ValueType;
  34 import p.internal.Point;
  35 
  36 public class Main {
  37     private static List<String> FIELD_NAMES = List.of("x", "y", "z");
  38     private static List<Class<?>> FIELD_TYPES =  List.of(int.class, short.class, short.class);
  39 
  40     public static void main(String... args) throws Exception {
  41         ValueType<?> valueType = ValueType.forClass(Point.class);
  42         Module module = Point.class.getModule();
  43         assertTrue(module.isNamed(), "unexpected " + module.toString());
  44         assertTrue(valueType.boxClass().getModule() == module,
  45                    "unexpected " + valueType.boxClass().getModule());
  46         assertTrue(valueType.valueClass().getModule() == module,
  47             "unexpected " + valueType.valueClass().getModule() );
  48 
  49         Field[] fields = Point.class.getDeclaredFields();
  50         assertTrue(fields.length == FIELD_NAMES.size(), Arrays.toString(fields));
  51 
  52         // validate field names
  53         List<String> names = Arrays.stream(fields)




  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 package p;
  25 
  26 import java.lang.invoke.*;
  27 import java.lang.reflect.Field;
  28 import java.util.Arrays;
  29 import java.util.Comparator;
  30 import java.util.List;
  31 import java.util.stream.Collectors;
  32 
  33 import jdk.incubator.mvt.ValueType;
  34 import p.internal.Point;
  35 
  36 public class Main {
  37     private static List<String> FIELD_NAMES = List.of("x", "y", "z");
  38     private static List<Class<?>> FIELD_TYPES =  List.of(int.class, short.class, short.class);
  39 
  40     public static void main(String... args) throws Exception {
  41         ValueType<?> valueType = ValueType.forClass(Point.class);
  42         Module module = Point.class.getModule();
  43         assertTrue(module.isNamed(), "unexpected " + module.toString());
  44         assertTrue(valueType.boxClass().getModule() == module,
  45                    "unexpected " + valueType.boxClass().getModule());
  46         assertTrue(valueType.valueClass().getModule() == module,
  47             "unexpected " + valueType.valueClass().getModule() );
  48 
  49         Field[] fields = Point.class.getDeclaredFields();
  50         assertTrue(fields.length == FIELD_NAMES.size(), Arrays.toString(fields));
  51 
  52         // validate field names
  53         List<String> names = Arrays.stream(fields)


< prev index next >