protected String _getStringRepresentation(final JvmTypeReference object) { final LightweightTypeReference reference = new LightweightTypeReferenceFactory(this.typeReferenceOwner, true).toLightweightReference(object); return this._getStringRepresentation(reference); }
@Override public LightweightTypeReference doVisitParameterizedTypeReference(JvmParameterizedTypeReference reference) { JvmType type = reference.getType(); if (type == parameter) {// recursively bound recursive[0] = true; } return super.doVisitParameterizedTypeReference(reference); } };
@Override public LightweightTypeReference toPlainTypeReference(JvmType type) { return factory.toPlainTypeReference(type); }
@Override public LightweightTypeReference toLightweightTypeReference(JvmType type) { return factory.toLightweightReference(type); }
@Override public LightweightTypeReference doVisitInnerTypeReference(JvmInnerTypeReference reference) { JvmType type = getType(reference); if (type == null || type.eIsProxy()) { return createUnknownTypeReference(reference); } if (!isInner(type)) { return doVisitParameterizedTypeReference(reference); } JvmParameterizedTypeReference outer = reference.getOuter(); if (outer == null) return doVisitParameterizedTypeReference(reference); ParameterizedTypeReference lightweightOuter = (ParameterizedTypeReference) outer.accept(this); // constructor call instead of owner.newParameterized to avoid second check for isInner(..) InnerTypeReference result = new InnerTypeReference(owner, lightweightOuter, type); for(JvmTypeReference argument: reference.getArguments()) { result.addTypeArgument(visit(argument).getWrapperTypeIfPrimitive()); } return result; }
if (((returnType != null) && (returnType.getSimpleName() != null))) { labelBuilder.append(" : "); labelBuilder.append(converter.toLightweightReference(returnType).getHumanReadableName()); descriptionBuilder.append(converter.toPlainTypeReference(((JvmOperation)feature).getDeclaringType()).getHumanReadableName()); if ((!withParents)) { descriptionBuilder.append("."); boolean _tripleNotEquals = (_type != null); if (_tripleNotEquals) { final String fieldType = converter.toLightweightReference(((JvmField)feature).getType()).getHumanReadableName(); if ((fieldType != null)) { labelBuilder.append(fieldType); descriptionBuilder.append(converter.toPlainTypeReference(((JvmField)feature).getDeclaringType()).getHumanReadableName()); } else { if ((feature instanceof JvmConstructor)) {
public StandardTypeReferenceOwner(CommonTypeComputationServices services, /* @Nullable */ ResourceSet context) { this.services = services; this.context = context; this.factory = new LightweightTypeReferenceFactory(this); }
@Override public LightweightTypeReference doVisitParameterizedTypeReference(JvmParameterizedTypeReference reference) { JvmType type = getType(reference); if (type == null || type.eIsProxy()) { return createUnknownTypeReference(reference); } ParameterizedTypeReference result = owner.newParameterizedTypeReference(type); for(JvmTypeReference argument: reference.getArguments()) { result.addTypeArgument(visit(argument).getWrapperTypeIfPrimitive()); } return result; }
@Override public LightweightTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference) { JvmTypeReference originalComponentType = reference.getComponentType(); LightweightTypeReference lightweightComponentType = null; if (originalComponentType != null) { lightweightComponentType = visit(originalComponentType); if (lightweightComponentType.isAny()) return lightweightComponentType; } else { lightweightComponentType = getObjectReference(); } return owner.newArrayTypeReference(lightweightComponentType); }
@Override public LightweightTypeReference doVisitMultiTypeReference(JvmMultiTypeReference reference) { return doVisitCompoundReference(reference, false); }
@Override public LightweightTypeReference toLightweightTypeReference(JvmTypeReference type) { return factory.toLightweightReference(type); }
public void before(final ActiveAnnotationContexts.AnnotationCallback phase) { this.lastPhase = phase; final StandardTypeReferenceOwner standardTypeReferenceOwner = new StandardTypeReferenceOwner(this.services, this.xtendFile); boolean _equals = Objects.equal(ActiveAnnotationContexts.AnnotationCallback.INDEXING, phase); if (_equals) { IndexingLightweightTypeReferenceFactory _indexingLightweightTypeReferenceFactory = new IndexingLightweightTypeReferenceFactory(standardTypeReferenceOwner); this.typeRefFactory = _indexingLightweightTypeReferenceFactory; } else { LightweightTypeReferenceFactory _lightweightTypeReferenceFactory = new LightweightTypeReferenceFactory(standardTypeReferenceOwner); this.typeRefFactory = _lightweightTypeReferenceFactory; } boolean _equals_1 = Objects.equal(ActiveAnnotationContexts.AnnotationCallback.VALIDATION, phase); if (_equals_1) { this.problemSupport.validationPhaseStarted(); } }
if (constraint instanceof JvmUpperBound) { upperBoundSeen = true; result.addUpperBound(visit(constraint.getTypeReference()).getWrapperTypeIfPrimitive()); } else if (result.getLowerBound() == null) { result.setLowerBound(visit(constraint.getTypeReference()).getWrapperTypeIfPrimitive()); LightweightTypeReference upperBound = getObjectReference(); result.addUpperBound(upperBound); LightweightTypeReference upperBound = getObjectReference(); result.addUpperBound(upperBound);
@Override public LightweightTypeReference doVisitSynonymTypeReference(JvmSynonymTypeReference reference) { return doVisitCompoundReference(reference, true); }
/** 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; }
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())); } } }
public void setXtendFile(final XtendFile xtendFile) { this.xtendFile = xtendFile; StandardTypeReferenceOwner _standardTypeReferenceOwner = new StandardTypeReferenceOwner(this.services, xtendFile); LightweightTypeReferenceFactory _lightweightTypeReferenceFactory = new LightweightTypeReferenceFactory(_standardTypeReferenceOwner); this.typeRefFactory = _lightweightTypeReferenceFactory; this.fileSystemSupport.setContext(xtendFile.eResource().getResourceSet()); this.fileLocations.setContext(xtendFile.eResource()); }
public LightweightTypeReference toPlainTypeReference(JvmType type) { if (type.eClass() == TypesPackage.Literals.JVM_ARRAY_TYPE) { JvmComponentType componentType = ((JvmArrayType) type).getComponentType(); LightweightTypeReference componentTypeReference = toPlainTypeReference(componentType); return owner.newArrayTypeReference(componentTypeReference); } return owner.newParameterizedTypeReference(type); }
@Override public LightweightTypeReference doVisitParameterizedTypeReference(final JvmParameterizedTypeReference reference) { final LightweightTypeReference result = super.doVisitParameterizedTypeReference(reference); boolean _isFunctionType = result.isFunctionType(); if (_isFunctionType) { return result.tryConvertToFunctionTypeReference(false); } return result; } };
/** 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; }