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

Bump com.fasterxml.jackson:jackson-base from 2.16.2 to 2.18.2 #173

Merged
merged 22 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
940a8bc
Update to newest jackson
vzorge Oct 15, 2024
bf6ec42
wip
thetric Dec 17, 2024
e20bbdf
build: conditionally set --release compiler flag
thetric Dec 23, 2024
64e5ba7
chore: fix wording java.time -> threeten
thetric Dec 23, 2024
ee4c259
test: fix compiler error
thetric Dec 23, 2024
a2525a9
fix: bring back fix for jackson-module-java8#308
thetric Dec 23, 2024
ac83909
test: ignore tests which are expected to fail in upstream
thetric Dec 23, 2024
56b8a71
build: update mvn wrapper
thetric Dec 23, 2024
2c2bd70
refactor: deserialize ZonedDateTime keys like upstream
thetric Dec 23, 2024
8b296aa
test: fix zone id
thetric Dec 23, 2024
f617a4e
chore: reword java.time -> threeten
thetric Dec 23, 2024
be75e55
ci: add java 21 lts to builds
thetric Dec 23, 2024
134b099
chore: revert file mode to 0644
thetric Dec 27, 2024
c8bf14d
fix: add back nanoseconds for instant ser
thetric Dec 27, 2024
118918e
refactor: use java.util.function instead of custom interfaces
thetric Dec 27, 2024
6b6a086
build: fix maven compiler plugin warnings
thetric Dec 27, 2024
60e38fb
build: revert change to parent module, fix compiler args
thetric Dec 27, 2024
6ecc588
refactor: deprecate old ThreeTenModule in favor of ThreeTenTimeModule…
thetric Jan 5, 2025
92584a4
test: revert back so smaller lambda
thetric Jan 5, 2025
38c4b3d
build: update maven and maven wrapper
thetric Jan 5, 2025
a86f408
refactor: update module exports to ThreeTenTimeModule
thetric Jan 5, 2025
d8727b2
test: disable test which is only relevant for a broken java.time impl…
thetric Jan 18, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 17]
java: [8, 11, 17, 21]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
# "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
# https://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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.1/maven-wrapper-3.3.1.jar
106 changes: 91 additions & 15 deletions pom.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- This module was also published with a richer model, Gradle metadata, -->
<!-- which should be used instead. Do not delete the following line which -->
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
<!-- that they should prefer consuming it instead. -->
<!-- do_not_remove: published-with-gradle-metadata -->
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
<version>2.16.2</version>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-modules-java8</artifactId>
<version>2.18.2</version>
thetric marked this conversation as resolved.
Show resolved Hide resolved
</parent>

<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>2.15.3-SNAPSHOT</version>
<packaging>bundle</packaging>

<name>Jackson-Datatype-ThreeTenBackport</name>
<description>Add-on module to support ThreeTen backport (Java 8 Date &amp; Time API for Java 6/7) data types.</description>
<description>Add-on module to support ThreeTen backport (Java 8 Date &amp; Time API for Java 6/7) data types.
</description>
<url>/~https://github.com/joschi/jackson-datatype-threetenbp</url>

<scm>
Expand Down Expand Up @@ -69,6 +72,8 @@
<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/datatype/threetenbp</packageVersion.dir>
<packageVersion.package>com.fasterxml.jackson.datatype.threetenbp</packageVersion.package>
<javac.src.version>1.8</javac.src.version>
<javac.target.version>1.8</javac.target.version>
thetric marked this conversation as resolved.
Show resolved Hide resolved
<!-- Configuration properties for the OSGi maven-bundle-plugin -->
<osgi.export>com.fasterxml.jackson.datatype.threetenbp.*;version=${project.version}</osgi.export>
<threetenbp.version>1.7.0</threetenbp.version>
Expand All @@ -81,6 +86,10 @@
</properties>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
Expand All @@ -95,6 +104,12 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand All @@ -108,6 +123,15 @@
<source>${javac.src.version}</source>
</properties>
</profile>
<profile>
<id>set-compiler-release</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<maven.compiler.release>8</maven.compiler.release>
</properties>
</profile>
<profile>
<id>release</id>
<build>
Expand All @@ -121,7 +145,7 @@
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<stagingProfileId combine.self="override" />
<stagingProfileId combine.self="override"/>
</configuration>
<executions>
<execution>
Expand All @@ -140,6 +164,38 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-java</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.8,)</version>
<message>[ERROR] The currently supported version of Java is 1.8 or higher</message>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.0,)</version>
<message>[ERROR] The currently supported version of Maven is 3.0 or higher</message>
</requireMavenVersion>
<requirePluginVersions>
<banLatest>true</banLatest>
<banRelease>true</banRelease>
<banSnapshots>true</banSnapshots>
<phases>clean,deploy,site</phases>
<message>[ERROR] Best Practice is to always define plugin versions!</message>
</requirePluginVersions>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Inherited from oss-base. Generate PackageVersion.java.-->
<groupId>com.google.code.maven-replacer-plugin</groupId>
Expand All @@ -151,6 +207,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<inherited>true</inherited>
<configuration>
<source>${javac.src.version}</source>
<target>${javac.target.version}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<optimize>true</optimize>
<compilerArguments>
<Xmaxerrs>10000</Xmaxerrs>
<Xmaxwarns>10000</Xmaxwarns>
<Xlint/>
</compilerArguments>
</configuration>
</plugin>
<!-- 28-Mar-2019, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
will have to use `moduleInfoFile` as anything else requires JDK 9+
-->
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down Expand Up @@ -205,11 +286,6 @@
<artifactId>sonar-maven-plugin</artifactId>
<version>5.0.0.4389</version>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>${version.plugin.moditect}</version>
</plugin>
</plugins>
</build>
<reporting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static BigDecimal toBigDecimal(long seconds, int nanoseconds)
}
return BigDecimal.valueOf(seconds).setScale(9);
}
return NumberInput.parseBigDecimal(toDecimal(seconds, nanoseconds));
return NumberInput.parseBigDecimal(toDecimal(seconds, nanoseconds), false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.fasterxml.jackson.datatype.threetenbp;

import org.threeten.bp.*;
import com.fasterxml.jackson.datatype.threetenbp.ser.ZonedDateTimeSerializer;

import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.DeserializationConfig;
Expand All @@ -25,7 +25,6 @@
import com.fasterxml.jackson.databind.deser.ValueInstantiators;
import com.fasterxml.jackson.databind.deser.std.StdValueInstantiator;
import com.fasterxml.jackson.databind.introspect.AnnotatedClass;
import com.fasterxml.jackson.databind.introspect.AnnotatedClassResolver;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
Expand All @@ -51,8 +50,21 @@
import com.fasterxml.jackson.datatype.threetenbp.ser.YearMonthSerializer;
import com.fasterxml.jackson.datatype.threetenbp.ser.YearSerializer;
import com.fasterxml.jackson.datatype.threetenbp.ser.ZoneIdSerializer;
import com.fasterxml.jackson.datatype.threetenbp.ser.ZonedDateTimeSerializer;
import com.fasterxml.jackson.datatype.threetenbp.ser.key.ZonedDateTimeKeySerializer;
import org.threeten.bp.Duration;
import org.threeten.bp.Instant;
import org.threeten.bp.LocalDate;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.LocalTime;
import org.threeten.bp.MonthDay;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.OffsetTime;
import org.threeten.bp.Period;
import org.threeten.bp.Year;
import org.threeten.bp.YearMonth;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZoneOffset;
import org.threeten.bp.ZonedDateTime;

/**
* Class that registers capability of serializing {@code org.threeten.bp} objects with the Jackson core.
Expand All @@ -61,12 +73,12 @@
* ObjectMapper mapper = new ObjectMapper();
* mapper.registerModule(new ThreeTenModule());
* </pre>
*<p>
* <p>
* Note that as of 2.x, if auto-registering modules, this package will register
* legacy version, {@link ThreeTenModule}, and NOT this module. 3.x will change the default.
* Legacy version has the same functionality, but slightly different default configuration:
* see {@link com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule} for details.
*<p>
* <p>
* Most {@code org.threeten.bp} types are serialized as numbers (integers or decimals as appropriate) if the
* {@link com.fasterxml.jackson.databind.SerializationFeature#WRITE_DATES_AS_TIMESTAMPS} feature is enabled
* (or, for {@link Duration}, {@link com.fasterxml.jackson.databind.SerializationFeature#WRITE_DURATIONS_AS_TIMESTAMPS}),
Expand Down Expand Up @@ -99,18 +111,13 @@
*
* @author Nick Williams
* @author Zoltan Kiss
*
* @since 2.6
*
* @see com.fasterxml.jackson.datatype.threetenbp.ser.key.ThreeTenNullKeySerializer
* @since 2.6
*/
@SuppressWarnings("javadoc")
public final class ThreeTenModule extends SimpleModule
{
public final class ThreeTenModule extends SimpleModule {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated in favor of ThreeTenTimeModule

private static final long serialVersionUID = 1L;

public ThreeTenModule()
{
public ThreeTenModule() {
super(PackageVersion.VERSION);

// First deserializers
Expand Down Expand Up @@ -152,10 +159,11 @@ public ThreeTenModule()
* But this is configurable.
*/
addSerializer(ZonedDateTime.class, ZonedDateTimeSerializer.INSTANCE);

// since 2.11: need to override Type Id handling
// (actual concrete type is `ZoneRegion`, but that's not visible)
addSerializer(ZoneId.class, new ZoneIdSerializer());

addSerializer(ZoneOffset.class, new ToStringSerializer(ZoneOffset.class));

// key serializers
Expand Down Expand Up @@ -184,15 +192,13 @@ public void setupModule(SetupContext context) {
context.addValueInstantiators(new ValueInstantiators.Base() {
@Override
public ValueInstantiator findValueInstantiator(DeserializationConfig config,
BeanDescription beanDesc, ValueInstantiator defaultInstantiator)
{
BeanDescription beanDesc, ValueInstantiator defaultInstantiator) {
JavaType type = beanDesc.getType();
Class<?> raw = type.getRawClass();

// 15-May-2015, tatu: In theory not safe, but in practice we do need to do "fuzzy" matching
// because we will (for now) be getting a subtype, but in future may want to downgrade
// to the common base type. Even more, serializer may purposefully force use of base type.
// So... in practice it really should always work, in the end. :)
// because we will (for now) be getting a subtype, but in future may want to downgrade
// to the common base type. Even more, serializer may purposefully force use of base type.
// So... in practice it really should always work, in the end. :)
if (ZoneId.class.isAssignableFrom(raw)) {
// let's assume we should be getting "empty" StdValueInstantiator here:
if (defaultInstantiator instanceof StdValueInstantiator) {
Expand All @@ -204,8 +210,7 @@ public ValueInstantiator findValueInstantiator(DeserializationConfig config,
} else {
// we don't need Annotations, so constructing directly is fine here
// even if it's not generally recommended
ac = AnnotatedClassResolver.resolve(config,
config.constructType(ZoneId.class), config);
ac = AnnotatedClass.construct(config.constructType(ZoneId.class), config);
}
if (!inst.canCreateFromString()) {
AnnotatedMethod factory = _findFactory(ac, "of", String.class);
Expand All @@ -214,20 +219,19 @@ public ValueInstantiator findValueInstantiator(DeserializationConfig config,
}
// otherwise... should we indicate an error?
}
// return ZoneIdInstantiator.construct(config, beanDesc, defaultInstantiator);
//return ZoneIdInstantiator.construct(config, beanDesc, defaultInstantiator);
}
}
return defaultInstantiator;
}
});
}

protected AnnotatedMethod _findFactory(AnnotatedClass cls, String name, Class<?>... argTypes)
{
protected AnnotatedMethod _findFactory(AnnotatedClass cls, String name, Class<?>... argTypes) {
final int argCount = argTypes.length;
for (AnnotatedMethod method : cls.getFactoryMethods()) {
if (!name.equals(method.getName())
|| (method.getParameterCount() != argCount)) {
|| (method.getParameterCount() != argCount)) {
continue;
}
for (int i = 0; i < argCount; ++i) {
Expand Down
Loading
Loading