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

Method populateMethods

src/main/java/groovy/lang/MetaClassImpl.java:434–482  ·  view source on GitHub ↗
(final List<CachedClass> superClasses, final CachedClass firstGroovySuper)

Source from the content-addressed store, hash-verified

432 }
433
434 private void populateMethods(final List<CachedClass> superClasses, final CachedClass firstGroovySuper) {
435 var header = metaMethodIndex.getHeader(firstGroovySuper.getTheClass());
436 CachedClass c;
437 Iterator<CachedClass> iter = superClasses.iterator();
438 while (iter.hasNext()) {
439 c = iter.next();
440
441 for (var metaMethod : c.getMethods()) {
442 addToAllMethodsIfPublic(metaMethod);
443 if (c == firstGroovySuper || (metaMethod.isPublic() || metaMethod.isProtected() ||
444 (!metaMethod.isPrivate() && inSamePackage(metaMethod.getDeclaringClass().getTheClass(), theClass)))) { // GROOVY-11357
445 addMetaMethodToIndex(metaMethod, header);
446 }
447 }
448
449 for (var metaMethod : getNewMetaMethods(c)) {
450 if (newGroovyMethodsSet.add(metaMethod)) {
451 addMetaMethodToIndex(metaMethod, header);
452 }
453 }
454
455 if (c == firstGroovySuper)
456 break;
457 }
458
459 var last = header;
460 while (iter.hasNext()) {
461 c = iter.next();
462 header = metaMethodIndex.getHeader(c.getTheClass());
463
464 if (last != null) {
465 metaMethodIndex.copyNonPrivateMethods(last, header);
466 }
467 last = header;
468
469 for (var metaMethod : c.getMethods()) {
470 addToAllMethodsIfPublic(metaMethod);
471 addMetaMethodToIndex(metaMethod, header);
472 }
473
474 for (var metaMethod : getNewMetaMethods(c)) {
475 if (metaMethod.getName().equals(CONSTRUCTOR_NAME)
476 && !metaMethod.getDeclaringClass().equals(theCachedClass)) continue;
477 if (newGroovyMethodsSet.add(metaMethod)) {
478 addMetaMethodToIndex(metaMethod, header);
479 }
480 }
481 }
482 }
483
484 private MetaMethod[] getNewMetaMethods(final CachedClass c) {
485 if (c != theCachedClass) {

Callers 1

fillMethodIndexMethod · 0.95

Calls 15

getMethodsMethod · 0.95
addMetaMethodToIndexMethod · 0.95
getNewMetaMethodsMethod · 0.95
getTheClassMethod · 0.95
getHeaderMethod · 0.80
inSamePackageMethod · 0.80
copyNonPrivateMethodsMethod · 0.80
getTheClassMethod · 0.65
iteratorMethod · 0.65
isPublicMethod · 0.65
isProtectedMethod · 0.65

Tested by

no test coverage detected