Skip to content

Commit e78a194

Browse files
authored
Merge pull request #242 from ProjectMapK/refactors
Refactors
2 parents 552b4ec + 609158a commit e78a194

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ internal class KotlinFallbackAnnotationIntrospector(
125125
private fun JmValueParameter.isNullishTypeAt(index: Int): Boolean = arguments.getOrNull(index)?.let {
126126
// If it is not a StarProjection, type is not null
127127
it === KmTypeProjection.STAR || it.type!!.isNullable
128-
} ?: true // If a type argument cannot be taken, treat it as nullable to avoid unexpected failure.
128+
} != false // If a type argument cannot be taken, treat it as nullable to avoid unexpected failure.
129129

130130
private fun JmValueParameter.requireStrictNullCheck(type: JavaType): Boolean =
131131
((type.isArrayType || type.isCollectionLikeType) && !this.isNullishTypeAt(0)) ||

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import io.github.projectmapk.jackson.module.kogera.jmClass.JmProperty
2020
import io.github.projectmapk.jackson.module.kogera.jmClass.JmValueParameter
2121
import io.github.projectmapk.jackson.module.kogera.reconstructClass
2222
import io.github.projectmapk.jackson.module.kogera.toSignature
23-
import kotlinx.metadata.KmClassifier
2423
import kotlinx.metadata.isNullable
2524
import java.lang.reflect.Constructor
2625
import java.lang.reflect.Executable
@@ -137,10 +136,7 @@ internal class KotlinPrimaryAnnotationIntrospector(
137136
}
138137

139138
private fun Constructor<*>.isPrimarilyConstructorOf(jmClass: JmClass): Boolean = jmClass.findJmConstructor(this)
140-
?.let { !it.isSecondary || jmClass.constructors.size == 1 }
141-
?: false
142-
143-
private fun KmClassifier.isString(): Boolean = this is KmClassifier.Class && this.name == "kotlin/String"
139+
?.let { !it.isSecondary || jmClass.constructors.size == 1 } == true
144140

145141
private fun isPossibleSingleString(
146142
kotlinParams: List<JmValueParameter>,

0 commit comments

Comments
 (0)