Skip to content

Commit

Permalink
Merge pull request #90 from ProjectMapK/develop
Browse files Browse the repository at this point in the history
For release 2.14.2-alpha4
  • Loading branch information
k163377 authored Mar 18, 2023
2 parents e72266d + a999089 commit 9b9e886
Show file tree
Hide file tree
Showing 30 changed files with 393 additions and 144 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
name: lint-and-test
name: lint-and-test-dev
on:
push:
branches:
- main
- develop
paths:
- "gradle/**"
- "src/**"
- build.gradle.kts
- "**.kts"
- gradle.properties
- gradlew
- gradlew.bat
- settings.gradle.kts
- .github/workflows/lint-and-test.yml
- "**.kt"
- "**.java"
- .github/workflows/lint-and-test-dev.yml
pull_request:
branches:
- develop
types:
- opened
- synchronize
- reopened
paths:
- "gradle/**"
- "src/**"
- build.gradle.kts
- "**.kts"
- gradle.properties
- gradlew
- gradlew.bat
- settings.gradle.kts
- .github/workflows/lint-and-test.yml
- "**.kt"
- "**.java"
- .github/workflows/lint-and-test-dev.yml
jobs:
lint-and-test:
name: lint-and-test
lint-and-test-dev:
name: lint-and-test-dev
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up java
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Lint
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/lint-and-test-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: lint-and-test-main
on:
push:
branches:
- main
paths:
- "gradle/**"
- "**.kts"
- gradle.properties
- gradlew
- gradlew.bat
- "**.kt"
- "**.java"
- .github/workflows/lint-and-test-main.yml
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
paths:
- "gradle/**"
- "**.kts"
- gradle.properties
- gradlew
- gradlew.bat
- "**.kt"
- "**.java"
- .github/workflows/lint-and-test-main.yml
jobs:
lint-and-test-main:
strategy:
fail-fast: false
matrix:
java-version: [ '8', '11', '17', '19' ]
kotlin-version: [ '1.7.21', '1.8.10', '1.8.20-Beta' ]
env:
KOTLIN_VERSION: ${{ matrix.kotlin-version }}
name: lint-and-test-main
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: 'Set up java ${{ matrix.java-version }}'
uses: actions/setup-java@v2
with:
java-version: '${{ matrix.java-version }}'
distribution: 'adopt'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Lint
run: ./gradlew lintKotlin
- name: Test
run: ./gradlew test
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ This project makes several disruptive changes to achieve more `Kotlin-like` beha
Details are summarized in [KogeraSpecificImplementations](./docs/KogeraSpecificImplementations.md).

# Compatibility
- `Java 8+`
- `jackson 2.14.2`
- `Kotlin 1.7.21+`(This version will be smaller than `1.6.x.`)
- `Java 8+`
- `Kotlin 1.7.21+`

## About compatibility checks
Compatibility checks for `Java` and `Kotlin` are done by `CI` grid tests.

The `Java` test covers all currently supported LTS versions and the latest versions.
Currently 8,11,17 and 19 are covered.

`Kotlin` is tested on the latest patch version and the latest `Beta` or `RC` version within each minor version since 1.7.21.
Currently 1.7.21, 1.8.10 and 1.8.20-Beta are covered.
I hope to lower this version in the future, but currently the minimum `Kotlin` version that can be supported is 1.7 due to `kotlinx-metadata-jvm` constraints.

# Installation
The package is temporarily published in `JitPack`.
Expand Down Expand Up @@ -74,7 +84,9 @@ After the following features are implemented, this project will be moved to the

- ~~Deserialization support for `value class`~~
- Support for policy decisions and basic use cases was completed in #68, only edge cases and hard-to-fix issues remain
- Support for less than `Kotlin 1.6.x`(including grid test building with `CI`)
- ~~Support for less than `Kotlin 1.6.x`(including grid test building with `CI`)~~
- Due to limitations of `kotlinx-metadata-jvm`, only 1.7 or later is supported.
- However, it will be pulled down when possible.
- Rename module and package(see https://github.com/FasterXML/jackson-module-kotlin/issues/450#issuecomment-1384788717).

# About license
Expand Down
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
plugins {
`maven-publish` // for JitPack
kotlin("jvm") version "1.7.21"

val kotlinVersion: String = System.getenv("KOTLIN_VERSION")?.takeIf { it.isNotEmpty() } ?: "1.7.21"
kotlin("jvm") version kotlinVersion

java
id("org.jmailen.kotlinter") version "3.13.0"
}
Expand Down Expand Up @@ -47,6 +50,10 @@ kotlinter {
}

tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}

test {
useJUnitPlatform()
}
Expand Down
26 changes: 4 additions & 22 deletions docs/FixedIssues.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,21 @@ A list of issues that have not been resolved in `jackson-module-kotlin`, but hav

## Fixed
- [Update `KotlinModule` to override `AnnotationIntrospector.findCreatorAnnotation()` instead of `hasCreatorAnnotation()` · Issue \#200](https://github.com/FasterXML/jackson-module-kotlin/issues/200)
- [Depending on kotlinx\.reflect\.lite instead of kotlin\.reflect · Issue \#213](https://github.com/FasterXML/jackson-module-kotlin/issues/213)
- [Jackson skips isXXX properties with Int type · Issue \#337](https://github.com/FasterXML/jackson-module-kotlin/issues/337)
- [Regression on data binding in 2\.11\.0 with specific field naming · Issue \#340](https://github.com/FasterXML/jackson-module-kotlin/issues/340)
- [Getting MismatchedInputException instead of MissingKotlinParameterException · Issue \#234](https://github.com/FasterXML/jackson-module-kotlin/issues/234)
- [Private getter with different return type hides property · Issue \#341](https://github.com/FasterXML/jackson-module-kotlin/issues/341)
- [Field names containing hyphens are truncated when serialized · Issue \#434](https://github.com/FasterXML/jackson-module-kotlin/issues/434)
- [Remove \`kotlin\-reflect\` and replace it with \`kotlinx\-metadata\-jvm\` · Issue \#450](https://github.com/FasterXML/jackson-module-kotlin/issues/450)
- [Field names are being lowercased automatically when the first word of the camel\-case is too short · Issue \#475](https://github.com/FasterXML/jackson-module-kotlin/issues/475)
- [Failed deserialization of fields where only the first character is lowercase · Issue \#503](https://github.com/FasterXML/jackson-module-kotlin/issues/503)
- [Remove deprecated method in KNAI · Issue \#508](https://github.com/FasterXML/jackson-module-kotlin/issues/508)
- [ObjectMapper serialization for boolean fields named isFieldName changed between versions 2\.10\.5 and 2\.12\.4 · Issue \#552](https://github.com/FasterXML/jackson-module-kotlin/issues/552)
- [Are there any special requirements to working with kotlin\.time\.Duration? · Issue \#544](https://github.com/FasterXML/jackson-module-kotlin/issues/544)
- [Serialization of is\-getter with continuous capital letters · Issue \#545](https://github.com/FasterXML/jackson-module-kotlin/issues/545)
- [Minor bugs in \`SimpleModule\.addSerializer\`/\`addDeserializer\` · Issue \#558](https://github.com/FasterXML/jackson-module-kotlin/issues/558)
- [Regression: is\-getter detection error · Issue \#559](https://github.com/FasterXML/jackson-module-kotlin/issues/559)
- [Field from a Kotlin data class gets ignored if it's prefixed with "is" but not a boolean\. · Issue \#561](https://github.com/FasterXML/jackson-module-kotlin/issues/561)
- [How to properly configure an ObjectMapper to handle kotlin\-specific integer types? · Issue \#573](https://github.com/FasterXML/jackson-module-kotlin/issues/573)
- [objectMapper\.writeValueAsString does not properly serialize Kotlin data class variables that begin with "is" · Issue \#575](https://github.com/FasterXML/jackson-module-kotlin/issues/575)
- [Lazy load UNIT\_TYPE · Issue \#580](https://github.com/FasterXML/jackson-module-kotlin/issues/580)
- [Can I deserialize a data class with an unsigned member in the constructor? · Issue \#591](https://github.com/FasterXML/jackson-module-kotlin/issues/591)
- [Serialization of flatRate and isFlatRate are mixed up\. · Issue \#600](https://github.com/FasterXML/jackson-module-kotlin/issues/600)
- [Type Introspection: non\-nullable field with default is reported as required · Issue \#609](https://github.com/FasterXML/jackson-module-kotlin/issues/609)
- [Parsing of UShort uses incorrect ranges · Issue \#611](https://github.com/FasterXML/jackson-module-kotlin/issues/611)
- [`JsonSerializer` is enabled when the value is an Object type with non\-null value and the property definition is nullable. · Issue \#618](https://github.com/FasterXML/jackson-module-kotlin/issues/618)
- [About the problem that property names in \`Jackson\` and definitions in \`Kotlin\` are sometimes different\. · Issue \#630](https://github.com/FasterXML/jackson-module-kotlin/issues/630)
- [Annotation given to constructor parameters containing \`value class\` as argument does not work · Issue \#651](https://github.com/FasterXML/jackson-module-kotlin/issues/651)

## Maybe fixed(verification required)
- [@JsonProperty is ignored on data class properties with names starting with "is" · Issue \#237](https://github.com/FasterXML/jackson-module-kotlin/issues/237)

## Want to fix
- [Support for inline classes · Issue \#199](https://github.com/FasterXML/jackson-module-kotlin/issues/199)
- [Getting MismatchedInputException instead of MissingKotlinParameterException · Issue \#234](https://github.com/FasterXML/jackson-module-kotlin/issues/234)
- [\`@JsonProperty\` annotation is not working for fields with type of value class\. · Issue \#540](https://github.com/FasterXML/jackson-module-kotlin/issues/540)
- [There are some problems with KNAI\.hasCreatorAnnotation · Issue \#547](https://github.com/FasterXML/jackson-module-kotlin/issues/547)
- [MissingKotlinParameterException should have a reference to KCallable · Issue \#548](https://github.com/FasterXML/jackson-module-kotlin/issues/548)
- [This module shouldn't bring kotlin\-reflect 1\.5 as a transitive dependency · Issue \#566](https://github.com/FasterXML/jackson-module-kotlin/issues/566)
- [MissingKotlinParameterException contains non\-serializable KParameterImpl, breaking Throwable contract · Issue \#572](https://github.com/FasterXML/jackson-module-kotlin/issues/572)
- [ReflectionCache takes a lot of memory · Issue \#584](https://github.com/FasterXML/jackson-module-kotlin/issues/584)
- [Supports deserialization of \`value class\` \(\`inline class\`\)\. · Issue \#650](https://github.com/FasterXML/jackson-module-kotlin/issues/650)
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
16 changes: 0 additions & 16 deletions src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public class KotlinModule private constructor(
builder.isEnabled(StrictNullChecks)
)

@Deprecated(
message = "This is an API for compatibility; use Builder.",
level = DeprecationLevel.HIDDEN
)
public constructor() : this(Builder())

public companion object {
private const val serialVersionUID = 1L
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ import com.fasterxml.jackson.module.kotlin.deser.value_instantiator.creator.Meth
import com.fasterxml.jackson.module.kotlin.deser.value_instantiator.creator.ValueCreator
import com.fasterxml.jackson.module.kotlin.ser.ValueClassBoxConverter
import kotlinx.metadata.KmClass
import java.io.Serializable
import java.lang.reflect.Constructor
import java.lang.reflect.Executable
import java.lang.reflect.Method
import java.util.Optional

internal class ReflectionCache(reflectionCacheSize: Int) {
internal class ReflectionCache(reflectionCacheSize: Int) : Serializable {
companion object {
// Increment is required when properties that use LRUMap are changed.
private const val serialVersionUID = 1L
}

// This cache is used for both serialization and deserialization, so reserve a larger size from the start.
private val classCache = LRUMap<Class<*>, Optional<KmClass>>(reflectionCacheSize, reflectionCacheSize)
private val creatorCache: LRUMap<Executable, ValueCreator<*>>
Expand Down
Loading

0 comments on commit 9b9e886

Please sign in to comment.