ANTLR incompatibilities #274

Closed
opened 2025-12-30 01:23:06 +01:00 by adam · 0 comments
Owner

Originally created by @sgammon on GitHub (Feb 4, 2025).

Pkl's use of ANTLR is sometimes problematic, especially on the fork it uses, which is no longer maintained. Compiling under classpaths that embed a similar version of ANTLR (but not identical, especially from mainline) causes failures which are hard to diagnose; Pkl's ANTLR serialized data uses format v3, but latest versions use v4, causing an error that surfaces at runtime and not compile-time.

This is especially complicated because the mainline ANTLR version uses the same package as the forked ANTLR, so class loaders can easily get confused. Newer versions of GraalVM also shade ANTLR. It uses v4. Upgrading to mainline ANTLR isn't trivial: the APIs are different and it might imply a loss in parsing performance.

All of this will be fixed anyway by #917, so I am mostly filing this for documentation purposes.

Originally created by @sgammon on GitHub (Feb 4, 2025). Pkl's use of ANTLR is sometimes problematic, especially on the fork it uses, which is no longer maintained. Compiling under classpaths that embed a similar version of ANTLR (but not identical, especially from mainline) causes failures which are hard to diagnose; Pkl's ANTLR serialized data uses format `v3`, but latest versions use `v4`, causing an error that surfaces at runtime and not compile-time. This is especially complicated because the mainline ANTLR version uses the same package as the forked ANTLR, so class loaders can easily get confused. Newer versions of GraalVM also [shade ANTLR](https://central.sonatype.com/artifact/org.graalvm.shadowed/antlr4). It uses `v4`. Upgrading to mainline ANTLR isn't trivial: the APIs are different and it might imply a loss in parsing performance. All of this will be fixed anyway by #917, so I am mostly filing this for documentation purposes.
adam closed this issue 2025-12-30 01:23:06 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#274