MCPcopy Index your code
hub / github.com/apache/groovy / fillMethodIndex

Method fillMethodIndex

src/main/java/groovy/lang/MetaClassImpl.java:404–432  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402 }
403
404 private void fillMethodIndex() {
405 mainClassMethodHeader = metaMethodIndex.getHeader(theClass);
406
407 Set<CachedClass> interfaces = theCachedClass.getInterfaces();
408 List<CachedClass> superClasses = getSuperClasses(); // in reverse order
409 CachedClass firstGroovySuper = calcFirstGroovySuperClass(superClasses);
410
411 for (CachedClass c : interfaces) {
412 for (CachedMethod m : c.getMethods()) {
413 if (c == theCachedClass || (m.isPublic() && !m.isStatic())) { // GROOVY-8164
414 addMetaMethodToIndex(m, mainClassMethodHeader);
415 }
416 if (c != theCachedClass && isValidAccessorName(m.getName())) { // GROOVY-11803
417 metaMethodIndex.addMetaMethod(m, metaMethodIndex.indexMap.computeIfAbsent(c.getTheClass(), k -> new HashMap<>()));
418 }
419 }
420 }
421
422 populateMethods(superClasses, firstGroovySuper);
423
424 inheritInterfaceNewMetaMethods(interfaces);
425
426 if (isGroovyObject()) {
427 metaMethodIndex.copyMethodsToSuper(); // methods --> methodsForSuper
428 connectMultimethods(superClasses, firstGroovySuper);
429 removeMultimethodsOverloadedWithPrivateMethods();
430 replaceWithMOPCalls(theCachedClass.mopMethods);
431 }
432 }
433
434 private void populateMethods(final List<CachedClass> superClasses, final CachedClass firstGroovySuper) {
435 var header = metaMethodIndex.getHeader(firstGroovySuper.getTheClass());

Callers 1

reinitializeMethod · 0.95

Calls 15

getSuperClassesMethod · 0.95
addMetaMethodToIndexMethod · 0.95
populateMethodsMethod · 0.95
isGroovyObjectMethod · 0.95
connectMultimethodsMethod · 0.95
replaceWithMOPCallsMethod · 0.95
getHeaderMethod · 0.80
isValidAccessorNameMethod · 0.80
copyMethodsToSuperMethod · 0.80

Tested by

no test coverage detected