Retain an instance injected as a field of an object
@param owner The owner of the field
@param field The field
191424
void retain(Object owner, Field field) {
        retain();
        Map<String, Integer> fields = owners.get(owner);
        if (fields == null) {
            fields = new HashMap<>();
            owners.put(owner, fields);
        }

        Integer count = fields.get(field.toGenericString());
        if (count == null) {
            fields.put(field.toGenericString(), 1);
        } else {
            count++;
            fields.put(field.toGenericString(), count);
        }
    }
1069482
private void loadInstanceField(XField instanceField, Instruction obj) {
        if (RLE_DEBUG) {
            System.out.println("[loadInstanceField for field " + instanceField + " in instruction " + handle);
        }

        ValueNumberFrame frame = getFrame();

        try {
            ValueNumber reference = frame.popValue();

            AvailableLoad availableLoad = new AvailableLoad(reference, instanceField);
            if (RLE_DEBUG) {
                System.out.println("[getfield of " + availableLoad + "]");
            }
            ValueNumber[] loadedValue = frame.getAvailableLoad(availableLoad);

            if (loadedValue == null) {
                // Get (or create) the cached result for this instruction
                ValueNumber[] inputValueList = new ValueNumber[] { reference };
                loadedValue = getOutputValues(inputValueList, getNumWordsProduced(obj));

                // Make the load available
                frame.addAvailableLoad(availableLoad, loadedValue);
                if (RLE_DEBUG) {
                    System.out.println("[Making load available " + availableLoad + " <- " + vlts(loadedValue) + "]");
                }
            } else {
                // Found an available load!
                if (RLE_DEBUG) {
                    System.out.println("[Found available load " + availableLoad + " <- " + vlts(loadedValue) + "]");
                }
            }

            pushOutputValues(loadedValue);

            if (VERIFY_INTEGRITY) {
                checkConsumedAndProducedValues(obj, new ValueNumber[] { reference }, loadedValue);
            }
        } catch (DataflowAnalysisException e) {
            throw new InvalidBytecodeException("Error loading from instance field", e);
        }
    }
415003
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
            if (m_fldTarget == null)
                if (m_fsTarget != null)
                    m_fldTarget = this.getOwner().getField(m_fsTarget);
    }
1169789
public void getField(Type owner, String name, Type type) {
    adapter.getField(owner, name, type);
  }
368700
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            this.setupGridOrder();      // Set the initial grid order
            if (m_gridScreen != null)
            {
                m_gridScreen.setConverter(this.getOwner());   // The grid screen will automatically change this field to match the key order.
                this.getOwner().addComponent(m_gridScreen);
            }
        }
    }
906765
private void inject(Object target, Field field) {
        try {
            
            /**
             * Injection is actually quite a simple process. We resolve the
             * field into a source of instances, and ask it to generate one.
             */
            field.set(target, registrar.resolve(field).getInstance());
        
        } catch (IllegalArgumentException | IllegalAccessException e) {
            throw new IrohException(e);        
        }
    }
169604
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            BaseField field = m_field;
            if (field != null)
                if (field.getRecord() != owner)
            {   // Points to different file... make sure this is removed if the other file is closed
                field.addListener(new FieldRemoveBOnCloseHandler(this));
            }
        }
    }
937632
private void setField(Field field, Object instance, Object value) throws SlickXMLException {
		try {
			field.setAccessible(true);
			field.set(instance, value);
		} catch (IllegalArgumentException e) {
			throw new SlickXMLException("Failed to set: "+field+" for an XML attribute, is it valid?", e);
		} catch (IllegalAccessException e) {
			throw new SlickXMLException("Failed to set: "+field+" for an XML attribute, is it valid?", e);
		} finally {
			field.setAccessible(false);
		}
	}
1101045
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null) if (m_fldToDisable != null)
            if (this.getOwner().getRecord() != m_fldToDisable.getRecord())
                m_fldToDisable.addListener(new FieldRemoveBOnCloseHandler(this)); // Make sure you remove this listener if m_fldToDisable is gone.
        if (owner != null)
            if (m_fldToDisable == null)
                m_fldToDisable = this.getOwner();
        if (owner != null)
            this.fieldChanged(DBConstants.DONT_DISPLAY, DBConstants.INIT_MOVE);
        if (owner == null)
            m_fldToDisable.setEnabled(true);    // Remove the behavior = reenable the field
    }
306036
public void addGetFieldIntercept(String owner, String name) {

    if (isLog(4)) {
      log("change getfield " + owner + " name:" + name);
    }
    typeQueryUser = true;
  }
1178703
public <D, V> void iput(FieldId<D, V> fieldId, Local<? extends D> instance, Local<? extends V> source) {
        addInstruction(new ThrowingCstInsn(Rops.opPutField(source.type.ropType), sourcePosition,
                RegisterSpecList.make(source.spec(), instance.spec()), catches, fieldId.constant));
    }
757115
public void init(BaseField owner)
    {
        m_bScreenMove = true;
        m_bInitMove = true;
        m_bReadMove = true;
        super.init(owner);
    }
231367
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null) if (!this.getOwner().isNull())
            // Display the screen that is supposed to be up now
            this.fieldChanged(DBConstants.DISPLAY, DBConstants.INIT_MOVE);
    }
55301
public void setOwner(ListenerOwner owner)
    {
        if (owner != null)
        if (m_fldDest == null)
            if (fieldName != null)
                m_fldDest = ((BaseField)owner).getRecord().getField(fieldName);
        super.setOwner(owner);
    }
379890
protected void initializeField( Field field, Object instance )
    {
        if ( instance != null )
        {
            if ( _log.isTraceEnabled() )
            {
                _log.trace( "Initializing field " + field.getName() + " in " + getDisplayName() + " with " + instance );
            }
            
            try
            {
                field.set( this, instance );
            }
            catch ( IllegalArgumentException e )
            {
                _log.error( "Could not set field " + field.getName() + " on " + getDisplayName() +
                            "; instance is of type " + instance.getClass().getName() + ", field type is "
                            + field.getType().getName() );
            }
            catch ( IllegalAccessException e )
            {
                _log.error( "Error initializing field " + field.getName() + " in " + getDisplayName(), e );
            }
        }
    }
85125
public function restoreField (MapField $field, ElementInterface $owner)
	{
		/** @var MapElement $map */
		$map = $owner->getFieldValue($field->handle);

		\Craft::$app->getElements()->restoreElement($map);
	}
295067
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            if (m_fldSource == null)
                m_fldSource = this.getOwner();
    
            if ((m_fldDest != null)
                && (((BaseField)m_fldDest.getField()).getRecord() != null)
                && (((BaseField)m_fldDest.getField()).getRecord() != this.getOwner().getRecord()))
                    ((BaseField)m_fldDest.getField()).getRecord().addListener(new FileRemoveBOnCloseHandler(this));     // Not same file, if target file closes, remove this listener!
            else if ((m_fldSource.getField() != null)
                && (((BaseField)m_fldSource.getField()).getRecord() != null)
                && (((BaseField)m_fldSource.getField()).getRecord() != this.getOwner().getRecord()))
                    ((BaseField)m_fldSource.getField()).getRecord().addListener(new FileRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener!
        }
    }