Created
July 23, 2013 00:06
-
-
Save gfredericks/6058783 to your computer and use it in GitHub Desktop.
Reflection with Executor?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[java.util.concurrent Executors Executor]) | |
(set! *warn-on-reflection* true) | |
(def ^Executor tp (Executors/newFixedThreadPool 4)) | |
;; Reflection warning, NO_SOURCE_PATH:1:1 - call to submit can't be resolved. | |
(.submit ^Executor tp ^Callable (constantly 42)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that in this particular case this leads not just to reflection but to incorrectness at runtime, as a Fn satisfies both the Runnable and the Callable case and so the wrong method can easily be called.