MCPcopy Index your code
hub / github.com/clojure/clojure / invoke

Method invoke

src/jvm/clojure/lang/ProxyHandler.java:27–71  ·  view source on GitHub ↗
(Object proxy, Method method, Object[] args)

Source from the content-addressed store, hash-verified

25}
26
27public Object invoke(Object proxy, Method method, Object[] args) throws Throwable{
28 Class rt = method.getReturnType();
29 IFn fn = (IFn) fns.valAt(method.getName());
30 if(fn == null)
31 {
32 if(rt == Void.TYPE)
33 return null;
34 else if(method.getName().equals("equals"))
35 {
36 return proxy == args[0];
37 }
38 else if(method.getName().equals("hashCode"))
39 {
40 return System.identityHashCode(proxy);
41 }
42 else if(method.getName().equals("toString"))
43 {
44 return "Proxy: " + System.identityHashCode(proxy);
45 }
46 throw new UnsupportedOperationException();
47 }
48 Object ret = fn.applyTo(ArraySeq.create(args));
49 if(rt == Void.TYPE)
50 return null;
51 else if(rt.isPrimitive())
52 {
53 if(rt == Character.TYPE)
54 return ret;
55 else if(rt == Integer.TYPE)
56 return ((Number) ret).intValue();
57 else if(rt == Long.TYPE)
58 return ((Number) ret).longValue();
59 else if(rt == Float.TYPE)
60 return ((Number) ret).floatValue();
61 else if(rt == Double.TYPE)
62 return ((Number) ret).doubleValue();
63 else if(rt == Boolean.TYPE && !(ret instanceof Boolean))
64 return ret == null ? Boolean.FALSE : Boolean.TRUE;
65 else if(rt == Byte.TYPE)
66 return (byte) ((Number) ret).intValue();
67 else if(rt == Short.TYPE)
68 return (short) ((Number) ret).intValue();
69 }
70 return ret;
71}
72}

Callers

nothing calls this directly

Calls 11

applyToMethod · 0.95
createMethod · 0.95
isPrimitiveMethod · 0.80
valAtMethod · 0.65
getNameMethod · 0.65
getReturnTypeMethod · 0.45
equalsMethod · 0.45
intValueMethod · 0.45
longValueMethod · 0.45
floatValueMethod · 0.45
doubleValueMethod · 0.45

Tested by

no test coverage detected