@Override public ITypeReferenceOwner getReferenceOwner() { return resolvedTypes.getReferenceOwner(); }
@Override protected ITypeComputationResult createNoTypeResult() { return new NoTypeResult(annotationValue, resolvedTypes.getReferenceOwner()); } }
@Override public ITypeReferenceOwner getReferenceOwner() { return getParent().getReferenceOwner(); }
@Override public ITypeReferenceOwner getReferenceOwner() { return getParent().getReferenceOwner(); }
@Override protected ITypeComputationResult createNoTypeResult() { return new NoTypeResult(null, resolvedTypes.getReferenceOwner()); }
protected void mergeExpressionTypesIntoParent(ResolvedTypes parent) { Map<XExpression, List<TypeData>> expressionTypes = basicGetExpressionTypes(); if (!expressionTypes.isEmpty()) { for(Map.Entry<XExpression, List<TypeData>> entry: expressionTypes.entrySet()) { List<TypeData> list = entry.getValue(); for (int i = 0, size = list.size(); i < size; i++) { parent.acceptType(entry.getKey(), prepareMerge(list.get(i), parent.getReferenceOwner())); } } } }
protected ResolvedTypes pushExpectedExceptions(JvmExecutable exceptionDeclarator) { List<JvmTypeReference> executablesExceptions = exceptionDeclarator.getExceptions(); if (executablesExceptions.isEmpty()) return this; List<LightweightTypeReference> exceptions = Lists.newArrayListWithCapacity(executablesExceptions.size()); for(JvmTypeReference exception: executablesExceptions) { exceptions.add(getReferenceOwner().toLightweightTypeReference(exception)); } return pushExpectedExceptions(exceptions); }
protected UnboundTypeReference createUnboundTypeReference(XExpression expression, JvmTypeParameter type) { UnboundTypeReference result = new UnboundTypeReference(getReferenceOwner(), expression, type) { // the constructor is protected since this guides developers better // therefore we use an anonymous class, here }; acceptUnboundTypeReference(result.getHandle(), result); return result; }
@Override protected ITypeComputationResult createNoTypeResult() { return new NoTypeResult(getMember(), resolvedTypes.getReferenceOwner()); }
protected void _doPrepare(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmDeclaredType type, Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByType) { IFeatureScopeSession childSession = addThisAndSuper(featureScopeSession, resolvedTypes.getReferenceOwner(), type); prepareMembers(resolvedTypes, childSession, type, resolvedTypesByType); }
@Override protected ITypeComputationResult createNoTypeResult() { return new NoTypeResult(getMember(), resolvedTypes.getReferenceOwner()); }
protected void mergeTypesIntoParent(ResolvedTypes parent) { Map<JvmIdentifiableElement, LightweightTypeReference> types = basicGetTypes(); if (!types.isEmpty()) { for(Map.Entry<JvmIdentifiableElement, LightweightTypeReference> entry: types.entrySet()) { LightweightTypeReference value = entry.getValue(); if (value instanceof UnboundTypeReference && super.isResolved(((UnboundTypeReference) value).getHandle())) { parent.setType(entry.getKey(), value.getUpperBoundSubstitute().copyInto(parent.getReferenceOwner())); } else { parent.setType(entry.getKey(), value.copyInto(parent.getReferenceOwner())); } } } }
@Override public List<LightweightTypeReference> getThrownExceptions(XExpression obj) { return getServices().getEarlyExitComputer().getThrownExceptions(obj, this, this.getReferenceOwner()); }
@Override protected JvmTypeReference handleReentrantInvocation(XComputedTypeReferenceImplCustom context) { resolvedTypes.addDiagnostic(new EObjectDiagnosticImpl( Severity.WARNING, IssueCodes.TOO_LITTLE_TYPE_INFORMATION, "Cannot infer type from recursive usage. Type 'Object' is used.", typeResolver.getSourceElement(operation), null, -1, null)); AnyTypeReference result = resolvedTypes.getReferenceOwner().newAnyTypeReference(); return typeResolver.toJavaCompliantTypeReference(result, session); } }
protected void resolveKnownArgumentType(XExpression argument, LightweightTypeReference knownType, /* @Nullable */ LightweightTypeReference declaredType, ITypeComputationState argumentState) { if (!(argumentState instanceof AbstractTypeComputationState)) throw new IllegalArgumentException("argumentState was " + argumentState); AbstractTypeComputationState castedArgumentState = (AbstractTypeComputationState) argumentState; ResolvedTypes resolvedTypes = getState().getResolvedTypes(); LightweightTypeReference copiedDeclaredType = declaredType != null ? declaredType.copyInto(resolvedTypes.getReferenceOwner()) : null; TypeExpectation expectation = new TypeExpectation(copiedDeclaredType, castedArgumentState, false); LightweightTypeReference copiedReceiverType = knownType.copyInto(resolvedTypes.getReferenceOwner()); // TODO should we use the result of #acceptType? resolvedTypes.acceptType(argument, expectation, copiedReceiverType, false, ConformanceFlags.UNCHECKED); if (copiedDeclaredType != null) resolveAgainstActualType(copiedDeclaredType, copiedReceiverType, castedArgumentState); }
@SuppressWarnings("unused") protected void _computeTypes(Map<JvmIdentifiableElement, ResolvedTypes> preparedResolvedTypes, ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmDeclaredType type) { ResolvedTypes childResolvedTypes = preparedResolvedTypes.get(type); if (childResolvedTypes == null) throw new IllegalStateException("No resolved type found. Type was: " + type.getIdentifier()); IFeatureScopeSession capturedState = LocalVariableCapturerImpl.findCapturedState(type); if (capturedState != null) { featureScopeSession = capturedState; } IFeatureScopeSession childSession = addThisAndSuper(featureScopeSession, childResolvedTypes.getReferenceOwner(), type); computeMemberTypes(preparedResolvedTypes, childResolvedTypes, childSession, type); computeAnnotationTypes(childResolvedTypes, featureScopeSession, type); mergeChildTypes(childResolvedTypes); }
@Override protected LightweightTypeReference getExpectedType() { return getResolvedTypes().getReferenceOwner().toLightweightTypeReference(getTypeReferences().getTypeForName(Void.TYPE, getMember())); }
@Override public void applyToComputationState() { ResolvedTypes resolvedTypes = getState().getResolvedTypes(); LightweightTypeReference actualType = resolvedTypes.getActualType(getFeature()); if (actualType == null) throw new IllegalStateException("Cannot determine actual type of already resolved implicit receiver"); LightweightTypeReference expectedReceiverType = new FeatureLinkHelper().getExpectedReceiverType(getOwner().getFeature(), actualType); if (expectedReceiverType != null) expectedReceiverType = expectedReceiverType.copyInto(resolvedTypes.getReferenceOwner()); TypeExpectation expectation = new TypeExpectation(expectedReceiverType, getState(), false); resolvedTypes.acceptType(getFeatureCall(), expectation, actualType.copyInto(resolvedTypes.getReferenceOwner()), false, ConformanceFlags.UNCHECKED); super.applyToComputationState(); }
@Override public void applyToComputationState() { ResolvedTypes resolvedTypes = getState().getResolvedTypes(); TypeExpectation expectation = new TypeExpectation(null, getState(), false); LightweightTypeReference actualType = resolvedTypes.getActualType(getFeature()); if (actualType == null) throw new IllegalStateException("Cannot determine actual type of already resolved implicit first argument"); resolvedTypes.acceptType(getFeatureCall(), expectation, actualType.copyInto(resolvedTypes.getReferenceOwner()), false, ConformanceFlags.UNCHECKED); super.applyToComputationState(); }
@Override protected ITypeComputationResult createNoTypeResult() { JvmOperation operation = (JvmOperation) getMember(); LightweightTypeReference expectedType = ((LogicalContainerAwareReentrantTypeResolver)getResolver()).getReturnTypeOfOverriddenOperation(operation, resolvedTypes, getFeatureScopeSession()); if (expectedType != null) { InferredTypeIndicator.resolveTo(operation.getReturnType(), expectedType.toJavaCompliantTypeReference()); } return new NoTypeResult(getMember(), resolvedTypes.getReferenceOwner()); } }