< prev index next >
test/hotspot/jtreg/runtime/valhalla/valuetypes/Person.java
Print this page
@@ -27,14 +27,14 @@
final int id;
final String firstName;
final String lastName;
- private Person() {
- id = 0;
- firstName = null;
- lastName = null;
+ private Person(int id, String firstName, String lastName) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
}
public int getId() { return id; }
public String getFirstName() { return firstName; }
public String getLastName() { return lastName; }
@@ -42,12 +42,8 @@
public String toString() {
return getFirstName() + " " + getLastName() + " (id=" + getId() + ")";
}
static Person create(int id, String firstName, String lastName) {
- Person p = Person.default;
- p = __WithField(p.id, id);
- p = __WithField(p.firstName, firstName);
- p = __WithField(p.lastName, lastName);
- return p;
+ return new Person(id, firstName, lastName);
}
}
< prev index next >