Class/forName honesty + class/isa? conformance for builtins (#243)

Class/forName claimed every java.*/clojure.* name found (and any "x.y.Class"
matched the registered Class via a short-name fallback), so a library's
(class-found? "optional.Dep") feature-probe always said yes — tools.logging then
tried to build the java.util.logging / log4j backends jolt lacks and crashed.
Resolve forName by exact registry lookup + an honest prefix that excludes the
unbacked optional packages (java.util.logging, javax.management), so the probe
sees them absent and skips the backend.

class of a persistent collection / namespace now reports its JVM class name
(clojure.lang.PersistentHashSet, …Namespace, …) instead of jolt's internal :set/
:object tag, and isa? consults JVM class assignability — Object as every class's
root plus a modeled clojure.lang/java.util hierarchy — so (isa? (class x) C) and a
class-keyed multimethod dispatch like the JVM (e.g. (isa? Keyword Object) was
false). Adds the bare class tokens (Fn/Namespace/Set/…) these dispatch on.

(type x) is unchanged — it keeps jolt's documented internal-keyword form. Six
JVM-certified corpus rows. make test green, 0 new divergences.

Co-authored-by: Yogthos <yogthos@gmail.com>
This commit is contained in:
Dmitri Sotnikov 2026-06-26 21:02:44 +00:00 committed by GitHub
parent 283a0f0eec
commit 6c03dffd00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 80 additions and 5 deletions

View file

@ -263,7 +263,7 @@
(guard (e (#t #f))
(def-var-with-meta! "clojure.core" "global-hierarchy" (jolt-invoke (var-deref "clojure.core" "atom") (jolt-invoke (var-deref "clojure.core" "make-hierarchy"))) (let* ((_o$4454 (keyword #f "private")) (_o$4455 #t)) (jolt-hash-map _o$4454 _o$4455))))
(guard (e (#t #f))
(def-var! "clojure.core" "isa?" (letrec ((isa? (case-lambda ((child parent) (let fnrec4456 ((child child) (parent parent)) (isa? (jolt-invoke (var-deref "clojure.core" "deref") (var-deref "clojure.core" "global-hierarchy")) child parent))) ((h child parent) (let fnrec4457 ((h h) (child child) (parent parent)) (let* ((or__26__auto (jolt= child parent))) (if (jolt-truthy? or__26__auto) or__26__auto (let* ((or__26__auto (jolt-contains? (let* ((_a$4458 (jolt-get h (keyword #f "ancestors"))) (_a$4459 child) (_a$4460 (jolt-hash-set))) (jolt-get _a$4458 _a$4459 _a$4460)) parent))) (if (jolt-truthy? or__26__auto) or__26__auto (let* ((and__25__auto (jolt-invoke (var-deref "clojure.core" "vector?") parent))) (if (jolt-truthy? and__25__auto) (let* ((and__25__auto (jolt-invoke (var-deref "clojure.core" "vector?") child))) (if (jolt-truthy? and__25__auto) (let* ((and__25__auto (let* ((_a$4461 (jolt-count parent)) (_a$4462 (jolt-count child))) (jolt= _a$4461 _a$4462)))) (if (jolt-truthy? and__25__auto) (let* ((ret #t) (i 0)) (let loop4463 ((ret ret) (i i)) (if (let* ((or__26__auto (jolt-not ret))) (if (jolt-truthy? or__26__auto) or__26__auto (jolt= i (jolt-count parent)))) ret (let* ((_a$4467 (let* ((_a$4464 h) (_a$4465 (jolt-nth child i)) (_a$4466 (jolt-nth parent i))) (isa? _a$4464 _a$4465 _a$4466))) (_a$4468 (jolt-inc i))) (loop4463 _a$4467 _a$4468))))) and__25__auto)) and__25__auto)) and__25__auto))))))))))) isa?)))
(def-var! "clojure.core" "isa?" (letrec ((isa? (case-lambda ((child parent) (let fnrec4456 ((child child) (parent parent)) (isa? (jolt-invoke (var-deref "clojure.core" "deref") (var-deref "clojure.core" "global-hierarchy")) child parent))) ((h child parent) (let fnrec4457 ((h h) (child child) (parent parent)) (let* ((or__26__auto (jolt= child parent))) (if (jolt-truthy? or__26__auto) or__26__auto (let* ((or__26__auto (jolt-invoke (var-deref "jolt.host" "class-isa?") child parent))) (if (jolt-truthy? or__26__auto) or__26__auto (let* ((or__26__auto (jolt-contains? (let* ((_a$4458 (jolt-get h (keyword #f "ancestors"))) (_a$4459 child) (_a$4460 (jolt-hash-set))) (jolt-get _a$4458 _a$4459 _a$4460)) parent))) (if (jolt-truthy? or__26__auto) or__26__auto (let* ((and__25__auto (jolt-invoke (var-deref "clojure.core" "vector?") parent))) (if (jolt-truthy? and__25__auto) (let* ((and__25__auto (jolt-invoke (var-deref "clojure.core" "vector?") child))) (if (jolt-truthy? and__25__auto) (let* ((and__25__auto (let* ((_a$4461 (jolt-count parent)) (_a$4462 (jolt-count child))) (jolt= _a$4461 _a$4462)))) (if (jolt-truthy? and__25__auto) (let* ((ret #t) (i 0)) (let loop4463 ((ret ret) (i i)) (if (let* ((or__26__auto (jolt-not ret))) (if (jolt-truthy? or__26__auto) or__26__auto (jolt= i (jolt-count parent)))) ret (let* ((_a$4467 (let* ((_a$4464 h) (_a$4465 (jolt-nth child i)) (_a$4466 (jolt-nth parent i))) (isa? _a$4464 _a$4465 _a$4466))) (_a$4468 (jolt-inc i))) (loop4463 _a$4467 _a$4468))))) and__25__auto)) and__25__auto)) and__25__auto))))))))))))) isa?)))
(guard (e (#t #f))
(def-var! "clojure.core" "parents" (letrec ((parents (case-lambda ((tag) (let fnrec4469 ((tag tag)) (parents (jolt-invoke (var-deref "clojure.core" "deref") (var-deref "clojure.core" "global-hierarchy")) tag))) ((h tag) (let fnrec4470 ((h h) (tag tag)) (jolt-invoke (var-deref "clojure.core" "not-empty") (jolt-get (jolt-get h (keyword #f "parents")) tag))))))) parents)))
(guard (e (#t #f))