antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.26k stars 3.29k forks source link

Is the latest version of antlr4 compatible with jdk8 jar? #4203

Open melin opened 1 year ago

melin commented 1 year ago

Many big data components depend on antlr4. For example: spark, antlr4 cannot be upgraded to the latest version for compatibility with jdk8.

grammars-v4 some grammars in 4.10 later, unable to upgrade the JDK version, lead to cannot use: for example: https://github.com/antlr/grammars-v4/commits/master/sql/tsql/

Is the latest version of antlr4 compatible with jdk8 jar?

ericvergnaud commented 1 year ago

Antlr runtime is compatible with jdk8. Antlr tool requires jdk11. Can you provide a concrete example of this Spark incompatibility (stack trace) ?

melin commented 1 year ago

jdk switch to 11, ready to compile. Thanks! jdk8 is used a lot, which is not very convenient,For example, spark antlr4 can only be upgraded to 4.9.3 https://github.com/apache/spark/pull/37814

LuciferYang commented 1 year ago

Antlr runtime is compatible with jdk8. Antlr tool requires jdk11. Can you provide a concrete example of this Spark incompatibility (stack trace) ?

Do you mean we can using Java 11 and Antlr tool to generate java file from .g4 file, and then using Java 8+Antlr runtime to use java file at runtime?

melin commented 1 year ago

Antlr runtime is compatible with jdk8. Antlr tool requires jdk11. Can you provide a concrete example of this Spark incompatibility (stack trace) ?

Do you mean we can using Java 11 and Antlr tool to generate java file from .g4 file, and then using Java 8+Antlr runtime to use java file at runtime?

Yes

ericvergnaud commented 1 year ago

The stack trace below is not a Jdk issue.Rather there is a mismatch between the antlr version used to generate the parser and the runtime Envoyé de mon iPhoneLe 23 mars 2023 à 11:19, melin @.***> a écrit :

Antlr runtime is compatible with jdk8. Antlr tool requires jdk11. Can you provide a concrete example of this Spark incompatibility (stack trace) ?

Do you mean we can using Java 11 and Antlr tool to generate java file from .g4 file, and then using Java 8+Antlr runtime to use java file at runtime?

Yes

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

melin commented 1 year ago

Why does Antlr tool need at least jdk11? This requires that mvn requires jdk11 to run

ericvergnaud commented 1 year ago

Just set MVN_HOME ?Envoyé de mon iPhoneLe 25 mars 2023 à 15:58, melin @.***> a écrit : Why does Antlr tool need at least jdk11? This requires that mvn requires jdk11 to run

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

ericvergnaud commented 1 year ago

I meant JAVA_HOMEEnvoyé de mon iPhoneLe 25 mars 2023 à 21:23, Wanadoo @.> a écrit :Just set MVN_HOME ?Envoyé de mon iPhoneLe 25 mars 2023 à 15:58, melin @.> a écrit : Why does Antlr tool need at least jdk11? This requires that mvn requires jdk11 to run

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

liang0-0 commented 7 hours ago

I don't understand how much convenience jdk11 provides, and why antlr tool has such a strong temptation to upgrade to version jdk-11. However, this is a public project, not a personal one. Moreover, the code for this change is a little more concise, and it does not bring much traversal. If there is a chance, it is better to suggest that the project team return to jdk8. Thank you! Currently, I want to implement a web version to generate the corresponding svg flowchart from the g4 file online, which requires the use of the tool package. However, my project is based on jdk8 and cannot be upgraded to jdk-11. I can only use antlr4.9.3 first, but the files generated by 4.13.1 before have to be deleted and regenerated, and then retested. I think you upgraded to jdk11 so hastily (just for traversal)

ericvergnaud commented 1 hour ago

@liang0-0 thanks for your comments. Not sure though that the temptation to migrate to jdk-11 was strong since it happened several years after idk-11 was released. For background, see https://www.geeksforgeeks.org/java-8-vs-java-11/. Lots and lots of useful stuff, missing from java 8.

ericvergnaud commented 1 hour ago

Note that the runtime still runs on JRE8, only the tool requires jdk11.