DfaValue (@NotNull DfType qualifierType, @NotNull DerivedVariableDescriptor specialField, @NotNull DfaValue specialFieldValue) { if (specialFieldValue instanceof DfaVariableValue && ((DfaVariableValue)specialFieldValue).getDescriptor() == specialField) { DfaVariableValue qualifier = ((DfaVariableValue)specialFieldValue).getQualifier(); if (qualifier != null && qualifierType.isSuperType(qualifier.getDfType())) { return qualifier; } } if (specialFieldValue instanceof DfaTypeValue || specialFieldValue instanceof DfaWrappedValue) { DfType fieldValue = specialFieldValue.getDfType(); DfType dfType = specialField.asDfType(qualifierType, fieldValue); return myFactory.fromDfType(dfType); } if (specialFieldValue instanceof DfaVariableValue) { return cachedValues.computeIfAbsent(Arrays.asList(specialFieldValue, specialField, qualifierType), k -> new DfaWrappedValue((DfaVariableValue)specialFieldValue, specialField, qualifierType)); } return myFactory.fromDfType(qualifierType); }