ADD: added new version of protobuf

This commit is contained in:
Henry Winkel
2022-12-20 10:09:28 +01:00
parent 4a79559129
commit 1e2b3dda7b
1513 changed files with 123720 additions and 83381 deletions

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.8</version>
<version>3.21.12</version>
</parent>
<artifactId>protobuf-java-util</artifactId>

View File

@@ -12,8 +12,7 @@
<name>Protocol Buffers [Util]</name>
<description>Utilities for Protocol Buffers</description>
<dependencies>
{dependencies}
</dependencies>
{dependencies}
</project>

View File

@@ -101,8 +101,9 @@ public final class FieldMaskUtil {
/**
* Constructs a FieldMask for a list of field paths in a certain type.
*
* @throws IllegalArgumentException if any of the field path is not valid
* @throws IllegalArgumentException if any of the field path is not valid.
*/
// TODO(xiaofeng): Consider renaming fromStrings()
public static FieldMask fromStringList(Class<? extends Message> type, Iterable<String> paths) {
return fromStringList(Internal.getDefaultInstance(type).getDescriptorForType(), paths);
}

View File

@@ -343,8 +343,7 @@ public final class Timestamps {
public static Timestamp fromDate(Date date) {
if (date instanceof java.sql.Timestamp) {
java.sql.Timestamp sqlTimestamp = (java.sql.Timestamp) date;
long time = sqlTimestamp.getTime();
long integralSeconds = (time < 0 && time % 1000 != 0) ? time / 1000L - 1 : time / 1000L ; // truncate the fractional seconds
long integralSeconds = sqlTimestamp.getTime() / 1000L; // truncate the fractional seconds
return Timestamp.newBuilder()
.setSeconds(integralSeconds)
.setNanos(sqlTimestamp.getNanos())

View File

@@ -75,7 +75,10 @@ public final class Values {
* element in the iterable.
*/
public static Value of(Iterable<Value> values) {
return Value.newBuilder().setListValue(ListValue.newBuilder().addAllValues(values)).build();
Value.Builder valueBuilder = Value.newBuilder();
ListValue.Builder listValue = valueBuilder.getListValueBuilder();
listValue.addAllValues(values);
return valueBuilder.build();
}
private Values() {}

View File

@@ -475,20 +475,6 @@ public class TimestampsTest {
Timestamp timestamp = Timestamps.fromDate(date);
assertThat(Timestamps.toString(timestamp)).isEqualTo("1970-01-01T00:00:01.111Z");
}
@Test
public void testFromSqlTimestamp_beforeEpoch() {
Date date = new java.sql.Timestamp(-1111);
Timestamp timestamp = Timestamps.fromDate(date);
assertThat(Timestamps.toString(timestamp)).isEqualTo("1969-12-31T23:59:58.889Z");
}
@Test
public void testFromSqlTimestamp_beforeEpochWholeSecond() {
Date date = new java.sql.Timestamp(-2000);
Timestamp timestamp = Timestamps.fromDate(date);
assertThat(Timestamps.toString(timestamp)).isEqualTo("1969-12-31T23:59:58Z");
}
@Test
public void testTimeOperations() throws Exception {