public String getReadableName(XtendTypeDeclaration typeDeclaration) { if (typeDeclaration instanceof AnonymousClass) { JvmGenericType superType = anonymousClassUtil.getSuperType((AnonymousClass) typeDeclaration); return "new " + superType.getSimpleName() + "(){}"; } else if (typeDeclaration.getName() == null) { return "<unnamed>"; } return typeDeclaration.getName(); }
protected JvmConstructor inferAnonymousClassConstructor(AnonymousClass anonymousClass, JvmGenericType inferredLocalClass) { XConstructorCall constructorCall = anonymousClass.getConstructorCall(); JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor(); inferredLocalClass.getMembers().add(constructor); associator.associatePrimary(constructorCall, constructor); constructor.setVisibility(JvmVisibility.DEFAULT); constructor.setSimpleName(inferredLocalClass.getSimpleName()); return constructor; }
if (sameSignature.size() > 1) { error("Duplicate " + typeLabel(executable) + " " + operationWithSameSignature.getSimpleSignature() + " in type " + inferredType.getSimpleName(), otherSource, nameFeature(otherSource), DUPLICATE_METHOD); } else { + " has the same erasure " + operationWithSameSignature.getResolvedErasureSignature() + " as another " + typeLabel(executable) + " in type " + inferredType.getSimpleName(), otherSource, nameFeature(otherSource), DUPLICATE_METHOD);
localType.setSimpleName(localType.getSimpleName() + '_' + (i++));
protected void completeJvmGenericType(JvmGenericType element) { // if no super type add Object ensureSuperTypeObject(element); addAnnotations(element); if (!element.isInterface()) { // if no constructors have been added, add a default constructor if (isEmpty(element.getDeclaredConstructors())) { JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor(); constructor.setSimpleName(element.getSimpleName()); constructor.setVisibility(JvmVisibility.PUBLIC); typeExtensions.setSynthetic(constructor, true); EObject primarySourceElement = associations.getPrimarySourceElement(element); if (primarySourceElement != null) { associator.associate(primarySourceElement, constructor); } element.getMembers().add(constructor); } } }
protected boolean hasCycleInHierarchy(final WithExtendsClause withExtendsClause) { JvmTypeReference _superType = withExtendsClause.getExtendsClause().getSuperType(); JvmType _type = null; if (_superType!=null) { _type=_superType.getType(); } final JvmType superType = _type; if ((superType instanceof JvmGenericType)) { boolean _hasCycleInHierarchy = this.hasCycleInHierarchy(((JvmGenericType)superType), CollectionLiterals.<JvmGenericType>newHashSet()); if (_hasCycleInHierarchy) { String _simpleName = ((JvmGenericType)superType).getSimpleName(); String _plus = ("The inheritance hierarchy of " + _simpleName); String _plus_1 = (_plus + " contains cycles"); this.error(_plus_1, withExtendsClause.getExtendsClause(), ModelPackage.Literals.EXTENDS_CLAUSE__SUPER_TYPE, EmfParsleyDslValidator.CYCLIC_INHERITANCE); return true; } } return false; }
} else constructor.setVisibility(JvmVisibility.PRIVATE); constructor.setSimpleName(inferredLocalClass.getSimpleName()); constructor.setVarArgs(superConstructor.isVarArgs()); final List<JvmFormalParameter> parameters = superConstructor.getParameters();
SARLJvmModelInferrer.this.typeBuilder.setDocumentation(it2, MessageFormat.format(Messages.SARLJvmModelInferrer_2, target.getSimpleName())); final JvmFormalParameter param = this.typesFactory.createJvmFormalParameter(); param.setName("builder"); //$NON-NLS-1$
protected void transform(XtendConstructor source, JvmGenericType container) { JvmConstructor constructor = typesFactory.createJvmConstructor(); container.getMembers().add(constructor); associator.associatePrimary(source, constructor); JvmVisibility visibility = source.getVisibility(); constructor.setSimpleName(container.getSimpleName()); constructor.setVisibility(visibility); for (XtendParameter parameter : source.getParameters()) { translateParameter(constructor, parameter); } copyAndFixTypeParameters(source.getTypeParameters(), constructor); for (JvmTypeReference exception : source.getExceptions()) { constructor.getExceptions().add(jvmTypesBuilder.cloneWithProxies(exception)); } translateAnnotationsTo(source.getAnnotations(), constructor); setBody(constructor, source.getExpression()); jvmTypesBuilder.copyDocumentationTo(source, constructor); }
final String constructorName = container.getSimpleName(); container.getMembers().add(constructor2); copyAndCleanDocumentationTo(source, constructor2); constructor2.setSimpleName(container.getSimpleName()); constructor2.setVisibility(constructor.getVisibility()); constructor2.setVarArgs(isVarArgs);
protected ITreeAppendable _generateBody(final JvmGenericType it, final ITreeAppendable appendable, final GeneratorConfig config) { ITreeAppendable _xblockexpression = null; { this.generateJavaDoc(it, appendable, config); final ITreeAppendable childAppendable = appendable.trace(it); this.generateAnnotations(it.getAnnotations(), childAppendable, true, config); this.generateModifier(it, childAppendable, config); boolean _isInterface = it.isInterface(); if (_isInterface) { childAppendable.append("interface "); } else { childAppendable.append("class "); } this._treeAppendableUtil.traceSignificant(childAppendable, it).append(this.makeJavaIdentifier(it.getSimpleName())); this.generateTypeParameterDeclaration(it, childAppendable, config); boolean _isEmpty = it.getTypeParameters().isEmpty(); if (_isEmpty) { childAppendable.append(" "); } this.generateExtendsClause(it, childAppendable, config); this.generateMembersInBody(it, childAppendable, config); ITreeAppendable _xifexpression = null; if (((!it.isAnonymous()) && (!(it.eContainer() instanceof JvmType)))) { _xifexpression = appendable.newLine(); } _xblockexpression = _xifexpression; } return _xblockexpression; }
final JvmConstructor newCons = this.typesFactory.createJvmConstructor(); newCons.setDeprecated(constructor.isDeprecated()); newCons.setSimpleName(target.getSimpleName()); target.getMembers().add(newCons);
error("Name clash: The method " + localOperation.getSimpleSignature() + " of type " + inferredType.getSimpleName() + " has the same erasure as " }; if (!operation.getDeclaration().isAbstract() && !conflictingOperation.getDeclaration().isAbstract()) { error("The type " + inferredType.getSimpleName() + " inherits multiple implementations of the method " + conflictingOperation.getSimpleSignature() + " from " + getDeclaratorName(conflictingOperation.getDeclaration())
final ITreeAppendable childAppendable = appendable.trace(anonymousClass); childAppendable.append("abstract class "); this._treeAppendableUtil.traceSignificant(childAppendable, anonymousClass).append(it.getSimpleName()); boolean _isEmpty = it.getTypeParameters().isEmpty(); if (_isEmpty) { if (_needSyntheticThisVariable) { Pair<String, JvmGenericType> _mappedTo = Pair.<String, JvmGenericType>of("this", it); String _simpleName = it.getSimpleName(); String _plus = ("_this" + _simpleName); final String thisName = childAppendable.declareSyntheticVariable(_mappedTo, _plus); childAppendable.newLine().append("final ").append(it.getSimpleName()).append(" ").append(thisName).append(" = this;").newLine();