/** * Assign computed type references to the identifiable structural elements in the processed type. * @return the stacked resolved types that shall be used in the computation. */ protected Map<JvmIdentifiableElement, ResolvedTypes> prepare(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession) { Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByContext = Maps.newHashMapWithExpectedSize(3); JvmType root = getRootJvmType(); rootedInstances.add(root); recordExpressions(root); doPrepare(resolvedTypes, featureScopeSession, root, resolvedTypesByContext); return resolvedTypesByContext; }
@Override protected void capture(ITypeComputationState state) { this.capturedState = ((AbstractTypeComputationState) state).getFeatureScopeSession(); IFeatureScopeSession nestedSession = typeResolver.addThisAndSuper(capturedState, state.getReferenceOwner(), localClass, getEquivalent(), true); ResolvedTypes capturedResolvedTypes = captureResolvedTypes(state); typeResolver.doPrepare(capturedResolvedTypes, nestedSession, localClass, resolvedTypesByContext); }
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); } }