Skip to content

Commit

Permalink
Merge pull request #177 from ProjectMapK/develop
Browse files Browse the repository at this point in the history
For release 2.16.0-beta7
  • Loading branch information
k163377 authored Nov 19, 2023
2 parents d87f1fc + 703d998 commit 05ff33a
Show file tree
Hide file tree
Showing 151 changed files with 386 additions and 364 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://editorconfig.org
root = true

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
5 changes: 5 additions & 0 deletions .github/workflows/lint-and-test-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
name: lint-and-test-dev
runs-on: ubuntu-latest
timeout-minutes: 15
permissions: # for gradle-dependency-submission
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -51,3 +53,6 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: test
# TODO: Prepare a separate WF to be executed only when there is a change in build.gradle.
- name: Run snapshot action
uses: mikepenz/[email protected]
9 changes: 6 additions & 3 deletions .github/workflows/test-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ jobs:
java-version: [ '8', '11', '17', '20' ]
# Minimum version, latest release version, latest pre-release version (if exists)
kotlin:
- name: '1.7.21'
version: '1.7.21'
k2: false
- name: '1.8.22'
version: '1.8.22'
k2: false
Expand All @@ -50,6 +47,12 @@ jobs:
- name: '1.9.20 K2'
version: '1.9.20'
k2: true
- name: '2.0.0-Beta1'
version: '2.0.0-Beta1'
k2: false
- name: '2.0.0-Beta1 K2'
version: '2.0.0-Beta1'
k2: true
env:
KOTLIN_VERSION: ${{ matrix.kotlin.version }}
USE_K2: ${{ matrix.kotlin.k2 }}
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,18 @@ This project makes several disruptive changes to achieve more `Kotlin-like` beha
Details are summarized in [KogeraSpecificImplementations](./docs/KogeraSpecificImplementations.md).

# Compatibility
- `jackson 2.15.0`
- `jackson 2.16.x`
- `Java 8+`
- `Kotlin 1.7.21+`
- `Kotlin 1.8.22+`

## 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 20 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 and 1.9.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.
`Kotlin` is tested with the latest patch version and the latest `Beta` or `RC` version within each minor version after the minimum version.
The `Kotlin` version is the lowest version available with the latest `kotlinx-metadata-jvm`.

# Installation
The package is temporarily published in `JitPack`.
Expand Down
29 changes: 15 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
plugins {
`maven-publish` // for JitPack

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

java
id("org.jmailen.kotlinter") version "3.13.0"
id("org.jmailen.kotlinter") version "3.16.0"
}

// Since group cannot be obtained by generateKogeraVersion, it is defined as a constant.
val groupStr = "io.github.projectmapk"
val jacksonVersion = "2.15.3"
val jacksonVersion = "2.16.0"
val generatedSrcPath = "${layout.buildDirectory.get()}/generated/kotlin"

group = groupStr
version = "${jacksonVersion}-beta6"
version = "${jacksonVersion}-beta7"

repositories {
mavenCentral()
}

dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.2")
implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.7.0")

api("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}")
api("com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}")

// test libs
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation("io.mockk:mockk:1.13.7")

Expand Down Expand Up @@ -60,15 +61,15 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinter {
// see https://github.com/pinterest/ktlint/blob/master/docs/rules/standard.md
this.disabledRules = arrayOf(
"package-name", // This project allows for the inclusion of _ to represent the package name in the snake case.
"filename" // For clarity in future extensions, this rule is disabled.
)
}

tasks {
// For ported tests, they are excluded from the formatting because they are not new code.
lintKotlinTest {
exclude { it.path.contains("zPorted") }
}
formatKotlinTest {
exclude { it.path.contains("zPorted") }
}

// Task to generate version file
val generateKogeraVersion by registering(Copy::class) {
val packageStr = "$groupStr.jackson.module.kogera"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.projectmapk.jackson.module.kogera.deser.value_instantiator;
package io.github.projectmapk.jackson.module.kogera.deser.valueInstantiator;

import kotlin.jvm.functions.Function0;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
package io.github.projectmapk.jackson.module.kogera

import com.fasterxml.jackson.databind.AbstractTypeResolver
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.DeserializationConfig
import com.fasterxml.jackson.databind.JavaType
import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver

internal abstract class ClosedRangeMixin<T> @JsonCreator constructor(
public val start: T,
@get:JsonProperty("end") public val endInclusive: T
) {
@JsonIgnore
public abstract fun getEnd(): T

@JsonIgnore
public abstract fun getFirst(): T

@JsonIgnore
public abstract fun getLast(): T

@JsonIgnore
public abstract fun getIncrement(): T

@JsonIgnore
public abstract fun isEmpty(): Boolean

@JsonIgnore
public abstract fun getStep(): T

@JsonIgnore
public abstract fun getEndExclusive(): T
}

/*
* ClosedRange, which is not a concrete type like IntRange, does not have a type to deserialize to,
Expand All @@ -12,7 +41,9 @@ import com.fasterxml.jackson.databind.JavaType
* The target of processing is ClosedRange and interfaces or abstract classes that inherit from it.
* As of Kotlin 1.5.32, ClosedRange and ClosedFloatingPointRange are processed.
*/
internal object ClosedRangeResolver : AbstractTypeResolver() {
internal object ClosedRangeResolver : SimpleAbstractTypeResolver() {
private fun readResolve(): Any = ClosedRangeResolver

// At present, it depends on the private class, but if it is made public, it must be switched to a direct reference.
// see https://youtrack.jetbrains.com/issue/KT-55376
val closedDoubleRangeRef: Class<*> by lazy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.fasterxml.jackson.databind.util.StdConverter
* A converter that only performs box processing for the value class.
* Note that constructor-impl is not called.
* @param S is nullable because value corresponds to a nullable value class.
* see [io.github.projectmapk.jackson.module.kogera.annotation_introspector.KotlinFallbackAnnotationIntrospector.findNullSerializer]
* see [io.github.projectmapk.jackson.module.kogera.annotationIntrospector.KotlinFallbackAnnotationIntrospector.findNullSerializer]
*/
internal class ValueClassBoxConverter<S : Any?, D : Any>(
unboxedClass: Class<S>,
Expand Down

This file was deleted.

Loading

0 comments on commit 05ff33a

Please sign in to comment.