graphql-java-tools icon indicating copy to clipboard operation
graphql-java-tools copied to clipboard

graphql-java-tools 13.1.0 incompatible with hibernate 6.1 because of dependency conflict with antlr

Open kurtseebauer opened this issue 3 years ago • 5 comments

Description

graphql-java-tools:13.1.0 pulls in antlr4-runtime:4.9.3 and hibernate-core:6.1.7.Final pulls antlr4-runtime:4.10.1. At runtime I get exceptions like:

Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).
	at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:187)
	at org.hibernate.grammars.ordering.OrderingLexer.<clinit>(OrderingLexer.java:383)
	... 19 more
Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).

I'm unable to work around this problem by forcing specific dependency versions (the serialized ATNs seem to require specific versions).

Expected behavior

graphql-java-tools should work together with current hibernate versions.

Actual behavior

graphql-java-tools is incompatible with current hibernate versions.

Related issues:

  • https://github.com/antlr/antlr4/issues/3895 (unresolved)

kurtseebauer avatar Nov 08 '23 14:11 kurtseebauer

OK what's the difference between antlr4 and antlr and why do they clash?

oryan-block avatar Nov 08 '23 21:11 oryan-block

the difference between antlr 4.9 and 4.10 is that they store the ATN serialized in different formats, version 3 and 4. the respective runtimes, coming with the runtime dependency, are incompatible (great job changing the format in a minor release).

The preferred solution would be that graphql-java-kickstart updates the antlr dependency to 4.10, recreates the serialized parsers and ships a new version.

This will however break projects that have a dependency on the earlier antlr version. A possible way out could be to shade the antlr runtime with something like maven-shade-plugin. not sure it's worth the effort. Hibernate decided to not do it: https://github.com/hibernate/hibernate-orm/discussions/4975 (for version 6.0.1).

https://github.com/espertechinc/esper/issues/278 has the same issue as graphql-java-kickstart btw.

kurtseebauer avatar Nov 09 '23 08:11 kurtseebauer

OK I thought this was a different artifact ID. I'll just update it to 4.11.1 to align with graphql-java

oryan-block avatar Nov 09 '23 16:11 oryan-block

Hey @oryan-block, thx for the fix. would you mind releasing a new version?

kurtseebauer avatar Nov 15 '23 11:11 kurtseebauer

Yep done.

oryan-block avatar Nov 15 '23 16:11 oryan-block