You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/07/25 16:26:00 UTC
[jira] [Assigned] (GROOVY-9653) SC: ClassCastException on delegate
object property set
[ https://issues.apache.org/jira/browse/GROOVY-9653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-9653:
-----------------------------------
Assignee: Eric Milles
> SC: ClassCastException on delegate object property set
> ------------------------------------------------------
>
> Key: GROOVY-9653
> URL: https://issues.apache.org/jira/browse/GROOVY-9653
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 2.5.13
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> This started to fail in Groovy 2.5.13:
> {code:groovy}
> import com.fasterxml.jackson.annotation.JsonInclude
> @Grab('com.fasterxml.jackson.core:jackson-databind:2.9.9')
> import com.fasterxml.jackson.databind.ObjectMapper
> @Grab('org.springframework:spring-web:4.3.14.RELEASE')
> import org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean
> @groovy.transform.CompileStatic
> final class MyObjectMapper extends ObjectMapper
> {
> MyObjectMapper()
> {
> super(mimicSpring())
> }
> private static ObjectMapper mimicSpring()
> {
> new Jackson2ObjectMapperFactoryBean().with {
> serializationInclusion = JsonInclude.Include.NON_NULL // ClassCastException: org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean cannot be cast to com.fasterxml.jackson.databind.ObjectMapper
> defaultViewInclusion = true // include w/o view tag
> failOnUnknownProperties = false
> autoDetectGettersSetters = true
> autoDetectFields = false
> afterPropertiesSet()
> return object
> }
> }
> private static final long serialVersionUID = 2643043846851474223L
> }
> println new MyObjectMapper()
> {code}
> Works fine with default (dynamic) compilation.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)