< prev index next >

test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueTypeCreation.java

Print this page

        

@@ -41,10 +41,11 @@
     public void run() {
         testPoint();
         testLong8();
         // Embedded oops not yet supported
         //testPerson();
+        StaticSelf.test();
     }
 
     void testPoint() {
         Point p = Point.createPoint(1, 2);
         Asserts.assertEquals(p.x, 1, "invalid point x value");

@@ -70,6 +71,26 @@
         Person person = Person.create(1, "John", "Smith");
         Asserts.assertEquals(person.getId(), 1L, "Id field incorrect");
         Asserts.assertEquals(person.getFirstName(), "John", "First name incorrect");
         Asserts.assertEquals(person.getLastName(), "Smith", "Last name incorrect");
     }
+
+    static final __ByValue class StaticSelf {
+
+        static final StaticSelf DEFAULT = create(0);
+        final int f1;
+
+        private StaticSelf() { f1 = 0; }
+        public String toString() { return "StaticSelf f1=" + f1; }
+
+        __ValueFactory static StaticSelf create(int f1) {
+            StaticSelf s = __MakeDefault StaticSelf();
+            s.f1 = f1;
+            return s;
+        }
+
+        public static void test() {
+            String s = DEFAULT.toString();
+        }
+
+    }
 }
< prev index next >