1.3.0 permalink Arrow_down_16x16

*warn-on-reflection*

clojure.core

When set to true, the compiler will emit warnings when reflection is
needed to resolve Java method calls or field accesses.

Defaults to false.

1 Example top

  • ;; define two variables then set *warn-on-reflection* to true and try to call
    ;; one of their Java methods. Warnings are generated in both cases
    ;; set *warn-on-reflection* to false and note that you can call both functions
    ;; without a warning
    
    user=> (def i 23)
    #'user/i
    user=> (def s "123")
    #'user/s
    user=> (set! *warn-on-reflection* true)
    true
    user=> (.toString i)
    Reflection warning, NO_SOURCE_PATH:4 - reference to field toString can't be resolved.
    "23"
    user=> (.toString s)
    Reflection warning, NO_SOURCE_PATH:5 - reference to field toString can't be resolved.
    "123"
    user=> (set! *warn-on-reflection* false)
    false
    user=> (.toString i)
    "23"
    user=> (.toString s)
    "123"
    user=>
Log in to add / edit an example.

See Also top

Log in to add a see also.

Comments top

No comments for *warn-on-reflection*. Log in to add a comment.