@Override public LightweightTypeReference doVisitAnyTypeReference(JvmAnyTypeReference reference) { return owner.newAnyTypeReference(); }
@Override public LightweightTypeReference getReturnType() { return owner.newAnyTypeReference(); }
@Override public LightweightTypeReference getLowerBoundSubstitute() { if (lowerBound != null) return lowerBound; return getOwner().newAnyTypeReference(); }
/** * @param object used for dispatching */ protected void _computeTypes(XNullLiteral object, ITypeComputationState state) { state.acceptActualType(state.getReferenceOwner().newAnyTypeReference()); }
@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 LightweightTypeReference getDeclaredType(JvmIdentifiableElement feature) { LightweightTypeReference result = state.getResolvedTypes().getActualType(feature); if (result == null) { return getState().getReferenceOwner().newAnyTypeReference(); } return result; }
@Override protected JvmTypeReference handleReentrantInvocation(XComputedTypeReferenceImplCustom context) { EObject sourceElement = getSourceElement(member); EStructuralFeature feature = sourceElement.eClass().getEStructuralFeature("name"); resolvedTypes.addDiagnostic(new EObjectDiagnosticImpl( Severity.WARNING, IssueCodes.TOO_LITTLE_TYPE_INFORMATION, "Cannot infer type from recursive usage. Type 'Object' is used.", sourceElement, feature, -1, null)); AnyTypeReference result = resolvedTypes.getReferenceOwner().newAnyTypeReference(); return toJavaCompliantTypeReference(result, session); }
protected void assignType(JvmIdentifiableElement element, /* @Nullable */ LightweightTypeReference actualType, boolean addToChildScope) { if (actualType != null) { state.getResolvedTypes().setType(element, actualType); } else { state.getResolvedTypes().setType(element, state.getReferenceOwner().newAnyTypeReference()); } if (addToChildScope) state.addLocalToCurrentScope(element); }
public void commit() { if (!nonNullResultProcessed) { AnyTypeReference anyType = state.getReferenceOwner().newAnyTypeReference(); state.acceptActualType(anyType); if (earlyExit && allVoid) { if (!expectation.isVoidTypeAllowed()) { AnyTypeReference anyType = state.getReferenceOwner().newAnyTypeReference(); expectation.acceptActualType(anyType, ConformanceFlags.UNCHECKED); allPrimitive = false; AnyTypeReference anyType = state.getReferenceOwner().newAnyTypeReference(); expectation.acceptActualType(anyType, ConformanceFlags.UNCHECKED); AnyTypeReference anyType = state.getReferenceOwner().newAnyTypeReference(); state.acceptActualType(anyType);
expectation.acceptActualType(expectedType, ConformanceFlags.CHECKED_SUCCESS); } else { expectation.acceptActualType(expectation.getReferenceOwner().newAnyTypeReference(), ConformanceFlags.UNCHECKED);
protected ExpressionAwareStackedResolvedTypes doComputeTypes(XExpression expression) { ExpressionAwareStackedResolvedTypes stackedResolvedTypes = pushTypes(expression); ExpressionTypeComputationState state = createExpressionComputationState(expression, stackedResolvedTypes); stackedResolvedTypes.addExpressionScope(expression, state.getFeatureScopeSession(), IExpressionScope.Anchor.BEFORE); getResolver().getTypeComputer().computeTypes(expression, state); stackedResolvedTypes.prepareMergeIntoParent(); if (stackedResolvedTypes.doGetTypeData(expression) == null) { state.acceptActualType(stackedResolvedTypes.getReferenceOwner().newAnyTypeReference()); } stackedResolvedTypes.addExpressionScope(expression, getFeatureScopeSession(), IExpressionScope.Anchor.AFTER); return stackedResolvedTypes; }
protected void _computeTypes(XTryCatchFinallyExpression object, ITypeComputationState state) { List<LightweightTypeReference> caughtExceptions = Lists.newArrayList(); ITypeReferenceOwner referenceOwner = state.getReferenceOwner(); for (XCatchClause catchClause : object.getCatchClauses()) if (catchClause.getDeclaredParam() != null && catchClause.getDeclaredParam().getParameterType() != null) caughtExceptions.add(referenceOwner.toLightweightTypeReference(catchClause.getDeclaredParam().getParameterType())); state.withExpectedExceptions(caughtExceptions).computeTypes(object.getExpression()); for (XCatchClause catchClause : object.getCatchClauses()) { JvmFormalParameter catchClauseParam = catchClause.getDeclaredParam(); JvmTypeReference parameterType = catchClauseParam.getParameterType(); LightweightTypeReference lightweightReference = parameterType != null ? normalizedMultiType(referenceOwner, parameterType) : referenceOwner.newAnyTypeReference(); if (lightweightReference.isSynonym()) { lightweightReference = getCommonSuperType(lightweightReference.getMultiTypeComponents(), referenceOwner); } ITypeComputationState catchClauseState = assignType(catchClauseParam, lightweightReference, state); catchClauseState.withinScope(catchClause); catchClauseState.computeTypes(catchClause.getExpression()); } // TODO validate / handle return / throw in finally block state.withoutExpectation().computeTypes(object.getFinallyExpression()); }