public class Hello {
public static void test(int i) {
System.out.println("int");
}
public static void test(long l) {
System.out.println("long");
}
}
user=> (def foo 1)
#'user/foo
user=> (type foo)
java.lang.Long
user=> (Hello/test 1)
long
nil
user=> (Hello/test foo)
int
nil
user=> (Integer. 1)
1
user=> (Integer. foo)
1
user=> (Short. 1)
IllegalArgumentException No matching ctor found for class java.lang.Short clojure.lang.Reflector.invokeConstructor (Reflector.java:183)
我无法弄清楚规则。