Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPROTO-52 ProtoSchemaBuilder fails with Date and Instant fields that … #36

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ private String generateReadFromMethod(ProtoMessageTypeMetadata messageTypeMetada
iw.inc();
String v;
if (Date.class.isAssignableFrom(fieldMetadata.getJavaType())) {
v = box(defaultValue + "L", fieldMetadata.getJavaType());
v = defaultValue + "L";
} else if (Instant.class.isAssignableFrom(fieldMetadata.getJavaType())) {
v = box(defaultValue + "L", fieldMetadata.getJavaType());
v = defaultValue + "L";
} else if (defaultValue instanceof ProtoEnumValueMetadata) {
Enum enumValue = ((ProtoEnumValueMetadata) defaultValue).getEnumValue();
v = enumValue.getDeclaringClass().getName() + "." + enumValue.name();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,16 @@ static class MessageWithAllFieldTypes {
@ProtoField(number = 30, defaultValue = "xyz")
String[] testField30 = {"one", "two"};

@ProtoField(number = 31/*, defaultValue = "1"*/)
@ProtoField(number = 31, defaultValue = "1")
Date testField31 = new Date(100);

@ProtoField(number = 32/*, defaultValue = "1"*/)
@ProtoField(number = 32, defaultValue = "1")
Date[] testField32 = {new Date(100), new Date(200)};

@ProtoField(number = 33/*, defaultValue = "1"*/)
@ProtoField(number = 33, defaultValue = "1")
Instant testField33 = Instant.ofEpochMilli(100);

@ProtoField(number = 34/*, defaultValue = "1"*/)
@ProtoField(number = 34, defaultValue = "1")
Instant[] testField34 = {Instant.ofEpochMilli(100), Instant.ofEpochMilli(200)};

@ProtoField(number = 35, defaultValue = "35")
Expand Down Expand Up @@ -707,7 +707,7 @@ public void setTestField80(String[] testField80) {

private Date testField81 = new Date(100);

@ProtoField(number = 81/*, defaultValue = "1"*/)
@ProtoField(number = 81, defaultValue = "1")
public Date getTestField81() {
return testField81;
}
Expand All @@ -718,7 +718,7 @@ public void setTestField81(Date testField81) {

private Date[] testField82 = {new Date(100), new Date(200)};

@ProtoField(number = 82/*, defaultValue = "1"*/)
@ProtoField(number = 82, defaultValue = "1")
public Date[] getTestField82() {
return testField82;
}
Expand All @@ -729,7 +729,7 @@ public void setTestField82(Date[] testField82) {

private Instant testField83 = Instant.ofEpochMilli(100);

@ProtoField(number = 83/*, defaultValue = "1"*/)
@ProtoField(number = 83, defaultValue = "1")
public Instant getTestField83() {
return testField83;
}
Expand All @@ -740,7 +740,7 @@ public void setTestField83(Instant testField83) {

private Instant[] testField84 = {Instant.ofEpochMilli(100), Instant.ofEpochMilli(200)};

@ProtoField(number = 84/*, defaultValue = "1"*/)
@ProtoField(number = 84, defaultValue = "1")
public Instant[] getTestField84() {
return testField84;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void testReadWrite() throws Exception {
user.setId(1);
user.setName("John");
user.setSurname("Batman");
user.setSalutation("Sir");
user.setGender(User.Gender.MALE);
user.setAccountIds(new HashSet<>(Arrays.asList(1, 3)));
List<Address> addresses = new ArrayList<>();
Expand Down