例如,对于反射方法调用等反射警告,会打印出完整源路径(Compiler/SOURCE_PATH
)。对于有关 loop
recur 参数的警告,仅打印出源文件名(Compiler/SOURCE
)
(set! *warn-on-reflection* true)
(defn reflective-method-call [] (.substring (try "") 0))
(defn boxed-recur-arg [] (loop [i 0] (recur (try i))))
...它将打印
Reflection warning, /home/pawel/dev/project/src/core.clj:22:33 - call to method substring can't be resolved (target class is unknown).
core.clj:24 recur arg for primitive local: i is not matching primitive, had: Object, needed: long
Auto-boxing loop arg: i
在我看来,路径是有用的,特别是如果文件名是通用的并且位于依赖项中。