[Git][java-team/msgpack-java][upstream] New upstream version 0.9.4

Andrius Merkys (@merkys) gitlab at salsa.debian.org
Mon Jul 24 09:48:30 BST 2023



Andrius Merkys pushed to branch upstream at Debian Java Maintainers / msgpack-java


Commits:
d9e504fb by Andrius Merkys at 2023-07-24T01:58:37-04:00
New upstream version 0.9.4
- - - - -


15 changed files:

- + .github/release-drafter.yml
- .github/workflows/CI.yml
- + .github/workflows/release-drafter.yml
- README.md
- RELEASE_NOTES.md
- build.sbt
- msgpack-jackson/README.md
- msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/MessagePackMapper.java
- + msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/TimestampExtensionModule.java
- + msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/MessagePackMapperTest.java
- + msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/TimestampExtensionModuleTest.java
- msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/benchmark/MessagePackDataformatHugeDataBenchmarkTest.java
- project/build.properties
- project/plugins.sbt
- sbt


Changes:

=====================================
.github/release-drafter.yml
=====================================
@@ -0,0 +1,62 @@
+name-template: 'v$RESOLVED_VERSION'
+tag-template: 'v$RESOLVED_VERSION'
+categories:
+  - title: '🔥 Breaking Changes'
+    labels:
+      - 'breaking'
+  - title: '🚀 Features'
+    labels:
+      - 'feature'
+      - 'enhancement'
+  - title: '🐛 Bug Fixes'
+    labels:
+      - 'bug'
+  - title: '👋 Deprecated'
+    labels:
+      - 'deprecation'
+  - title: '🔗 Dependency Updates'
+    labels:
+      - 'library-update'
+      - 'dependencies'
+  - title: '🛠  Internal Updates'
+    labels:
+      - 'internal'
+      - 'kaizen'
+      - 'test-library-update'
+      - 'sbt-plugin-update'
+  - title: '📚 Docs'
+    labels:
+      - 'doc'
+change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
+
+template: |
+  ## What's Changed
+
+  $CHANGES
+
+  **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
+
+
+autolabeler:
+  - label: 'doc'
+    files:
+      - '*.md'
+  - label: 'feature'
+    title:
+      - '/(support|add)/i'
+  - label: 'bug'
+    title:
+      - '/fix/i'
+  - label: 'internal'
+    title:
+      - '/internal/i'
+  - label: 'deprecation'
+    title:
+      - '/deprecate/i'
+  - label: 'library-update'
+    body:
+      - '/library-update/'
+  - label: 'internal'
+    body:
+      - '/test-library-update/'
+      - '/sbt-plugin-update/'


=====================================
.github/workflows/CI.yml
=====================================
@@ -7,6 +7,7 @@ on:
       - '**.java'
       - '**.sbt'
       - '.github/workflows/**.yml'
+      - 'project/build.properties'
   push:
     branches:
       - master
@@ -17,6 +18,8 @@ on:
       - '**.java'
       - '**.sbt'
       - '.github/workflows/**.yml'
+      - 'project/build.properties'
+    workflow_dispatch:
 
 jobs:
   code_format:


=====================================
.github/workflows/release-drafter.yml
=====================================
@@ -0,0 +1,32 @@
+name: Release Drafter
+
+on:
+  push:
+    branches:
+      - develop
+      - main
+  # pull_request event is required only for autolabeler
+  pull_request:
+    # Only following types are handled by the action, but one can default to all as well
+    types: [opened, reopened, synchronize]
+  # pull_request_target event is required for autolabeler to support PRs from forks
+  pull_request_target:
+    types: [opened, reopened, synchronize]
+  
+permissions:
+  contents: read
+
+jobs:
+  update_release_draft:
+    permissions:
+      # write permission is required to create a github release
+      contents: write
+      # write permission is required for autolabeler
+      # otherwise, read permission is required at least
+      pull-requests: write
+    runs-on: ubuntu-latest
+    steps:
+      # Drafts your next Release notes as Pull Requests are merged into "master"
+      - uses: release-drafter/release-drafter at v5
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


=====================================
README.md
=====================================
@@ -82,10 +82,8 @@ Here is a list of sbt commands for daily development:
 > ~testOnly *MessagePackTest -- (pattern)  # Run tests matching the pattern 
 > project msgpack-core                     # Focus on a specific project
 > package                                  # Create a jar file in the target folder of each project
-> findbugs                                 # Produce findbugs report in target/findbugs
-> jacoco:cover                             # Report the code coverage of tests to target/jacoco folder
 > jcheckStyle                              # Run check style
-> ;scalafmt;test:scalafmt;scalafmtSbt      # Reformat Scala codes
+> scalafmtAll                              # Reformat code
 ```
 
 ### Publishing
@@ -105,10 +103,7 @@ $ git tag v0.x.y
 $ git push origin v0.x.y
 ```
 
-To generate a release notes, you can use this command line:
-```
-$ git log v(last version).. --oneline | cut -f 2- -d ' ' | perl -npe 's/(.*)\(\#([0-9]+)\)/* \1\[\#\2\]\(http:\/\/github.com\/msgpack\/msgpack-java\/pull\/\2\)/g'
-```
+A draft of the next release note will be updated automatically at the [GitHub Releases](https://github.com/msgpack/msgpack-java/releases) page. For each PR merged, [release-drafter](https://github.com/release-drafter/release-drafter) will modify the release note draft. When you create a new release tag, edit and publish the draft of the release note. If necessary, adjust the version number and target tag.
 
 #### Publishing to Sonatype from Local Machine
 


=====================================
RELEASE_NOTES.md
=====================================
@@ -1,5 +1,7 @@
 # Release Notes
 
+The latest release notes will be available from the [GitHub release page](https://github.com/msgpack/msgpack-java/releases)
+
 ## 0.9.3
 
 This version supports JDK17 [#660](http://github.com/msgpack/msgpack-java/pull/660).


=====================================
build.sbt
=====================================
@@ -5,7 +5,7 @@ Global / concurrentRestrictions := Seq(
   Tags.limit(Tags.Test, 1)
 )
 
-val AIRFRAME_VERSION = "22.6.4"
+val AIRFRAME_VERSION = "23.5.7"
 
 // Use dynamic snapshot version strings for non tagged versions
 ThisBuild / dynverSonatypeSnapshots := true
@@ -87,12 +87,12 @@ lazy val msgpackCore = Project(id = "msgpack-core", base = file("msgpack-core"))
       "org.wvlet.airframe" %% "airframe-json" % AIRFRAME_VERSION % "test",
       "org.wvlet.airframe" %% "airspec"       % AIRFRAME_VERSION % "test",
       // Add property testing support with forAll methods
-      "org.scalacheck" %% "scalacheck" % "1.16.0" % "test",
+      "org.scalacheck" %% "scalacheck" % "1.17.0" % "test",
       // For performance comparison with msgpack v6
       "org.msgpack" % "msgpack" % "0.6.12" % "test",
       // For integration test with Akka
-      "com.typesafe.akka"      %% "akka-actor"              % "2.6.19" % "test",
-      "org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0"  % "test"
+      "com.typesafe.akka"      %% "akka-actor"              % "2.6.20" % "test",
+      "org.scala-lang.modules" %% "scala-collection-compat" % "2.11.0"  % "test"
     )
   )
 
@@ -109,7 +109,7 @@ lazy val msgpackJackson =
         "org.msgpack.jackson.dataformat"
       ),
       libraryDependencies ++= Seq(
-        "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.3",
+        "com.fasterxml.jackson.core" % "jackson-databind" % "2.15.2",
         junitInterface,
         "org.apache.commons" % "commons-math3" % "3.6.1" % "test"
       ),


=====================================
msgpack-jackson/README.md
=====================================
@@ -61,7 +61,13 @@ Only thing you need to do is to instantiate `MessagePackFactory` and pass it to
 Or more easily:
 
 ```java
-ObjectMapper objectMapper = new MessagePackMapper();
+  ObjectMapper objectMapper = new MessagePackMapper();
+```
+
+We strongly recommend to call `MessagePackMapper#handleBigDecimalAsString()` if you serialize and/or deserialize BigDecimal values. See [Serialize and deserialize BigDecimal as str type internally in MessagePack format](#serialize-and-deserialize-bigdecimal-as-str-type-internally-in-messagepack-format) for details.
+
+```java
+  ObjectMapper objectMapper = new MessagePackMapper().handleBigDecimalAsString();
 ```
 
 ### Serialization/Deserialization of List
@@ -226,23 +232,48 @@ When you want to use non-String value as a key of Map, use `MessagePackKeySerial
 
 ### Serialize and deserialize BigDecimal as str type internally in MessagePack format
 
-`jackson-dataformat-msgpack` represents BigDecimal values as float type in MessagePack format by default. When you want to handle BigDeciaml values as str type with arbitrary precision in MessagePack format, you can use `com.fasterxml.jackson.databind.cfg.MutableConfigOverride#setFormat` like this:
+`jackson-dataformat-msgpack` represents BigDecimal values as float type in MessagePack format by default for backward compatibility. But the default behavior could fail when handling too large value for `double` type. So we strongly recommend to call `MessagePackMapper#handleBigDecimalAsString()` to internally handle BigDecimal values as String.
 
 ```java
-  ObjectMapper mapper = new ObjectMapper(new MessagePackFactory());
-  mapper.configOverride(BigDecimal.class).setFormat(JsonFormat.Value.forShape(JsonFormat.Shape.STRING));
+  ObjectMapper objectMapper = new MessagePackMapper().handleBigDecimalAsString();
 
   Pojo obj = new Pojo();
+  // This value is too large to be serialized as double
   obj.value = new BigDecimal("1234567890.98765432100");
 
-  byte[] converted = mapper.writeValueAsBytes(obj);
+  byte[] converted = objectMapper.writeValueAsBytes(obj);
 
-  System.out.println(mapper.readValue(converted, Pojo.class));   // => Pojo{value=1234567890.98765432100}
+  System.out.println(objectMapper.readValue(converted, Pojo.class));   // => Pojo{value=1234567890.98765432100}
+```
+`MessagePackMapper#handleBigDecimalAsString()` is equivalent to the following configuration.
+
+```java
+  ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+  objectMapper.configOverride(BigDecimal.class).setFormat(JsonFormat.Value.forShape(JsonFormat.Shape.STRING));
+```
+
+
+### Serialize and deserialize Instant instances as MessagePack extension type
+
+`timestamp` extension type is defined in MessagePack as type:-1. Registering `TimestampExtensionModule.INSTANCE` module enables automatic serialization and deserialization of java.time.Instant to/from the MessagePack extension type.
+
+```java
+    ObjectMapper objectMapper = new MessagePackMapper()
+                                    .registerModule(TimestampExtensionModule.INSTANCE);
+    Pojo pojo = new Pojo();
+    // The type of `timestamp` variable is Instant
+    pojo.timestamp = Instant.now();
+    byte[] bytes = objectMapper.writeValueAsBytes(pojo);
+
+    // The Instant instance is serialized as MessagePack extension type (type: -1)
+
+    Pojo deserialized = objectMapper.readValue(bytes, Pojo.class);
+    System.out.println(deserialized);   // "2022-09-14T08:47:24.922Z"
 ```
 
 ### Deserialize extension types with ExtensionTypeCustomDeserializers
 
-`ExtensionTypeCustomDeserializers` helps you to deserialize extension types easily.
+`ExtensionTypeCustomDeserializers` helps you to deserialize your own custom extension types easily.
 
 #### Deserialize extension type value directly
 
@@ -269,8 +300,8 @@ When you want to use non-String value as a key of Map, use `MessagePackKeySerial
           return "Java";
       }
       return "Not Java";
-  }
-  );
+  });
+
   ObjectMapper objectMapper = new ObjectMapper(
           new MessagePackFactory().setExtTypeCustomDesers(extTypeCustomDesers));
 
@@ -458,4 +489,3 @@ There are a few options to fix this issue, but they introduce performance degred
   ObjectMapper objectMapper = new ObjectMapper(
     new MessagePackFactory().setReuseResourceInGenerator(false));
 ```
-


=====================================
msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/MessagePackMapper.java
=====================================
@@ -15,9 +15,12 @@
 //
 package org.msgpack.jackson.dataformat;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.cfg.MapperBuilder;
 
+import java.math.BigDecimal;
+
 public class MessagePackMapper extends ObjectMapper
 {
     private static final long serialVersionUID = 3L;
@@ -40,6 +43,12 @@ public class MessagePackMapper extends ObjectMapper
         super(f);
     }
 
+    public MessagePackMapper handleBigDecimalAsString()
+    {
+        configOverride(BigDecimal.class).setFormat(JsonFormat.Value.forShape(JsonFormat.Shape.STRING));
+        return this;
+    }
+
     public static Builder builder()
     {
         return new Builder(new MessagePackMapper());


=====================================
msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/TimestampExtensionModule.java
=====================================
@@ -0,0 +1,82 @@
+package org.msgpack.jackson.dataformat;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import org.msgpack.core.ExtensionTypeHeader;
+import org.msgpack.core.MessagePack;
+import org.msgpack.core.MessagePacker;
+import org.msgpack.core.MessageUnpacker;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.time.Instant;
+
+public class TimestampExtensionModule
+{
+    public static final byte EXT_TYPE = -1;
+    public static final SimpleModule INSTANCE = new SimpleModule("msgpack-ext-timestamp");
+
+    static {
+        INSTANCE.addSerializer(Instant.class, new InstantSerializer(Instant.class));
+        INSTANCE.addDeserializer(Instant.class, new InstantDeserializer(Instant.class));
+    }
+
+    private static class InstantSerializer extends StdSerializer<Instant>
+    {
+        protected InstantSerializer(Class<Instant> t)
+        {
+            super(t);
+        }
+
+        @Override
+        public void serialize(Instant value, JsonGenerator gen, SerializerProvider provider)
+            throws IOException
+        {
+            ByteArrayOutputStream os = new ByteArrayOutputStream();
+            // MEMO: Reusing these MessagePacker and MessageUnpacker instances would improve the performance
+            try (MessagePacker packer = MessagePack.newDefaultPacker(os)) {
+                packer.packTimestamp(value);
+            }
+            try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(os.toByteArray())) {
+                ExtensionTypeHeader header = unpacker.unpackExtensionTypeHeader();
+                byte[] bytes = unpacker.readPayload(header.getLength());
+
+                MessagePackExtensionType extensionType = new MessagePackExtensionType(EXT_TYPE, bytes);
+                gen.writeObject(extensionType);
+            }
+        }
+    }
+
+    private static class InstantDeserializer extends StdDeserializer<Instant>
+    {
+        protected InstantDeserializer(Class<?> vc)
+        {
+            super(vc);
+        }
+
+        @Override
+        public Instant deserialize(JsonParser p, DeserializationContext ctxt)
+            throws IOException
+        {
+            MessagePackExtensionType ext = p.readValueAs(MessagePackExtensionType.class);
+            if (ext.getType() != EXT_TYPE) {
+                throw new RuntimeException(
+                        String.format("Unexpected extension type (0x%X) for Instant object", ext.getType()));
+            }
+
+            // MEMO: Reusing this MessageUnpacker instance would improve the performance
+            try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(ext.getData())) {
+                return unpacker.unpackTimestamp(new ExtensionTypeHeader(EXT_TYPE, ext.getData().length));
+            }
+        }
+    }
+
+    private TimestampExtensionModule()
+    {
+    }
+}


=====================================
msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/MessagePackMapperTest.java
=====================================
@@ -0,0 +1,44 @@
+//
+// MessagePack for Java
+//
+//    Licensed under the Apache License, Version 2.0 (the "License");
+//    you may not use this file except in compliance with the License.
+//    You may obtain a copy of the License at
+//
+//        http://www.apache.org/licenses/LICENSE-2.0
+//
+//    Unless required by applicable law or agreed to in writing, software
+//    distributed under the License is distributed on an "AS IS" BASIS,
+//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//    See the License for the specific language governing permissions and
+//    limitations under the License.
+//
+package org.msgpack.jackson.dataformat;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+
+import static org.junit.Assert.assertEquals;
+
+public class MessagePackMapperTest
+{
+    static class Pojo
+    {
+        public BigDecimal value;
+    }
+
+    @Test
+    public void handleBigDecimalAsString() throws IOException
+    {
+        MessagePackMapper mapper = new MessagePackMapper().handleBigDecimalAsString();
+        Pojo obj = new Pojo();
+        obj.value = new BigDecimal("1234567890.98765432100");
+
+        byte[] converted = mapper.writeValueAsBytes(obj);
+
+        Pojo deserialized = mapper.readValue(converted, Pojo.class);
+        assertEquals(obj.value, deserialized.value);
+    }
+}


=====================================
msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/TimestampExtensionModuleTest.java
=====================================
@@ -0,0 +1,218 @@
+//
+// MessagePack for Java
+//
+//    Licensed under the Apache License, Version 2.0 (the "License");
+//    you may not use this file except in compliance with the License.
+//    You may obtain a copy of the License at
+//
+//        http://www.apache.org/licenses/LICENSE-2.0
+//
+//    Unless required by applicable law or agreed to in writing, software
+//    distributed under the License is distributed on an "AS IS" BASIS,
+//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//    See the License for the specific language governing permissions and
+//    limitations under the License.
+//
+package org.msgpack.jackson.dataformat;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
+import org.junit.Test;
+import org.msgpack.core.MessagePack;
+import org.msgpack.core.MessagePacker;
+import org.msgpack.core.MessageUnpacker;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.time.Instant;
+
+import static org.junit.Assert.assertEquals;
+
+public class TimestampExtensionModuleTest
+{
+    private final ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+    private final SingleInstant singleInstant = new SingleInstant();
+    private final TripleInstants tripleInstants = new TripleInstants();
+
+    private static class SingleInstant
+    {
+        public Instant instant;
+    }
+
+    private static class TripleInstants
+    {
+        public Instant a;
+        public Instant b;
+        public Instant c;
+    }
+
+    @Before
+    public void setUp()
+            throws Exception
+    {
+        objectMapper.registerModule(TimestampExtensionModule.INSTANCE);
+    }
+
+    @Test
+    public void testSingleInstantPojo()
+            throws IOException
+    {
+        singleInstant.instant = Instant.now();
+        byte[] bytes = objectMapper.writeValueAsBytes(singleInstant);
+        SingleInstant deserialized = objectMapper.readValue(bytes, SingleInstant.class);
+        assertEquals(singleInstant.instant, deserialized.instant);
+    }
+
+    @Test
+    public void testTripleInstantsPojo()
+            throws IOException
+    {
+        Instant now = Instant.now();
+        tripleInstants.a = now.minusSeconds(1);
+        tripleInstants.b = now;
+        tripleInstants.c = now.plusSeconds(1);
+        byte[] bytes = objectMapper.writeValueAsBytes(tripleInstants);
+        TripleInstants deserialized = objectMapper.readValue(bytes, TripleInstants.class);
+        assertEquals(now.minusSeconds(1), deserialized.a);
+        assertEquals(now, deserialized.b);
+        assertEquals(now.plusSeconds(1), deserialized.c);
+    }
+
+    @Test
+    public void serialize32BitFormat()
+            throws IOException
+    {
+        singleInstant.instant = Instant.ofEpochSecond(Instant.now().getEpochSecond());
+
+        byte[] bytes = objectMapper.writeValueAsBytes(singleInstant);
+
+        // Check the size of serialized data first
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            assertEquals("instant", unpacker.unpackString());
+            assertEquals(4, unpacker.unpackExtensionTypeHeader().getLength());
+        }
+
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            unpacker.unpackString();
+            assertEquals(singleInstant.instant, unpacker.unpackTimestamp());
+        }
+    }
+
+    @Test
+    public void serialize64BitFormat()
+            throws IOException
+    {
+        singleInstant.instant = Instant.ofEpochSecond(Instant.now().getEpochSecond(), 1234);
+
+        byte[] bytes = objectMapper.writeValueAsBytes(singleInstant);
+
+        // Check the size of serialized data first
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            assertEquals("instant", unpacker.unpackString());
+            assertEquals(8, unpacker.unpackExtensionTypeHeader().getLength());
+        }
+
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            unpacker.unpackString();
+            assertEquals(singleInstant.instant, unpacker.unpackTimestamp());
+        }
+    }
+
+    @Test
+    public void serialize96BitFormat()
+            throws IOException
+    {
+        singleInstant.instant = Instant.ofEpochSecond(19880866800L /* 2600-01-01 */, 1234);
+
+        byte[] bytes = objectMapper.writeValueAsBytes(singleInstant);
+
+        // Check the size of serialized data first
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            assertEquals("instant", unpacker.unpackString());
+            assertEquals(12, unpacker.unpackExtensionTypeHeader().getLength());
+        }
+
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            unpacker.unpackString();
+            assertEquals(singleInstant.instant, unpacker.unpackTimestamp());
+        }
+    }
+
+    @Test
+    public void deserialize32BitFormat()
+            throws IOException
+    {
+        Instant instant = Instant.ofEpochSecond(Instant.now().getEpochSecond());
+
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        try (MessagePacker packer = MessagePack.newDefaultPacker(os)) {
+            packer.packMapHeader(1)
+                    .packString("instant")
+                    .packTimestamp(instant);
+        }
+
+        byte[] bytes = os.toByteArray();
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            unpacker.unpackString();
+            assertEquals(4, unpacker.unpackExtensionTypeHeader().getLength());
+        }
+
+        SingleInstant deserialized = objectMapper.readValue(bytes, SingleInstant.class);
+        assertEquals(instant, deserialized.instant);
+    }
+
+    @Test
+    public void deserialize64BitFormat()
+            throws IOException
+    {
+        Instant instant = Instant.ofEpochSecond(Instant.now().getEpochSecond(), 1234);
+
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        try (MessagePacker packer = MessagePack.newDefaultPacker(os)) {
+            packer.packMapHeader(1)
+                    .packString("instant")
+                    .packTimestamp(instant);
+        }
+
+        byte[] bytes = os.toByteArray();
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            unpacker.unpackString();
+            assertEquals(8, unpacker.unpackExtensionTypeHeader().getLength());
+        }
+
+        SingleInstant deserialized = objectMapper.readValue(bytes, SingleInstant.class);
+        assertEquals(instant, deserialized.instant);
+    }
+
+    @Test
+    public void deserialize96BitFormat()
+            throws IOException
+    {
+        Instant instant = Instant.ofEpochSecond(19880866800L /* 2600-01-01 */, 1234);
+
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        try (MessagePacker packer = MessagePack.newDefaultPacker(os)) {
+            packer.packMapHeader(1)
+                    .packString("instant")
+                    .packTimestamp(instant);
+        }
+
+        byte[] bytes = os.toByteArray();
+        try (MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bytes)) {
+            unpacker.unpackMapHeader();
+            unpacker.unpackString();
+            assertEquals(12, unpacker.unpackExtensionTypeHeader().getLength());
+        }
+
+        SingleInstant deserialized = objectMapper.readValue(bytes, SingleInstant.class);
+        assertEquals(instant, deserialized.instant);
+    }
+}


=====================================
msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/benchmark/MessagePackDataformatHugeDataBenchmarkTest.java
=====================================
@@ -30,7 +30,7 @@ import java.util.List;
 
 public class MessagePackDataformatHugeDataBenchmarkTest
 {
-    private static final int ELM_NUM = 100000;
+    private static final int ELM_NUM = 1000000;
     private static final int COUNT = 6;
     private static final int WARMUP_COUNT = 4;
     private final ObjectMapper origObjectMapper = new ObjectMapper();


=====================================
project/build.properties
=====================================
@@ -1,2 +1,2 @@
-sbt.version=1.6.2
+sbt.version=1.9.1
 


=====================================
project/plugins.sbt
=====================================
@@ -1,11 +1,11 @@
-addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")
-addSbtPlugin("com.github.sbt" % "sbt-pgp"      % "2.1.2")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
+addSbtPlugin("com.github.sbt" % "sbt-pgp"      % "2.2.1")
 // TODO: Fixes jacoco error:
 // java.lang.NoClassDefFoundError: Could not initialize class org.jacoco.core.internal.flow.ClassProbesAdapter
 //addSbtPlugin("com.github.sbt"   % "sbt-jacoco"      % "3.3.0")
 addSbtPlugin("org.xerial.sbt"   % "sbt-jcheckstyle" % "0.2.1")
 addSbtPlugin("com.typesafe.sbt" % "sbt-osgi"        % "0.9.6")
-addSbtPlugin("org.scalameta"    % "sbt-scalafmt"    % "2.4.6")
-addSbtPlugin("com.dwijnand"     % "sbt-dynver"      % "4.1.1")
+addSbtPlugin("org.scalameta"    % "sbt-scalafmt"    % "2.5.0")
+addSbtPlugin("com.github.sbt"     % "sbt-dynver"      % "5.0.1")
 
 scalacOptions ++= Seq("-deprecation", "-feature")


=====================================
sbt
=====================================
@@ -34,11 +34,11 @@
 
 set -o pipefail
 
-declare -r sbt_release_version="1.5.5"
-declare -r sbt_unreleased_version="1.6.0-M1"
+declare -r sbt_release_version="1.8.2"
+declare -r sbt_unreleased_version="1.8.2"
 
-declare -r latest_213="2.13.7"
-declare -r latest_212="2.12.15"
+declare -r latest_213="2.13.10"
+declare -r latest_212="2.12.17"
 declare -r latest_211="2.11.12"
 declare -r latest_210="2.10.7"
 declare -r latest_29="2.9.3"



View it on GitLab: https://salsa.debian.org/java-team/msgpack-java/-/commit/d9e504fb74bf38c49b84d90a3e5e8bca380391ce

-- 
View it on GitLab: https://salsa.debian.org/java-team/msgpack-java/-/commit/d9e504fb74bf38c49b84d90a3e5e8bca380391ce
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20230724/86eacd9d/attachment.htm>


More information about the pkg-java-commits mailing list