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

Method setUpProperties

src/main/java/groovy/lang/MetaClassImpl.java:2605–2635  ·  view source on GitHub ↗

Populates the map of MetaProperty objects, keyed by class and property name. @param propertyDescriptors the property descriptors

(final PropertyDescriptor[] propertyDescriptors)

Source from the content-addressed store, hash-verified

2603 * @param propertyDescriptors the property descriptors
2604 */
2605 private void setUpProperties(final PropertyDescriptor[] propertyDescriptors) {
2606 if (theCachedClass.isInterface) {
2607 addConsts(theCachedClass, subMap(classPropertyIndex, theCachedClass));
2608
2609 applyPropertyDescriptors(propertyDescriptors);
2610 CachedClass superClass = ReflectionCache.OBJECT_CLASS;
2611 applyStrayPropertyMethods(superClass, subMap(classPropertyIndex, superClass), true);
2612 } else {
2613 List<CachedClass> superClasses = getSuperClasses();
2614 List<CachedClass> superInterfaces = new ArrayList<>(theCachedClass.getInterfaces());
2615 // sort interfaces so that we may ensure a deterministic behaviour in case of
2616 // ambiguous fields -- class implementing two interfaces using the same field
2617 if (superInterfaces.size() > 1) {
2618 superInterfaces.sort(CACHED_CLASS_NAME_COMPARATOR); // GROOVY-5272
2619 }
2620
2621 if (theCachedClass.isArray) { // add the special read-only "length" property
2622 subMap(classPropertyIndex, theCachedClass).put("length", new MetaArrayLengthProperty());
2623 }
2624
2625 inheritStaticInterfaceFields(superClasses, superInterfaces);
2626 inheritFields(superClasses);
2627
2628 applyPropertyDescriptors(propertyDescriptors);
2629
2630 applyStrayPropertyMethods(superClasses, classPropertyIndex, true);
2631 applyStrayPropertyMethods(superInterfaces, classPropertyIndex, true);
2632 applyStrayPropertyMethods(superClasses, classPropertyIndexForSuper, false);
2633 }
2634 fillStaticPropertyIndex();
2635 }
2636
2637 private void fillStaticPropertyIndex() {
2638 BiConsumer<String, MetaProperty> indexStaticProperty = (name, prop) -> {

Callers 1

addPropertiesMethod · 0.95

Calls 12

addConstsMethod · 0.95
subMapMethod · 0.95
getSuperClassesMethod · 0.95
inheritFieldsMethod · 0.95
sizeMethod · 0.65
putMethod · 0.65
getInterfacesMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected