@Override public Boolean doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, JvmTypeReference param) { if (!(param instanceof JvmGenericArrayTypeReference)) { return Boolean.FALSE; } JvmTypeReference myComponentType = reference.getComponentType(); JvmTypeReference otherComponentType = ((JvmGenericArrayTypeReference) param).getComponentType(); return visit(myComponentType, otherComponentType); }
@Override public Boolean doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Boolean wildcardIsUnresolved) { return visit(reference.getComponentType(), wildcardIsUnresolved); } }
@Override public StringBuilder doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, StringBuilder param) { param = visit(reference.getComponentType(), param); if (param != null) { param.append("[]"); } return param; }
@Override public TypeConformanceResult doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference left, JvmGenericArrayTypeReference right, TypeConformanceComputationArgument.Internal<JvmGenericArrayTypeReference> param) { JvmTypeReference leftComponent = left.getComponentType(); JvmTypeReference rightComponent = right.getComponentType(); return conformanceComputer.isConformant(leftComponent, rightComponent, new TypeConformanceComputationArgument(param.rawType, param.asTypeArgument, false)); }
@Override public List<JvmType> doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Resource resource) { JvmTypeReference componentType = reference.getComponentType(); List<JvmType> rawComponentTypes = visit(componentType, resource); List<JvmType> result = Lists.newArrayListWithCapacity(rawComponentTypes.size()); for(JvmType rawComponentType: rawComponentTypes) { if (!rawComponentType.eIsProxy() && rawComponentType instanceof JvmComponentType) { JvmArrayType arrayType = ((JvmComponentType) rawComponentType).getArrayType(); result.add(arrayType); } } return result; }
@Override public List<JvmType> doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Resource resource) { JvmTypeReference componentType = reference.getComponentType(); List<JvmType> rawComponentTypes = visit(componentType, resource); List<JvmType> result = Lists.newArrayListWithCapacity(rawComponentTypes.size()); for (JvmType rawComponentType : rawComponentTypes) { if (!rawComponentType.eIsProxy() && rawComponentType instanceof JvmComponentType) { JvmArrayType arrayType = ((JvmComponentType) rawComponentType).getArrayType(); result.add(arrayType); } } return result; }
protected JvmType findContext(JvmTypeReference firstType) { if (firstType instanceof JvmGenericArrayTypeReference) { return findContext(((JvmGenericArrayTypeReference) firstType).getComponentType()); } return firstType.getType(); }
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Boolean replaceWildcards) { JvmTypeReference copiedComponent = visit(reference.getComponentType(), replaceWildcards); JvmGenericArrayTypeReference result = typesFactory.createJvmGenericArrayTypeReference(); result.setComponentType(copiedComponent); return result; } @Override
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Resource resource) { JvmTypeReference componentType = reference.getComponentType(); JvmTypeReference rawComponentType = visit(componentType, resource); if (componentType != rawComponentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(rawComponentType); return result; } return reference; }
protected boolean isArrayOfAnnotations(final JvmAnnotationValue annotationValue) { final JvmTypeReference returnType = annotationValue.getOperation().getReturnType(); if ((returnType instanceof JvmGenericArrayTypeReference)) { JvmType _type = ((JvmGenericArrayTypeReference)returnType).getComponentType().getType(); return (_type instanceof JvmAnnotationType); } return false; }
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Resource resource) { JvmTypeReference componentType = reference.getComponentType(); JvmTypeReference rawComponentType = visit(componentType, resource); if (componentType != rawComponentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(rawComponentType); return result; } return reference; }
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Pair<Resource, Set<JvmType>> context) { JvmTypeReference componentType = reference.getComponentType(); JvmTypeReference rawComponentType = visit(componentType, context); if (componentType != rawComponentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(rawComponentType); return result; } return reference; }
protected String computeFieldName(XtendField field) { if (field.getName() != null) return field.getName(); JvmTypeReference type = field.getType(); String name = null; if (type != null) { while (type instanceof JvmGenericArrayTypeReference) { type = ((JvmGenericArrayTypeReference) type).getComponentType(); } if (type instanceof JvmParameterizedTypeReference) { List<INode> nodes = NodeModelUtils.findNodesForFeature(type, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE); if (!nodes.isEmpty()) { String typeName = nodes.get(0).getText().trim(); int lastDot = typeName.lastIndexOf('.'); if (lastDot != -1) { typeName = typeName.substring(lastDot + 1); } name = "_" + Strings.toFirstLower(typeName); } } } return name; }
@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); }
protected void _format(final JvmGenericArrayTypeReference array, @Extension final IFormattableDocument document) { ISemanticRegion _ruleCallTo = this.textRegionExtensions.regionFor(array).ruleCallTo(this.grammar.getArrayBracketsRule()); ArrayBracketsFormattingReplacer _arrayBracketsFormattingReplacer = new ArrayBracketsFormattingReplacer(_ruleCallTo); document.addReplacer(_arrayBracketsFormattingReplacer); document.<JvmTypeReference>format(array.getComponentType()); }
/** * Contexts: * TypeReferenceWithTypeArgs.JvmGenericArrayTypeReference_1_1_0_0 returns JvmGenericArrayTypeReference * * Constraint: * componentType=TypeReferenceWithTypeArgs_JvmGenericArrayTypeReference_1_1_0_0 */ protected void sequence_TypeReferenceWithTypeArgs_JvmGenericArrayTypeReference_1_1_0_0(ISerializationContext context, JvmGenericArrayTypeReference semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, TypesPackage.Literals.JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, TypesPackage.Literals.JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getTypeReferenceWithTypeArgsAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_1_1_0_0(), semanticObject.getComponentType()); feeder.finish(); }
/** * Contexts: * JvmTypeReference returns JvmGenericArrayTypeReference * JvmTypeReference.JvmGenericArrayTypeReference_0_1_0_0 returns JvmGenericArrayTypeReference * JvmArgumentTypeReference returns JvmGenericArrayTypeReference * * Constraint: * componentType=JvmTypeReference_JvmGenericArrayTypeReference_0_1_0_0 */ protected void sequence_JvmTypeReference(ISerializationContext context, JvmGenericArrayTypeReference semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, TypesPackage.Literals.JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, TypesPackage.Literals.JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getJvmTypeReferenceAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0(), semanticObject.getComponentType()); feeder.finish(); }
/** * Contexts: * TypeReferenceWithTypeArgs.JvmGenericArrayTypeReference_0_1_0_0 returns JvmGenericArrayTypeReference * * Constraint: * componentType=TypeReferenceWithTypeArgs_JvmGenericArrayTypeReference_0_1_0_0 */ protected void sequence_TypeReferenceWithTypeArgs_JvmGenericArrayTypeReference_0_1_0_0(ISerializationContext context, JvmGenericArrayTypeReference semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, TypesPackage.Literals.JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, TypesPackage.Literals.JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getTypeReferenceWithTypeArgsAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0(), semanticObject.getComponentType()); feeder.finish(); }
protected void _format(final JvmGenericArrayTypeReference array, final FormattableDocument document) { final Procedure1<FormattingDataInit> _function = (FormattingDataInit it) -> { it.noSpace(); }; Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _prepend = this._formattingDataFactory.prepend(this._nodeModelAccess.nodeForKeyword(array, "["), _function); document.operator_add(_prepend); final Procedure1<FormattingDataInit> _function_1 = (FormattingDataInit it) -> { it.noSpace(); }; Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _prepend_1 = this._formattingDataFactory.prepend(this._nodeModelAccess.nodeForKeyword(array, "]"), _function_1); document.operator_add(_prepend_1); this.format(array.getComponentType(), document); }
public void generateParameter(final JvmFormalParameter it, final ITreeAppendable appendable, final boolean vararg, final GeneratorConfig config) { final ITreeAppendable tracedAppendable = appendable.trace(it); this.generateAnnotations(it.getAnnotations(), tracedAppendable, false, config); tracedAppendable.append("final "); if (vararg) { JvmTypeReference _parameterType = it.getParameterType(); boolean _not = (!(_parameterType instanceof JvmGenericArrayTypeReference)); if (_not) { tracedAppendable.append("/* Internal Error: Parameter was vararg but not an array type. */"); } else { JvmTypeReference _parameterType_1 = it.getParameterType(); this._errorSafeExtensions.serializeSafely(((JvmGenericArrayTypeReference) _parameterType_1).getComponentType(), "Object", tracedAppendable); } tracedAppendable.append("..."); } else { this._errorSafeExtensions.serializeSafely(it.getParameterType(), "Object", tracedAppendable); } tracedAppendable.append(" "); final String name = tracedAppendable.declareVariable(it, this.makeJavaIdentifier(it.getSimpleName())); this._treeAppendableUtil.traceSignificant(tracedAppendable, it).append(name); }