@Override public LightweightTypeReference toLightweightTypeReference(JvmType type) { return factory.toLightweightReference(type); }
@Override public LightweightTypeReference toLightweightTypeReference(JvmTypeReference type) { return factory.toLightweightReference(type); }
protected String _getStringRepresentation(final JvmTypeReference object) { final LightweightTypeReference reference = new LightweightTypeReferenceFactory(this.typeReferenceOwner, true).toLightweightReference(object); return this._getStringRepresentation(reference); }
/** Convert a type reference to a lightweight type reference. * * @param typeRef - reference to convert. * @param services - services used for the conversion * @param keepUnboundWildcardInformation - indicates if the unbound wild card * information must be keeped in the lightweight reference. * @return the lightweight type reference. */ public static LightweightTypeReference toLightweightTypeReference( JvmTypeReference typeRef, CommonTypeComputationServices services, boolean keepUnboundWildcardInformation) { if (typeRef == null) { return null; } final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, typeRef); final LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, keepUnboundWildcardInformation); final LightweightTypeReference reference = factory.toLightweightReference(typeRef); return reference; }
/** Convert a type to a lightweight type reference. * * @param type - type to convert. * @param services - services used for the conversion * @param keepUnboundWildcardInformation - indicates if the unbound wild card * information must be keeped in the lightweight reference. * @return the lightweight type reference. */ public static LightweightTypeReference toLightweightTypeReference( JvmType type, CommonTypeComputationServices services, boolean keepUnboundWildcardInformation) { if (type == null) { return null; } final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); final LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, keepUnboundWildcardInformation); final LightweightTypeReference reference = factory.toLightweightReference(type); return reference; }
protected LightweightTypeReference toLightweightTypeReference(JvmTypeReference typeRef, boolean keepUnboundWildcardInformation) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(getServices(), typeRef); LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, keepUnboundWildcardInformation); LightweightTypeReference reference = factory.toLightweightReference(typeRef); return reference; }
/** Create a lightweight type reference from the given type. * * @param type the type to point to. * @param context the context in which the reference is located. * @return the reference. */ protected LightweightTypeReference toLightweightTypeReference(JvmType type, EObject context) { final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(getServices(), context); final LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, false); return factory.toLightweightReference(type); }
protected void appendParameters(final StringBuilder result, final JvmExecutable executable, final int insignificantParameters, final LightweightTypeReferenceFactory ownedConverter) { final EList<JvmFormalParameter> declaredParameters = executable.getParameters(); final List<JvmFormalParameter> relevantParameters = declaredParameters.subList(Math.min(insignificantParameters, declaredParameters.size()), declaredParameters.size()); for (int i = 0; (i < relevantParameters.size()); i++) { { final JvmFormalParameter parameter = relevantParameters.get(i); if ((i != 0)) { result.append(", "); } if ((((i == (relevantParameters.size() - 1)) && executable.isVarArgs()) && (parameter.getParameterType() instanceof JvmGenericArrayTypeReference))) { JvmTypeReference _parameterType = parameter.getParameterType(); final JvmGenericArrayTypeReference parameterType = ((JvmGenericArrayTypeReference) _parameterType); result.append(ownedConverter.toLightweightReference(parameterType.getComponentType()).getHumanReadableName()); result.append("..."); } else { JvmTypeReference _parameterType_1 = parameter.getParameterType(); boolean _tripleNotEquals = (_parameterType_1 != null); if (_tripleNotEquals) { final String simpleName = ownedConverter.toLightweightReference(parameter.getParameterType()).getHumanReadableName(); if ((simpleName != null)) { result.append(simpleName); } } } result.append(" "); result.append(String.valueOf(parameter.getName())); } } }
if (((returnType != null) && (returnType.getSimpleName() != null))) { labelBuilder.append(" : "); labelBuilder.append(converter.toLightweightReference(returnType).getHumanReadableName()); boolean _tripleNotEquals = (_type != null); if (_tripleNotEquals) { final String fieldType = converter.toLightweightReference(((JvmField)feature).getType()).getHumanReadableName(); if ((fieldType != null)) { labelBuilder.append(fieldType);
for(JvmTypeConstraint constraint: constraints) { if (constraint instanceof JvmUpperBound && constraint.getTypeReference() != null) { LightweightTypeReference upperBound = factory.toLightweightReference(constraint.getTypeReference()); upperBound.accept(this, data); upperBounds.add(upperBound);
final LightweightTypeReference light = this.getTypeConverter(contentAssistContext.getResource()).toLightweightReference(parameterType); boolean _isFunctionType = light.isFunctionType(); if (_isFunctionType) {
/** Replies if the first parameter is a subtype of the second parameter. * * @param context the context. * @param subType the subtype to test. * @param superType the expected super type. * @return the type reference. */ @Pure protected boolean isSubTypeOf(EObject context, JvmTypeReference subType, JvmTypeReference superType) { if (isTypeReference(superType) && isTypeReference(subType)) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, context); LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, false); LightweightTypeReference reference = factory.toLightweightReference(subType); return reference.isSubtypeOf(superType.getType()); } return false; }
public TypeReference toTypeReference(final JvmTypeReference delegate) { TypeReference _xblockexpression = null; { if ((delegate == null)) { return null; } TypeReference _switchResult = null; boolean _matched = false; if (delegate instanceof XComputedTypeReferenceImplCustom) { boolean _isEquivalentComputed = ((XComputedTypeReferenceImplCustom)delegate).isEquivalentComputed(); boolean _not = (!_isEquivalentComputed); if (_not) { _matched=true; InferredTypeReferenceImpl _inferredTypeReferenceImpl = new InferredTypeReferenceImpl(); final Procedure1<InferredTypeReferenceImpl> _function = (InferredTypeReferenceImpl it) -> { it.setDelegate(((XComputedTypeReferenceImplCustom)delegate)); it.setCompilationUnit(this); }; _switchResult = ObjectExtensions.<InferredTypeReferenceImpl>operator_doubleArrow(_inferredTypeReferenceImpl, _function); } } if (!_matched) { _switchResult = this.toTypeReference(this.typeRefFactory.toLightweightReference(delegate), delegate); } _xblockexpression = _switchResult; } return _xblockexpression; }
public LightweightTypeReference toLightweightReference(JvmType type) { if (type.eClass() == TypesPackage.Literals.JVM_ARRAY_TYPE) { JvmComponentType componentType = ((JvmArrayType) type).getComponentType(); LightweightTypeReference componentTypeReference = toLightweightReference(componentType); return owner.newArrayTypeReference(componentTypeReference); } ParameterizedTypeReference result = owner.newParameterizedTypeReference(type); if (type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { result.accept(new TypeReferenceVisitor() { @Override protected void doVisitInnerTypeReference(InnerTypeReference reference) { reference.getOuter().accept(this); super.doVisitInnerTypeReference(reference); } @Override protected void doVisitParameterizedTypeReference(ParameterizedTypeReference reference) { JvmType rawType = reference.getType(); if (rawType.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { List<JvmTypeParameter> typeParameters = ((JvmTypeParameterDeclarator) rawType).getTypeParameters(); for(int i = 0, size = typeParameters.size(); i < size; i++) { JvmTypeParameter typeParameter = typeParameters.get(i); reference.addTypeArgument(owner.newParameterizedTypeReference(typeParameter)); } } } }); } return result; }
protected LightweightTypeReference getStricterConstraint(final UnboundTypeReference typeParameter, LightweightTypeReference hint) { final JvmTypeParameter parameter = typeParameter.getTypeParameter(); List<JvmTypeConstraint> constraints = parameter.getConstraints(); for(JvmTypeConstraint constraint: constraints) { JvmTypeReference constraintReference = constraint.getTypeReference(); if (constraintReference != null) { final boolean[] recursive = new boolean[] { false }; LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(hint.getOwner()) { @Override public LightweightTypeReference doVisitParameterizedTypeReference(JvmParameterizedTypeReference reference) { JvmType type = reference.getType(); if (type == parameter) {// recursively bound recursive[0] = true; } return super.doVisitParameterizedTypeReference(reference); } }; LightweightTypeReference lightweightReference = factory.toLightweightReference(constraintReference); if (!recursive[0]) { if (hint.isAssignableFrom(lightweightReference)) { hint = lightweightReference; } else if (hint.isResolved() && !lightweightReference.getRawTypeReference().isAssignableFrom(hint, TypeConformanceComputationArgument.RAW)) { return null; } } } } return hint; }