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

Method getMethods

src/jvm/clojure/lang/Reflector.java:526–576  ·  view source on GitHub ↗
(Class c, int arity, String name, boolean getStatics)

Source from the content-addressed store, hash-verified

524}
525
526static public List<Method> getMethods(Class c, int arity, String name, boolean getStatics){
527 Method[] allmethods = c.getMethods();
528 ArrayList methods = new ArrayList();
529 ArrayList bridgeMethods = new ArrayList();
530 for(int i = 0; i < allmethods.length; i++)
531 {
532 Method method = allmethods[i];
533 if(name.equals(method.getName())
534 && Modifier.isStatic(method.getModifiers()) == getStatics
535 && method.getParameterTypes().length == arity)
536 {
537 try
538 {
539 if(method.isBridge()
540 && c.getMethod(method.getName(), method.getParameterTypes())
541 .equals(method))
542 bridgeMethods.add(method);
543 else
544 methods.add(method);
545 }
546 catch(NoSuchMethodException e)
547 {
548 }
549 }
550// && (!method.isBridge()
551// || (c == StringBuilder.class &&
552// c.getMethod(method.getName(), method.getParameterTypes())
553// .equals(method))))
554// {
555// methods.add(allmethods[i]);
556// }
557 }
558
559 if(methods.isEmpty())
560 methods.addAll(bridgeMethods);
561
562 if(!getStatics && c.isInterface())
563 {
564 allmethods = Object.class.getMethods();
565 for(int i = 0; i < allmethods.length; i++)
566 {
567 if(name.equals(allmethods[i].getName())
568 && Modifier.isStatic(allmethods[i].getModifiers()) == getStatics
569 && allmethods[i].getParameterTypes().length == arity)
570 {
571 methods.add(allmethods[i]);
572 }
573 }
574 }
575 return methods;
576}
577
578// Return type coercions match coercions in FnInvokers for compiled invokers
579private static Object coerceAdapterReturn(Object ret, Class targetType) {

Callers 14

parseMethod · 0.95
InstanceMethodExprMethod · 0.95
StaticMethodExprMethod · 0.95
InvokeExprMethod · 0.95
invokeStaticMethodMethod · 0.95
methodOverloadsMethod · 0.80
StaticFieldExprMethod · 0.80
maybeFIMethodMethod · 0.80
parseMethod · 0.80
gatherMethodsMethod · 0.80

Calls 8

getNameMethod · 0.95
isInterfaceMethod · 0.80
addMethod · 0.65
isEmptyMethod · 0.65
getNameMethod · 0.65
equalsMethod · 0.45
getMethodMethod · 0.45
addAllMethod · 0.45

Tested by

no test coverage detected