Skip to content

Commit c6bdd17

Browse files
authored
Merge pull request #349 from ProjectMapK/develop
Release 2025-05-25 02:17:56 +0000
2 parents c86ab36 + 068ba92 commit c6bdd17

File tree

171 files changed

+8235
-896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+8235
-896
lines changed

.editorconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ root = true
33

44
[*.{kt,kts}]
55
ktlint_code_style = intellij_idea
6-
ij_kotlin_allow_trailing_comma = false
7-
ij_kotlin_allow_trailing_comma_on_call_site = false

.github/workflows/test-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
# LTS versions, latest version (if exists)
4343
java-version: [ '17', '21', '24' ]
4444
# Minimum version, latest release version, latest pre-release version (if exists)
45-
kotlin: ['2.0.21', '2.1.20', '2.2.0-Beta2']
45+
kotlin: ['2.0.21', '2.1.20', '2.2.0-RC']
4646
env:
4747
KOTLIN_VERSION: ${{ matrix.kotlin }}
4848
name: "Kotlin ${{ matrix.kotlin }} - Java ${{ matrix.java-version }}"

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ val jacksonVersion = libs.versions.jackson.get()
1818
val generatedSrcPath = "${layout.buildDirectory.get()}/generated/kotlin"
1919

2020
group = groupStr
21-
version = "${jacksonVersion}-beta23"
21+
version = "${jacksonVersion}-beta24"
2222

2323
repositories {
2424
mavenCentral()

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver
99

1010
internal abstract class ClosedRangeMixin<T> @JsonCreator constructor(
1111
public val start: T,
12-
@get:JsonProperty("end") public val endInclusive: T
12+
@get:JsonProperty("end") public val endInclusive: T,
1313
) {
1414
@JsonIgnore
1515
public abstract fun getEnd(): T

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/Converters.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import com.fasterxml.jackson.databind.util.StdConverter
1414
*/
1515
internal class ValueClassBoxConverter<S : Any?, D : Any>(
1616
unboxedClass: Class<S>,
17-
val boxedClass: Class<D>
17+
val boxedClass: Class<D>,
1818
) : StdConverter<S, D>() {
1919
private val boxMethod = boxedClass.getDeclaredMethod("box-impl", unboxedClass).apply {
2020
ClassUtil.checkAndFixAccess(this, false)
@@ -35,7 +35,7 @@ internal class ValueClassUnboxConverter<T : Any>(val valueClass: Class<T>) : Std
3535

3636
override fun getInputType(typeFactory: TypeFactory): JavaType = typeFactory.constructType(valueClass)
3737
override fun getOutputType(
38-
typeFactory: TypeFactory
38+
typeFactory: TypeFactory,
3939
): JavaType = typeFactory.constructType(unboxMethod.genericReturnType)
4040

4141
val delegatingSerializer: StdDelegatingSerializer by lazy { StdDelegatingSerializer(this) }

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/Extensions.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public fun jacksonMapperBuilder(initializer: KotlinModule.Builder.() -> Unit = {
4949

5050
@JvmOverloads
5151
public fun ObjectMapper.registerKotlinModule(
52-
initializer: KotlinModule.Builder.() -> Unit = {}
52+
initializer: KotlinModule.Builder.() -> Unit = {},
5353
): ObjectMapper = this.registerModule(kotlinModule(initializer))
5454
// endregion
5555

@@ -67,7 +67,7 @@ internal inline fun <reified T> Any?.checkTypeMismatch(): T {
6767
// JsonMappingException was not used to unify the behavior.
6868
throw RuntimeJsonMappingException(
6969
"Deserialized value did not match the specified type; " +
70-
"specified ${T::class.qualifiedName}$nullability but was ${this?.let { it::class.qualifiedName }}"
70+
"specified ${T::class.qualifiedName}$nullability but was ${this?.let { it::class.qualifiedName }}",
7171
)
7272
}
7373
return this
@@ -157,7 +157,7 @@ public inline fun <reified T> ObjectMapper.readValue(src: ByteArray): T = readVa
157157
* due to an incorrect customization to [ObjectMapper].
158158
*/
159159
public inline fun <reified T> ObjectMapper.treeToValue(
160-
n: TreeNode
160+
n: TreeNode,
161161
): T = readValue(this.treeAsTokens(n), jacksonTypeRef<T>()).checkTypeMismatch()
162162

163163
/**
@@ -192,13 +192,13 @@ public inline fun <reified T> ObjectReader.readValuesTyped(jp: JsonParser): Iter
192192
}
193193
}
194194
public inline fun <reified T> ObjectReader.treeToValue(
195-
n: TreeNode
195+
n: TreeNode,
196196
): T? = readValue(this.treeAsTokens(n), jacksonTypeRef<T>())
197197

198198
public inline fun <reified T, reified U> ObjectMapper.addMixIn(): ObjectMapper = addMixIn(T::class.java, U::class.java)
199199
public inline fun <reified T, reified U> JsonMapper.Builder.addMixIn(): JsonMapper.Builder = addMixIn(
200200
T::class.java,
201-
U::class.java
201+
U::class.java,
202202
)
203203

204204
public operator fun ArrayNode.plus(element: Boolean) {
@@ -298,15 +298,15 @@ public operator fun JsonNode.contains(index: Int): Boolean = has(index)
298298

299299
public fun <T : Any> SimpleModule.addSerializer(
300300
kClass: KClass<T>,
301-
serializer: JsonSerializer<T>
301+
serializer: JsonSerializer<T>,
302302
): SimpleModule = this.apply {
303303
kClass.javaPrimitiveType?.let { addSerializer(it, serializer) }
304304
addSerializer(kClass.javaObjectType, serializer)
305305
}
306306

307307
public fun <T : Any> SimpleModule.addDeserializer(
308308
kClass: KClass<T>,
309-
deserializer: JsonDeserializer<T>
309+
deserializer: JsonDeserializer<T>,
310310
): SimpleModule = this.apply {
311311
kClass.javaPrimitiveType?.let { addDeserializer(it, deserializer) }
312312
addDeserializer(kClass.javaObjectType, deserializer)

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private val primitiveClassToDesc = mapOf(
3030
Long::class.java to 'J',
3131
Short::class.java to 'S',
3232
Boolean::class.java to 'Z',
33-
Void.TYPE to 'V'
33+
Void.TYPE to 'V',
3434
)
3535

3636
// -> this.name.replace(".", "/")
@@ -56,12 +56,12 @@ internal fun Array<Class<*>>.toDescBuilder(): StringBuilder = this
5656

5757
internal fun Constructor<*>.toSignature(): JvmMethodSignature = JvmMethodSignature(
5858
"<init>",
59-
parameterTypes.toDescBuilder().append('V').toString()
59+
parameterTypes.toDescBuilder().append('V').toString(),
6060
)
6161

6262
internal fun Method.toSignature(): JvmMethodSignature = JvmMethodSignature(
6363
this.name,
64-
parameterTypes.toDescBuilder().appendDescriptor(this.returnType).toString()
64+
parameterTypes.toDescBuilder().appendDescriptor(this.returnType).toString(),
6565
)
6666

6767
internal val defaultConstructorMarker: Class<*> by lazy {

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinClassIntrospector.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ internal object KotlinClassIntrospector : BasicClassIntrospector() {
4040
override fun forSerialization(
4141
config: SerializationConfig,
4242
type: JavaType,
43-
r: MixInResolver
43+
r: MixInResolver,
4444
): BasicBeanDescription {
4545
// minor optimization: for some JDK types do minimal introspection
4646
return _findStdTypeDesc(config, type)
@@ -61,7 +61,7 @@ internal object KotlinClassIntrospector : BasicClassIntrospector() {
6161
override fun forDeserialization(
6262
config: DeserializationConfig,
6363
type: JavaType,
64-
r: MixInResolver
64+
r: MixInResolver,
6565
): BasicBeanDescription {
6666
// minor optimization: for some JDK types do minimal introspection
6767
return _findStdTypeDesc(config, type)

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinFeature.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public enum class KotlinFeature(internal val enabledByDefault: Boolean) {
8484
* `@JsonFormat` annotations need to be declared either on getter using `@get:JsonFormat` or field using `@field:JsonFormat`.
8585
* See [jackson-module-kotlin#651] for details.
8686
*/
87-
UseJavaDurationConversion(enabledByDefault = false);
87+
UseJavaDurationConversion(enabledByDefault = false),
88+
;
8889

8990
internal val bitSet: BitSet = (1 shl ordinal).toBitSet()
9091

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinModule.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class KotlinModule private constructor(
4949
public val strictNullChecks: Boolean = StrictNullChecks.enabledByDefault,
5050
public val copySyntheticConstructorParameterAnnotations: Boolean =
5151
CopySyntheticConstructorParameterAnnotations.enabledByDefault,
52-
public val useJavaDurationConversion: Boolean = UseJavaDurationConversion.enabledByDefault
52+
public val useJavaDurationConversion: Boolean = UseJavaDurationConversion.enabledByDefault,
5353
) : SimpleModule(KotlinModule::class.java.name, kogeraVersion) { // kogeraVersion is generated by building.
5454
private constructor(builder: Builder) : this(
5555
builder.cacheSize,
@@ -59,12 +59,12 @@ public class KotlinModule private constructor(
5959
builder.isEnabled(SingletonSupport),
6060
builder.isEnabled(StrictNullChecks),
6161
builder.isEnabled(CopySyntheticConstructorParameterAnnotations),
62-
builder.isEnabled(UseJavaDurationConversion)
62+
builder.isEnabled(UseJavaDurationConversion),
6363
)
6464

6565
@Deprecated(
6666
message = "This is an API for compatibility; use Builder.",
67-
level = DeprecationLevel.HIDDEN
67+
level = DeprecationLevel.HIDDEN,
6868
)
6969
public constructor() : this(Builder())
7070

@@ -101,7 +101,7 @@ public class KotlinModule private constructor(
101101

102102
if (!context.isEnabled(MapperFeature.USE_ANNOTATIONS)) {
103103
throw IllegalStateException(
104-
"The Jackson Kotlin module requires USE_ANNOTATIONS to be true or it cannot function"
104+
"The Jackson Kotlin module requires USE_ANNOTATIONS to be true or it cannot function",
105105
)
106106
}
107107

@@ -123,7 +123,7 @@ public class KotlinModule private constructor(
123123
*/
124124
public data class CacheSize(
125125
val initialCacheSize: Int = Builder.DEFAULT_CACHE_SIZE,
126-
val maxCacheSize: Int = Builder.DEFAULT_CACHE_SIZE
126+
val maxCacheSize: Int = Builder.DEFAULT_CACHE_SIZE,
127127
) : Serializable {
128128
/**
129129
* Set the same size for [initialCacheSize] and [maxCacheSize].
@@ -133,12 +133,12 @@ public class KotlinModule private constructor(
133133
init {
134134
if (maxCacheSize < 16) {
135135
throw IllegalArgumentException(
136-
"The maxCacheSize must be at least 16. The recommended value is 100 or more."
136+
"The maxCacheSize must be at least 16. The recommended value is 100 or more.",
137137
)
138138
}
139139
if (maxCacheSize < initialCacheSize) {
140140
throw IllegalArgumentException(
141-
"maxCacheSize($maxCacheSize) was less than initialCacheSize($initialCacheSize)."
141+
"maxCacheSize($maxCacheSize) was less than initialCacheSize($initialCacheSize).",
142142
)
143143
}
144144
}

0 commit comments

Comments
 (0)