Invoking unexpected methods, due to dependency conflicts on com.fasterxml.jackson.core:jackson-databind:jar
An issue similar to #335.
Multiple versions of com.fasterxml.jackson.core:jackson-databind:jar in vertx-examples-3.6.0 (spring-examples/springboot-example module). Based on Maven's dependency management strategy, only com.fasterxml.jackson.core:jackson-databind:jar:2.4.6 can be loaded, and com.fasterxml.jackson.core:jackson-databind:jar: 2.9.7 will be shadowed.
Method <com.fasterxml.jackson.databind.util.StdDateFormat.setLenient(boolean)> is referenced by your project via the following invocation path, which is included in the shadowed version com.fasterxml.jackson.core:jackson-databind:jar: 2.9.7. But this method is missing in the actual loaded version com.fasterxml.jackson.core:jackson-databind:jar:2.4.6. Similarly, it would not lead to NoSuchMethodError at rumtime.
<io.vertx.core.logging.Logger: void debug(java.lang.Object,java.lang.Throwable,java.lang.Object[])> C:\Users\Flipped\.m2\repository\io\vertx\vertx-core\3.6.0\vertx-core-3.6.0.jar
<io.vertx.core.logging.Log4j2LogDelegate: void debug(java.lang.Object,java.lang.Throwable,java.lang.Object[])> C:\Users\Flipped\.m2\repository\io\vertx\vertx-core\3.6.0\vertx-core-3.6.0.jar
<org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator$PartiallyComparableAdvisorHolder: java.lang.String toString()> C:\Users\Flipped\.m2\repository\org\springframework\spring-aop\4.1.6.RELEASE\spring-aop-4.1.6.RELEASE.jar
<org.springframework.aop.config.SimpleBeanFactoryAwareAspectInstanceFactory: int getOrder()> C:\Users\Flipped\.m2\repository\org\springframework\spring-aop\4.1.6.RELEASE\spring-aop-4.1.6.RELEASE.jar
<org.springframework.beans.factory.support.AbstractBeanFactory: java.lang.Object getBean(java.lang.String)> C:\Users\Flipped\.m2\repository\org\springframework\spring-beans\4.1.6.RELEASE\spring-beans-4.1.6.RELEASE.jar
<org.springframework.beans.factory.support.AbstractBeanFactory: java.lang.Object doGetBean(java.lang.String,java.lang.Class,java.lang.Object[],boolean)> C:\Users\Flipped\.m2\repository\org\springframework\spring-beans\4.1.6.RELEASE\spring-beans-4.1.6.RELEASE.jar
<org.springframework.beans.TypeConverterSupport: java.lang.Object convertIfNecessary(java.lang.Object,java.lang.Class)> C:\Users\Flipped\.m2\repository\org\springframework\spring-beans\4.1.6.RELEASE\spring-beans-4.1.6.RELEASE.jar
<org.springframework.beans.TypeConverterSupport: java.lang.Object doConvert(java.lang.Object,java.lang.Class,org.springframework.core.MethodParameter,java.lang.reflect.Field)> C:\Users\Flipped\.m2\repository\org\springframework\spring-beans\4.1.6.RELEASE\spring-beans-4.1.6.RELEASE.jar
<org.springframework.beans.TypeConverterDelegate: java.lang.Object convertIfNecessary(java.lang.Object,java.lang.Class,java.lang.reflect.Field)> C:\Users\Flipped\.m2\repository\org\springframework\spring-beans\4.1.6.RELEASE\spring-beans-4.1.6.RELEASE.jar
<org.springframework.beans.TypeConverterDelegate: java.lang.Object convertIfNecessary(java.lang.String,java.lang.Object,java.lang.Object,java.lang.Class,org.springframework.core.convert.TypeDescriptor)> C:\Users\Flipped\.m2\repository\org\springframework\spring-beans\4.1.6.RELEASE\spring-beans-4.1.6.RELEASE.jar
<org.springframework.core.convert.support.GenericConversionService: java.lang.Object convert(java.lang.Object,org.springframework.core.convert.TypeDescriptor,org.springframework.core.convert.TypeDescriptor)> C:\Users\Flipped\.m2\repository\org\springframework\spring-core\4.1.6.RELEASE\spring-core-4.1.6.RELEASE.jar
<org.springframework.core.convert.support.ConversionUtils: java.lang.Object invokeConverter(org.springframework.core.convert.converter.GenericConverter,java.lang.Object,org.springframework.core.convert.TypeDescriptor,org.springframework.core.convert.TypeDescriptor)> C:\Users\Flipped\.m2\repository\org\springframework\spring-core\4.1.6.RELEASE\spring-core-4.1.6.RELEASE.jar
<org.springframework.format.support.FormattingConversionService$ParserConverter: java.lang.Object convert(java.lang.Object,org.springframework.core.convert.TypeDescriptor,org.springframework.core.convert.TypeDescriptor)> C:\Users\Flipped\.m2\repository\org\springframework\spring-context\4.1.6.RELEASE\spring-context-4.1.6.RELEASE.jar
<org.springframework.format.datetime.DateFormatter: java.lang.Object parse(java.lang.String,java.util.Locale)> C:\Users\Flipped\.m2\repository\org\springframework\spring-context\4.1.6.RELEASE\spring-context-4.1.6.RELEASE.jar
<org.springframework.format.datetime.DateFormatter: java.util.Date parse(java.lang.String,java.util.Locale)> C:\Users\Flipped\.m2\repository\org\springframework\spring-context\4.1.6.RELEASE\spring-context-4.1.6.RELEASE.jar
<org.springframework.format.datetime.DateFormatter: java.text.DateFormat getDateFormat(java.util.Locale)> C:\Users\Flipped\.m2\repository\org\springframework\spring-context\4.1.6.RELEASE\spring-context-4.1.6.RELEASE.jar
<com.fasterxml.jackson.databind.util.StdDateFormat: void setLenient(boolean)>
By static analyzing, I found that the caller io.vertx.core.logging.Logger.debug(Object, Throwable, Object[]) would invoke the method DateFormat.setLenient(boolean) defined in the superclass of com.fasterxml.jackson.databind.util.StdDateFormat (StdDateFormat extends DateFormat) with the same signature of the expected callee, due to dynamic binding mechanism.
Although the actual invoked method belonging to DateFormat has the same method name, same parameter types and return type as the expected method defined in its subclass StdDateFormat, but it has different control flows and different behaviors. Maybe it is buggy behavior.
Solution: Use the newer version com.fasterxml.jackson.core:jackson-databind:jar: 2.9.7 to keep the version consistency.
Dependency tree-----
[INFO] org.springframework.boot:springboot-example:jar:1.2.4.RELEASE [INFO] +- org.springframework.boot:spring-boot-starter:jar:1.2.4.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot:jar:1.2.4.RELEASE:compile [INFO] | | +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for duplicate) [INFO] | | - org.springframework:spring-context:jar:4.1.6.RELEASE:compile [INFO] | | +- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile [INFO] | | | +- aopalliance:aopalliance:jar:1.0:compile [INFO] | | | +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - omitted for duplicate) [INFO] | | | - (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for duplicate) [INFO] | | +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile [INFO] | | | - (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for duplicate) [INFO] | | +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for duplicate) [INFO] | | - org.springframework:spring-expression:jar:4.1.6.RELEASE:compile [INFO] | | - (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for duplicate) [INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.4.RELEASE:compile [INFO] | | +- (org.springframework.boot:spring-boot:jar:1.2.4.RELEASE:compile - omitted for duplicate) [INFO] | | - org.yaml:snakeyaml:jar:1.14:compile [INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:1.2.4.RELEASE:compile [INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile [INFO] | | | - org.slf4j:slf4j-api:jar:1.7.12:compile [INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.12:compile [INFO] | | | - (org.slf4j:slf4j-api:jar:1.7.12:compile - omitted for duplicate) [INFO] | | +- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile [INFO] | | | - (org.slf4j:slf4j-api:jar:1.7.12:compile - omitted for duplicate) [INFO] | | - ch.qos.logback:logback-classic:jar:1.1.3:compile [INFO] | | +- ch.qos.logback:logback-core:jar:1.1.3:compile [INFO] | | - (org.slf4j:slf4j-api:jar:1.7.12:compile - version managed from 1.7.7; omitted for duplicate) [INFO] | +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile [INFO] | - (org.yaml:snakeyaml:jar:1.14:compile - scope updated from runtime; omitted for duplicate) [INFO] +- io.vertx:vertx-core:jar:3.6.0:compile [INFO] | +- io.netty:netty-common:jar:4.1.30.Final:compile [INFO] | +- io.netty:netty-buffer:jar:4.1.30.Final:compile [INFO] | | - (io.netty:netty-common:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- io.netty:netty-transport:jar:4.1.30.Final:compile [INFO] | | +- (io.netty:netty-buffer:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | - (io.netty:netty-resolver:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- io.netty:netty-handler:jar:4.1.30.Final:compile [INFO] | | +- (io.netty:netty-buffer:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | +- (io.netty:netty-transport:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | - io.netty:netty-codec:jar:4.1.30.Final:compile [INFO] | | - (io.netty:netty-transport:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- io.netty:netty-handler-proxy:jar:4.1.30.Final:compile [INFO] | | +- (io.netty:netty-transport:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | +- io.netty:netty-codec-socks:jar:4.1.30.Final:compile [INFO] | | | - (io.netty:netty-codec:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | - (io.netty:netty-codec-http:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- io.netty:netty-codec-http:jar:4.1.30.Final:compile [INFO] | | - (io.netty:netty-codec:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- io.netty:netty-codec-http2:jar:4.1.30.Final:compile [INFO] | | +- (io.netty:netty-codec-http:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | - (io.netty:netty-handler:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- io.netty:netty-resolver:jar:4.1.30.Final:compile [INFO] | | - (io.netty:netty-common:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- io.netty:netty-resolver-dns:jar:4.1.30.Final:compile [INFO] | | +- (io.netty:netty-resolver:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | +- io.netty:netty-codec-dns:jar:4.1.30.Final:compile [INFO] | | | - (io.netty:netty-codec:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | | - (io.netty:netty-transport:jar:4.1.30.Final:compile - omitted for duplicate) [INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.4.6:compile (version managed from 2.9.7) [INFO] | - com.fasterxml.jackson.core:jackson-databind:jar:2.4.6:compile (version managed from 2.9.7) [INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.6:compile (version managed from 2.4.0) [INFO] | - (com.fasterxml.jackson.core:jackson-core:jar:2.4.6:compile - version managed from 2.9.7; omitted for duplicate) [INFO] - io.vertx:vertx-web:jar:3.6.0:compile [INFO] +- io.vertx:vertx-web-common:jar:3.6.0:compile [INFO] | - (io.vertx:vertx-core:jar:3.6.0:compile - omitted for duplicate) [INFO] +- io.vertx:vertx-auth-common:jar:3.6.0:compile [INFO] | - (io.vertx:vertx-core:jar:3.6.0:compile - omitted for duplicate) [INFO] +- io.vertx:vertx-bridge-common:jar:3.6.0:compile [INFO] - (io.vertx:vertx-core:jar:3.6.0:compile - omitted for duplicate)
Thanks! Best regards, Coco
The code snippet of StdDateFormat.setLenient(boolean) in verison 2.9.7 ----

com.fasterxml.jackson.core:jackson-databind:jar:2.4.6 does not contain StdDateFormat.setLenient(boolean).
The code snippet of DateFormat.setLenient(boolean) in version 2.4.6----

Method StdDateFormat.setLenient(boolean) included in newer verison 2.9.7 references new field _lenient (added since version 2.7) and adds more control branches, which changes the control flows and data flows. So referencing DateFormat.setLenient(boolean) in version 2.4.6 by dynamic binding, may lead to inconsisitent semantic behaviors.
Thanks again.
@vietj May I pull a request to fix this issue and #335 together? Thanks for your attention.
yes please
On 1 Mar 2019, at 17:39, HelloCoCooo [email protected] wrote:
May I pull a request to fix this issue and #335 https://github.com/vert-x3/vertx-examples/issues/335 together? Thanks for your attention.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vert-x3/vertx-examples/issues/336#issuecomment-468728013, or mute the thread https://github.com/notifications/unsubscribe-auth/AANxisBJmABTmUxLM_cSyDwb9O65Kd5kks5vSVfKgaJpZM4bZXnX.