You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Samael Bate (Jira)" <ji...@apache.org> on 2023/06/01 09:51:00 UTC
[jira] [Updated] (FLINK-32237) add jackson-module-kotlin to Jackson packages that get shaded
[ https://issues.apache.org/jira/browse/FLINK-32237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Samael Bate updated FLINK-32237:
--------------------------------
Description:
Because of the shaded Jackson packages having their package names prefixed, such as
{_}org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.json.JsonMapper{_}, when writing a Flink project in Kotlin I am unable to register the _KotlinModule_ or use {_}jacksonObjectMapper(){_}.
It would be great if these classes were repackaged using the same using the same _org.apache.flink.shaded.jackson2.*_ prefix:
{code:java}
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper {code}
Due to the mismatch in package names I can do neither of the following:
{code:java}
val jsonMapper = jacksonMapperBuilder()
.addModule(JavaTimeModule())
.build() {code}
or
{code:java}
val jsonMapper = JsonMapper()
.registerModule(KotlinModule()) {code}
the Kotlin module inherits from {{com.fasterxml.jackson.databind.Module}} and the re-packaged ones are inheriting from {{{}[org.apache.flink.shaded.jackson2.com|http://org.apache.flink.shaded.jackson2.com/]{}}}{{{}.fasterxml.jackson.databind.Module{}}}.
For now I can work around this with a wrapper class but it would be nice to have this available out of the box.
was:
Because of the shaded Jackson packages having their package names prefixed, such as
{_}org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.json.JsonMapper{_}, when writing a Flink project in Kotlin I am unable to register the _KotlinModule_ or use {_}jacksonObjectMapper(){_}.
It would be great if these classes were repackaged using the same using the same _org.apache.flink.shaded.jackson2.*_ prefix:
{code:java}
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper {code}
Due to the mismatch in package names I can do neither of the following:
{code:java}
val jsonMapper = jacksonMapperBuilder()
.addModule(JavaTimeModule())
.build() {code}
or
{code:java}
val jsonMapper = JsonMapper()
.registerModule(KotlinModule()) {code}
This has been the only issue I've found that prevents me from using Kotlin to develop my Flink projects
> add jackson-module-kotlin to Jackson packages that get shaded
> -------------------------------------------------------------
>
> Key: FLINK-32237
> URL: https://issues.apache.org/jira/browse/FLINK-32237
> Project: Flink
> Issue Type: Improvement
> Affects Versions: 1.17.1
> Reporter: Samael Bate
> Priority: Major
>
> Because of the shaded Jackson packages having their package names prefixed, such as
> {_}org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.json.JsonMapper{_}, when writing a Flink project in Kotlin I am unable to register the _KotlinModule_ or use {_}jacksonObjectMapper(){_}.
>
> It would be great if these classes were repackaged using the same using the same _org.apache.flink.shaded.jackson2.*_ prefix:
> {code:java}
> import com.fasterxml.jackson.module.kotlin.KotlinModule
> import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder
> import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper {code}
>
> Due to the mismatch in package names I can do neither of the following:
> {code:java}
> val jsonMapper = jacksonMapperBuilder()
> .addModule(JavaTimeModule())
> .build() {code}
> or
> {code:java}
> val jsonMapper = JsonMapper()
> .registerModule(KotlinModule()) {code}
> the Kotlin module inherits from {{com.fasterxml.jackson.databind.Module}} and the re-packaged ones are inheriting from {{{}[org.apache.flink.shaded.jackson2.com|http://org.apache.flink.shaded.jackson2.com/]{}}}{{{}.fasterxml.jackson.databind.Module{}}}.
>
> For now I can work around this with a wrapper class but it would be nice to have this available out of the box.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)