From f4e9d30d1c792f80ed0441bd3c815a76558ce9a8 Mon Sep 17 00:00:00 2001 From: burinc Date: Sun, 20 Sep 2026 00:01:48 +1000 Subject: [PATCH] Declare the javax.xml.stream shims under :jolt/provides jolt.xml registers XMLInputFactory, XMLStreamConstants and org.xml.sax.InputSource, but deps.edn declared none of them. Jolt resolves the class references in a dependency namespace against the provides table before that namespace compiles, which is earlier than any require can run, so a library loaded from ~/.m2 that imports javax.xml.stream fails with No dependency provides javax.xml.stream.XMLStreamConstants however early install! runs. cognitect aws-api's cognitect.aws.util.xml is one such namespace: it imports XMLInputFactory, XMLStreamConstants and XMLStreamReader directly, so aws-api cannot load on jolt without this. Verified by removing the local workaround from a project that had one (jlt-commons/aws-api-jolt, which carried its own table plus a require-for-effect namespace) and running its suite against this branch: 24 tests, 43 assertions, green, with no table of its own. jolt.xml's own tests stay green at 7/7. XMLStreamReader is deliberately not declared. The reader is a tagged table reached through __register-class-methods!, not a registered class, so claiming it would claim something that does not exist. Note for anyone carrying the workaround: jolt refuses a duplicate claim ("two dependencies both claim to provide the host class ..."), so a consumer that declared these classes itself must drop its table when it picks this up. --- deps.edn | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/deps.edn b/deps.edn index b58cc00..82cf253 100644 --- a/deps.edn +++ b/deps.edn @@ -1,5 +1,22 @@ {:paths ["src"] + ;; The JDK classes jolt.xml installs (RFC 0014). Jolt resolves the class + ;; references in a DEPENDENCY namespace against this table BEFORE that + ;; namespace compiles, which is earlier than any require of ours can run. A + ;; library compiled from ~/.m2 that imports javax.xml.stream -- cognitect + ;; aws-api's cognitect.aws.util.xml does -- therefore fails with "No + ;; dependency provides javax.xml.stream.XMLStreamConstants" unless the table + ;; is declared here, however early install! runs. + ;; + ;; Fully-qualified only; jolt derives the simple spelling. These are exactly + ;; the classes install! registers. javax.xml.stream.XMLStreamReader is + ;; deliberately absent: the reader is a tagged table reached through + ;; __register-class-methods!, not a registered class, so claiming it would + ;; claim something that does not exist. + :jolt/provides {jolt.xml ["javax.xml.stream.XMLInputFactory" + "javax.xml.stream.XMLStreamConstants" + "org.xml.sax.InputSource"]} + ;; libxml2 backs the javax.xml.stream pull parser. Declared :jolt/native so jolt ;; loads it before this namespace, where the foreign-fn bindings resolve at load. ;; Present on macOS (dyld shared cache) and ubiquitous on Linux.