@SuppressWarnings("unused") protected void _doPrepare(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmConstructor constructor, Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByContext) { StackedResolvedTypes childResolvedTypes = declareTypeParameters(resolvedTypes, constructor, resolvedTypesByContext); JvmDeclaredType producedType = constructor.getDeclaringType(); LightweightTypeReference lightweightReference = childResolvedTypes.getReferenceOwner().toLightweightTypeReference(producedType); childResolvedTypes.setType(constructor, lightweightReference); }
protected void prepareMembers(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmDeclaredType type, Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByType) { IFeatureScopeSession childSession = addExtensionsToMemberSession(resolvedTypes, featureScopeSession, type); StackedResolvedTypes childResolvedTypes = declareTypeParameters(resolvedTypes, type, resolvedTypesByType); JvmTypeReference superType = getExtendedClass(type); ITypeReferenceOwner referenceOwner = childResolvedTypes.getReferenceOwner(); if (superType != null) { LightweightTypeReference lightweightSuperType = referenceOwner.toLightweightTypeReference(superType); childResolvedTypes.reassignTypeWithoutMerge(superType.getType(), lightweightSuperType); /* * We use reassignType to make sure that the following works: * * StringList extends AbstractList<String> { * NestedIntList extends AbstractList<Integer> { * } * SubType extends StringList {} * } */ } LightweightTypeReference lightweightThisType = referenceOwner.toLightweightTypeReference(type); childResolvedTypes.reassignTypeWithoutMerge(type, lightweightThisType); List<JvmMember> members = type.getMembers(); int size = members.size(); for(int i = 0; i < size; i++) { doPrepare(childResolvedTypes, childSession, members.get(i), resolvedTypesByType); } }
protected void _doPrepare(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmField field, Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByContext) { StackedResolvedTypes childResolvedTypes = declareTypeParameters(resolvedTypes, field, resolvedTypesByContext); JvmTypeReference knownType = field.getType(); if (InferredTypeIndicator.isInferred(knownType)) { XComputedTypeReference casted = (XComputedTypeReference) knownType; JvmTypeReference reference = createComputedTypeReference(resolvedTypesByContext, childResolvedTypes, featureScopeSession, field, (InferredTypeIndicator) casted.getTypeProvider(), false); casted.setEquivalent(reference); } else if (knownType != null) { LightweightTypeReference lightweightReference = childResolvedTypes.getReferenceOwner().toLightweightTypeReference(knownType); childResolvedTypes.setType(field, lightweightReference); } else { JvmTypeReference reference = createComputedTypeReference(resolvedTypesByContext, childResolvedTypes, featureScopeSession, field, null, false); field.setType(reference); } }
protected void _doPrepare(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmOperation operation, Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByContext) { StackedResolvedTypes childResolvedTypes = declareTypeParameters(resolvedTypes, operation, resolvedTypesByContext); JvmTypeReference knownType = operation.getReturnType(); if (InferredTypeIndicator.isInferred(knownType)) { XComputedTypeReference casted = (XComputedTypeReference) knownType; JvmTypeReference reference = createComputedTypeReference( resolvedTypesByContext, childResolvedTypes, featureScopeSession, operation, (InferredTypeIndicator) casted.getTypeProvider(), true); casted.setEquivalent(reference); } else if (knownType != null) { LightweightTypeReference lightweightReference = childResolvedTypes.getReferenceOwner().toLightweightTypeReference(knownType); childResolvedTypes.setType(operation, lightweightReference); } else { JvmTypeReference reference = createComputedTypeReference(resolvedTypesByContext, childResolvedTypes, featureScopeSession, operation, null, true); operation.setReturnType(reference); } }