You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, in halo-dal, there are mulptiple versions of library antlr:antlr. However, according to Maven's dependency management strategy: "first declaration wins", only antlr:antlr:2.7.6 can be loaded, and antlr:antlr:2.7.7 will be shadowed.
Your project expects to reference the method <antlr.TokenStreamRewriteEngine$RewriteOperation: toString()Ljava/lang/String;> via org.antlr:antlr-runtime:jar:3.1.3, which is included in the shaded version antlr:antlr:2.7.7 (original dependency path). However, this method is missing in the actual loaded versionantlr:antlr:2.7.6. Surprisingly, it will not cause NoSuchMethodError at rumtime.
By further analyzing, I found that the caller(org.antlr:antlr-runtime:jar:3.1.3) would invoke the method java.lang.Object.toString() defined in antlr.TokenStreamRewriteEngine$RewriteOperation's superclass , due to dynamic binding mechanism (actual dependency path).
However, methods java.lang.Object.toString() and <antlr.TokenStreamRewriteEngine$RewriteOperation: toString()Ljava/lang/String;> have different implementations, which will lead to buggy behaviors-----
Code snippet of <antlr.TokenStreamRewriteEngine$RewriteOperation: toString()Ljava/lang/String;> in antlr:antlr:2.7.7 (shadowed but expected to invoke):
Hi, in halo-dal, there are mulptiple versions of library antlr:antlr. However, according to Maven's dependency management strategy: "first declaration wins", only antlr:antlr:2.7.6 can be loaded, and antlr:antlr:2.7.7 will be shadowed.
Your project expects to reference the method <antlr.TokenStreamRewriteEngine$RewriteOperation: toString()Ljava/lang/String;> via org.antlr:antlr-runtime:jar:3.1.3, which is included in the shaded version antlr:antlr:2.7.7 (original dependency path). However, this method is missing in the actual loaded versionantlr:antlr:2.7.6. Surprisingly, it will not cause NoSuchMethodError at rumtime.
By further analyzing, I found that the caller(org.antlr:antlr-runtime:jar:3.1.3) would invoke the method java.lang.Object.toString() defined in antlr.TokenStreamRewriteEngine$RewriteOperation's superclass , due to dynamic binding mechanism (actual dependency path).
However, methods java.lang.Object.toString() and <antlr.TokenStreamRewriteEngine$RewriteOperation: toString()Ljava/lang/String;> have different implementations, which will lead to buggy behaviors-----
Code snippet of <antlr.TokenStreamRewriteEngine$RewriteOperation: toString()Ljava/lang/String;> in antlr:antlr:2.7.7 (shadowed but expected to invoke):
Code snippet of <toString()Ljava/lang/String;> in antlr:antlr:2.7.6 (loaded version):
Actual dependency path:
Dependency tree--
[INFO] halo.dal:halodal:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] +- org.mybatis:mybatis:jar:3.0.5:test
[INFO] +- org.mybatis:mybatis-spring:jar:1.0.1:test
[INFO] | +- (org.mybatis:mybatis:jar:3.0.5:test - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.5.RELEASE:test - omitted for duplicate)
[INFO] | +- (org.springframework:spring-tx:jar:3.0.5.RELEASE:test - omitted for duplicate)
[INFO] | +- (org.springframework:spring-jdbc:jar:3.0.5.RELEASE:test - omitted for duplicate)
[INFO] | - (org.springframework:spring-context:jar:3.0.5.RELEASE:compile - scope updated from test; omitted for duplicate)
[INFO] +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] | - commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[INFO] | | - (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | - (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-jdbc:jar:3.0.5.RELEASE:compile
[INFO] | +- (org.springframework:spring-beans:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | - (org.springframework:spring-tx:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-test:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.0.5.RELEASE:test
[INFO] | +- (org.springframework:spring-beans:jar:3.0.5.RELEASE:test - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.5.RELEASE:test - omitted for duplicate)
[INFO] | +- (org.springframework:spring-jdbc:jar:3.0.5.RELEASE:test - omitted for duplicate)
[INFO] | - (org.springframework:spring-tx:jar:3.0.5.RELEASE:test - omitted for duplicate)
[INFO] +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] | | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- (org.springframework:spring-asm:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | | - (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] | | - (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | - org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.10:compile
[INFO] +- org.slf4j:slf4j-jcl:jar:1.5.10:compile
[INFO] | +- (org.slf4j:slf4j-api:jar:1.5.10:compile - omitted for duplicate)
[INFO] | - (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] +- commons-lang:commons-lang:jar:2.4:compile
[INFO] +- c3p0:c3p0:jar:0.9.1.2:test
[INFO] +- log4j:log4j:jar:1.2.16:compile
[INFO] +- cglib:cglib:jar:2.2:compile
[INFO] | - asm:asm:jar:3.1:compile
[INFO] +- javassist:javassist:jar:3.11.0.GA:compile
[INFO] +- org.antlr:antlr-runtime:jar:3.1.3:compile
[INFO] | - org.antlr:stringtemplate:jar:3.2:compile
[INFO] | - (antlr:antlr:jar:2.7.7:compile - omitted for conflict with 2.7.6)
[INFO] +- org.hibernate:hibernate-core:jar:3.6.8.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- (commons-collections:commons-collections:jar:3.1:compile - omitted for duplicate)
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | | - (org.slf4j:slf4j-api:jar:1.5.8:compile - omitted for conflict with 1.5.10)
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | +- javax.transaction:jta:jar:1.1:compile
[INFO] | - (org.slf4j:slf4j-api:jar:1.6.1:compile - omitted for conflict with 1.5.10)
[INFO] +- commons-io:commons-io:jar:1.4:test
[INFO] +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] +- commons-collections:commons-collections:jar:3.1:compile
[INFO] - mysql:mysql-connector-java:jar:5.1.12:test
Suggested solutions:
Solution1: Exclude the dependency antlr:antlr:2.7.6.
Solution2: Declare version antlr:antlr:2.7.7 as a direct dependency.
Thanks.
Best regards,
Coco
The text was updated successfully, but these errors were encountered: