Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANTLR Version mismatch #29

Closed
MH15 opened this issue Jun 19, 2021 · 3 comments · Fixed by #54
Closed

ANTLR Version mismatch #29

MH15 opened this issue Jun 19, 2021 · 3 comments · Fixed by #54

Comments

@MH15
Copy link

MH15 commented Jun 19, 2021

Hello, I'm working on a project that uses ANTLR runtime v4.9.1, while Tomlj uses v4.7.2. This gives me the following error:

ANTLR Tool version 4.7.2 used for code generation does not match the current runtime version 4.9.1
ANTLR Runtime version 4.7.2 used for parser compilation does not match the current runtime version 4.9.1
ANTLR Tool version 4.7.2 used for code generation does not match the current runtime version 4.9.1
ANTLR Runtime version 4.7.2 used for parser compilation does not match the current runtime version 4.9.1

Note that the Tomlk code still runs, so perhaps the solution is to turn off this error somehow.

I have two options for a quick fix:

  1. I could downgrade the ANTLR version in my project to match.
  2. I could fork Tomlj and compile it locally with v4.9.1.

However, I'm wondering if there's a way to make this nicer for the future: perhaps the ANTLR dependency could be separated? I'm not quite sure how you've set your project up.

@liutikas
Copy link

A fairly standard practice for libraries is to jarjar ANTLR (move it to a different package) and include it that way (example androidx.room annotation processor) . While this comes at the cost of larger binary size, it means you are not forcing ANTLR version onto downstream users. Ideally, this library did the same.

@cleishm
Copy link
Contributor

cleishm commented Oct 5, 2022

@liutikas Seems not unreasonable. Perhaps we could even have a separate package for people who need to keep things slim. Feel free to propose a pull request to change that.

@cleishm
Copy link
Contributor

cleishm commented Oct 18, 2022

@liutikas Will #54 resolve this? I'm way out of touch with gradle and maven publication, but there is now a jar with a -all prefix, containing a shadowed version of ANTLR, published into the maven repository. Hopefully, this will work ok for your use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants