Remove unnecessary cache - #628
Conversation
Because the conversion from Class to KClass is cached on the Kotlin side
| } | ||
| } | ||
|
|
||
| private val javaClassToKotlin = LRUMap<Class<Any>, KClass<Any>>(reflectionCacheSize, reflectionCacheSize) |
There was a problem hiding this comment.
The Class -> KClass conversion is cached on the Kotlin side as of 1.5.32, so there is no need to cache it in jackson-module-kotlin anymore.
https://github.com/JetBrains/kotlin/blob/v1.5.32/core/reflection.jvm/src/kotlin/reflect/jvm/internal/kClassCache.kt
| private val javaExecutableToValueCreator = LRUMap<Executable, ValueCreator<*>>(reflectionCacheSize, reflectionCacheSize) | ||
| private val javaConstructorIsCreatorAnnotated = LRUMap<AnnotatedConstructor, Boolean>(reflectionCacheSize, reflectionCacheSize) | ||
| private val javaMemberIsRequired = LRUMap<AnnotatedMember, BooleanTriState?>(reflectionCacheSize, reflectionCacheSize) | ||
| private val kotlinGeneratedMethod = LRUMap<AnnotatedMethod, Boolean>(reflectionCacheSize, reflectionCacheSize) |
There was a problem hiding this comment.
This cache was no longer being used.
cowtowncoder
left a comment
There was a problem hiding this comment.
I don't usually handle review here, but this makes sense to me so +1.
|
@cowtowncoder |
|
@k163377 I did not set it up, but Maven plugin "japicmp-maven-plugin" was recently set up to guard against API compatibility changes by maintainers (I think @dinomite remembers this) -- alas, release notes haven't been kept up to date so I don't see the PR/issue number. The idea being it flags anything that even theoretically breaks backwards-compatibility -- and removal of a protected field is theoretically such thing (since someone could have sub-classed class, referenced field). so you will probably need to add one or more excludes. I went and removed ones that were left over from 2.13 -> 2.14 cases. |
|
@k163377 I was able to reproduce the issue and add exclusion to basically disable compatibility check for To get this check to run locally you need to call since |
SSIA
Like #627, this change also mitigates #584.