尝试使用 AOT 编译 Clojure 命名空间时clj -e "(compile 'my-ns.core)"
会引发异常LocalDate
:
Syntax error (IllegalArgumentException) compiling . at (my-project/my-ns-core.clj:5:1).
No matching method ofInstant found taking 2 args for class java.time.LocalDate
在 REPL 中运行良好。为什么在 AOT 中失败?类是导入的。
(ns my-ns.core
(:require [clojure.alpha.spec.gen :as g])
(:import (java.time LocalDate))
(LocalDate/ofInstant (Instant/ofEpochMilli 123) (ZoneId/of "UTC"))
我认为这一定与 AOT 构建中包含的这些类有关?