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

Method setOuterProperty

src/main/java/groovy/lang/MetaClassImpl.java:3100–3116  ·  view source on GitHub ↗
(Class<?> sender, final Object object, final String name, final Object newValue, final MissingPropertyException mpe)

Source from the content-addressed store, hash-verified

3098 }
3099
3100 private void setOuterProperty(Class<?> sender, final Object object, final String name, final Object newValue, final MissingPropertyException mpe) {
3101 if (sender == null) sender = theClass; // GROOVY-11745
3102 if (sender == theClass ? isGroovyObject() : GroovyObject.class.isAssignableFrom(sender)) {
3103 var outerClass = getNonClosureOuter(sender); // check outer class nesting of call site
3104 if (outerClass != null && (sender == theClass || sender.isAssignableFrom(theClass))) {
3105 MetaClass omc = registry.getMetaClass(outerClass);
3106 Object target = getOuterReference(sender, object);
3107 try {
3108 omc.setProperty(outerClass, target, name, newValue, false, false);
3109 return;
3110 } catch (MissingPropertyException e) {
3111 mpe.addSuppressed(e);
3112 }
3113 }
3114 }
3115 throw mpe;
3116 }
3117
3118 private MetaProperty getMetaProperty(final Class<?> clazz, final String name, final boolean useSuper, final boolean useStatic) {
3119 CachedClass cachedClass = (clazz == null || clazz == theClass) ? theCachedClass : ReflectionCache.getCachedClass(clazz);

Callers 1

setPropertyMethod · 0.95

Calls 6

isGroovyObjectMethod · 0.95
getNonClosureOuterMethod · 0.95
getOuterReferenceMethod · 0.95
setPropertyMethod · 0.95
getMetaClassMethod · 0.65
isAssignableFromMethod · 0.45

Tested by

no test coverage detected